public async Task RequestJwksAsync_404_Throws() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri( m_host + BAD_PATH ) ); JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); }
public async Task RequestJwksAsync_CantReachServer_Throws() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri( "http://foo.bar.fakesite.isurehopethisisneveravalidTLD" ) ); JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); }
public async Task RequestJwksAsync_404_Throws() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri(m_host + BAD_PATH) ); JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); }
public async Task RequestJwksAsync_CantReachServer_Throws() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri("http://foo.bar.fakesite.isurehopethisisneveravalidTLD") ); JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); }
public void RequestJwksAsync_404_Throws() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri(m_host + BAD_PATH) ); Assert.ThrowsAsync <PublicKeyLookupFailureException>(async() => { JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); }); }
public void RequestJwksAsync_CantReachServer_Throws() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri("http://foo.bar.fakesite.isurehopethisisneveravalidTLD") ); Assert.ThrowsAsync <PublicKeyLookupFailureException>(async() => { JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); }); }
public async Task SuccessCase() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri( m_host + GOOD_PATH ) ); JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); JsonWebKey jwk; Assert.IsNotNull( jwks ); Assert.IsTrue( jwks.TryGetKey( GOOD_JWK_ID, out jwk ) ); }
public void RequestJwksAsync_HTML_Throws() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri(m_host + HTML_PATH) ); var e = Assert.Throws <PublicKeyLookupFailureException>(() => publicKeyProvider .RequestJwksAsync() .SafeWait() ); StringAssert.Contains("<body>", e.Message); }
public async Task SuccessCase() { IJwksProvider publicKeyProvider = new JwksProvider( new HttpClient(), new Uri(m_host + GOOD_PATH) ); JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); JsonWebKey jwk; Assert.IsNotNull(jwks); Assert.IsTrue(jwks.TryGetKey(GOOD_JWK_ID, out jwk)); }
public void RequestJwksAsync_CantReachServer_Throws() { using (SetupJwkServer(out string host)) using (HttpClient httpClient = new HttpClient()) { IJwksProvider publicKeyProvider = new JwksProvider( httpClient, jwksEndpoint: new Uri("http://foo.bar.fakesite.isurehopethisisneveravalidTLD"), jwkEndpoint: null ); Assert.ThrowsAsync <PublicKeyLookupFailureException>(async() => { JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); }); } }
public void RequestJwksAsync_404_Throws() { using (SetupJwkServer(out string host)) using (HttpClient httpClient = new HttpClient()) { IJwksProvider publicKeyProvider = new JwksProvider( httpClient, jwksEndpoint: new Uri(host + BAD_PATH), jwkEndpoint: null ); Assert.ThrowsAsync <PublicKeyLookupFailureException>(async() => { JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); }); } }
public void RequestJwksAsync_HTML_Throws() { using (SetupJwkServer(out string host)) using (HttpClient httpClient = new HttpClient()) { IJwksProvider publicKeyProvider = new JwksProvider( httpClient, jwksEndpoint: new Uri(host + HTML_PATH), jwkEndpoint: null ); var e = Assert.Throws <PublicKeyLookupFailureException>(() => publicKeyProvider .RequestJwksAsync() .SafeWait() ); StringAssert.Contains("<body>", e.Message); } }
public async Task RequestJwksAsync_SuccessCase() { using (SetupJwkServer(out string host)) using (HttpClient httpClient = new HttpClient()) { IJwksProvider publicKeyProvider = new JwksProvider( httpClient, jwksEndpoint: new Uri(host + GOOD_PATH + JWKS_PATH), jwkEndpoint: null ); JsonWebKeySet jwks = await publicKeyProvider .RequestJwksAsync() .SafeAsync(); Assert.IsNotNull(jwks); Assert.IsTrue(jwks.TryGetKey(GOOD_JWK_ID, out JsonWebKey jwk)); Assert.IsTrue(jwks.TryGetKey(GOOD_JWK_ID_STRING, out JsonWebKey jwkString)); } }