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()); }
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()); }
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); } }