示例#1
0
        public void TestFactorFromKey()
        {
            var generator = JwtGeneratorFactory.CreateGenerator(_mockAppId, _mockPKCS8);
            var jwt       = generator.GenerateJwt();
            var decoded   = JsonConvert.DeserializeObject <JObject>(generator.DecodeJwt(jwt));

            Assert.Equal(_mockAppId, decoded["application_id"].ToString());
        }
示例#2
0
        public void TestFromFile()
        {
            var generator = JwtGeneratorFactory.CreateGeneratorWithFilePath(_mockAppId, "./mock.key");
            var jwt       = generator.GenerateJwt();
            var decoded   = JsonConvert.DeserializeObject <JObject>(generator.DecodeJwt(jwt));

            Assert.Equal(_mockAppId, decoded["application_id"].ToString());
        }
示例#3
0
 public void TestBadPath()
 {
     try
     {
         JwtGeneratorFactory.CreateGeneratorWithFilePath(_mockAppId, "./not/a/valid/path.key");
     }
     catch (FileNotFoundException ex)
     {
         Assert.Equal("No ./not/a/valid/path.key file found", ex.Message);
     }
 }