diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-02-24 10:54:16 +0200 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-02-24 10:54:16 +0200 |
| commit | 682018018e817ae15e9ab7f38a5d923b41c8cf9a (patch) | |
| tree | 799bcb84d8c0443c3cd91b576c95c73c06fa4a42 /Software/Visual_Studio/Web/Tango.MachineService/Security/RefreshTokenEncoder.cs | |
| parent | 9650a4bd82398bcece7fb054c79f73996cd2d664 (diff) | |
| parent | 028ab0e5cc2699ceec3e04b1eeab5f56b9b38083 (diff) | |
| download | Tango-682018018e817ae15e9ab7f38a5d923b41c8cf9a.tar.gz Tango-682018018e817ae15e9ab7f38a5d923b41c8cf9a.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Security/RefreshTokenEncoder.cs')
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService/Security/RefreshTokenEncoder.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Security/RefreshTokenEncoder.cs b/Software/Visual_Studio/Web/Tango.MachineService/Security/RefreshTokenEncoder.cs new file mode 100644 index 000000000..3948ae1c4 --- /dev/null +++ b/Software/Visual_Studio/Web/Tango.MachineService/Security/RefreshTokenEncoder.cs @@ -0,0 +1,26 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Tango.Core.Cryptography; + +namespace Tango.MachineService.Security +{ + public class RefreshTokenEncoder<T> + { + public String Encode(T obj) + { + String str = obj.ToJsonString(); + Rfc2898Cryptographer crypt = new Rfc2898Cryptographer(); + return crypt.Encrypt(str); + } + + public T Decode(String token) + { + Rfc2898Cryptographer crypt = new Rfc2898Cryptographer(); + String str = crypt.Decrypt(token); + return JsonConvert.DeserializeObject<T>(str); + } + } +}
\ No newline at end of file |
