From 795444f234f6b45bc83d5c7b28725bd7ebc7ee89 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 24 Dec 2018 17:39:01 +0200 Subject: Working on machine service and machine studio. --- .../Tango.Web/Authentication/TokensManager.cs | 30 ++++++++++++++++++++++ .../Tango.Web/Controllers/JsonController.cs | 2 +- Software/Visual_Studio/Tango.Web/Tango.Web.csproj | 1 + 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 Software/Visual_Studio/Tango.Web/Authentication/TokensManager.cs (limited to 'Software/Visual_Studio/Tango.Web') 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 _tokens; + + public TokensManager() + { + _tokens = new List(); + } + + 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 @@ GlobalVersionInfo.cs + -- cgit v1.3.1