aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Publisher.CLI/Properties/AssemblyInfo.cs
blob: c6022fd24437d087df42f921efd06bd693cdd7a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tango.MachineStudio.Publisher.CLI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tango.MachineStudio.Publisher.CLI")]
[assembly: AssemblyCopyright("Copyright ©  2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6f924f92-611b-41cf-a6e6-443e69d4ca83")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
="p">; set; } } [TestMethod] public void Test_JWT_Tokens_Read_Write_Validation() { string secret = "GQDstcKsx0NHjPOuXOYg5MbeJ1XT0uFiwDVvVBrk"; //Create new web token with embedded object. Expiration in 2 seconds. var webToken = WebToken<TokenObject>.CreateNew(secret, new TokenObject() { Name = "Roy", Age = 35 }, DateTime.UtcNow.AddSeconds(2)); //Get the actual string token. String token = webToken.AccessToken; //Validate the string token using the secret. WebToken.Validate(secret, token); //Read the token payload (Expiration, Issued, Embedded Object).. var read_web_token = WebToken<TokenObject>.FromToken(token); //Validate the token again using the web token instance (Just to see if the method is working..) read_web_token.Validate(secret); //Validate the token payload reading.. Assert.AreEqual(read_web_token.Expiration.Value.ToString("hh:mm"), webToken.Expiration.Value.ToString("hh:mm")); Assert.AreEqual(read_web_token.Issued.ToString("hh:mm"), webToken.Issued.ToString("hh:mm")); Assert.AreEqual(read_web_token.Object.Name, webToken.Object.Name); Assert.AreEqual(read_web_token.Object.Age, webToken.Object.Age); //Ensure token validation fails when messing with the token string. Assert.ThrowsException<SignatureVerificationException>(() => { WebToken.Validate(secret, token.Substring(0, token.Length - 1) + "0"); }); //Wait for the token to expire... Thread.Sleep(2000); //Ensure the token validation fails with 'token expired'. Assert.ThrowsException<TokenExpiredException>(() => read_web_token.Validate(secret)); } } }