aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Web
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Tango.Web')
-rw-r--r--Software/Visual_Studio/Tango.Web/Authentication/TokensManager.cs30
-rw-r--r--Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs2
-rw-r--r--Software/Visual_Studio/Tango.Web/Tango.Web.csproj1
3 files changed, 32 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.Web/Authentication/TokensManager.cs b/Software/Visual_Studio/Tango.Web/Authentication/TokensManager.cs
new file mode 100644
index 000000000..20fc8ab50
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Web/Authentication/TokensManager.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Web.Authentication
+{
+ public class TokensManager
+ {
+ private List<String> _tokens;
+
+ public TokensManager()
+ {
+ _tokens = new List<string>();
+ }
+
+ public String CreateNew()
+ {
+ String token = Guid.NewGuid().ToString();
+ _tokens.Add(token);
+ return token;
+ }
+
+ public bool Exists(String token)
+ {
+ return _tokens.Contains(token);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs b/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs
index a581d9ec7..9d9016d5a 100644
--- a/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs
+++ b/Software/Visual_Studio/Tango.Web/Controllers/JsonController.cs
@@ -65,7 +65,7 @@ namespace Tango.Web.Controllers
code = HttpStatusCode.Unauthorized;
}
- throw new HttpResponseException(Request.CreateErrorResponse(code, ex.Message));
+ throw new HttpResponseException(Request.CreateErrorResponse(code, ex.ToString()));
}
}
}
diff --git a/Software/Visual_Studio/Tango.Web/Tango.Web.csproj b/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
index 9d199a409..385b3bde8 100644
--- a/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
+++ b/Software/Visual_Studio/Tango.Web/Tango.Web.csproj
@@ -228,6 +228,7 @@
<Compile Include="..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="Authentication\TokensManager.cs" />
<Compile Include="Storage\ExtensionMethods.cs" />
<Compile Include="Storage\StorageManager.cs" />
<Compile Include="WebConfig.cs" />