diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-02-25 11:02:07 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-02-25 11:02:07 +0200 |
| commit | b462fdd744f491b04137fd99863f6cb6c623cfa0 (patch) | |
| tree | 2f69f8e953450a0452442c24f3809aec84ce7db0 /Software/Visual_Studio/Web/Tango.MachineService/Security/RefreshTokenEncoder.cs | |
| parent | a8ddb23154fe5111c9509fa0a83dcc36adcba4ee (diff) | |
| parent | 44a35db8a2929fb3f6aa56ed08185e066292f106 (diff) | |
| download | Tango-b462fdd744f491b04137fd99863f6cb6c623cfa0.tar.gz Tango-b462fdd744f491b04137fd99863f6cb6c623cfa0.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_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..896788ffc --- /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 json = JsonConvert.SerializeObject(obj); + Rfc2898Cryptographer crypt = new Rfc2898Cryptographer(); + return crypt.Encrypt(json); + } + + public T Decode(String token) + { + Rfc2898Cryptographer crypt = new Rfc2898Cryptographer(); + String json = crypt.Decrypt(token); + return JsonConvert.DeserializeObject<T>(json); + } + } +}
\ No newline at end of file |
