diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-24 17:39:01 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-24 17:39:01 +0200 |
| commit | 795444f234f6b45bc83d5c7b28725bd7ebc7ee89 (patch) | |
| tree | 7b2d86f0118c65316e0b9a965a60c1386749369a /Software/Visual_Studio/Tango.Web | |
| parent | 0fb83fb3abb456ee6707b7f3cabc6b0c1ab2281b (diff) | |
| download | Tango-795444f234f6b45bc83d5c7b28725bd7ebc7ee89.tar.gz Tango-795444f234f6b45bc83d5c7b28725bd7ebc7ee89.zip | |
Working on machine service and machine studio.
Diffstat (limited to 'Software/Visual_Studio/Tango.Web')
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" /> |
