1
0
mirror of synced 2026-07-19 17:45:11 +00:00

Test OpenID Discovery with Trailing Slash

Fixes gh-6234
This commit is contained in:
Josh Cummings
2018-12-05 10:54:30 -07:00
parent f755580a91
commit 566bc6a6e1
2 changed files with 15 additions and 0 deletions
@@ -137,6 +137,12 @@ public class ClientRegistrationsTest {
assertThat(provider.getUserInfoEndpoint().getUri()).isEqualTo("https://example.com/oauth2/v3/userinfo");
}
@Test
public void issuerWhenContainsTrailingSlashThenSuccess() throws Exception {
assertThat(registration("")).isNotNull();
assertThat(this.issuer.endsWith("/")).isTrue();
}
/**
* https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
*
@@ -24,6 +24,7 @@ import org.junit.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
/**
@@ -91,6 +92,14 @@ public class JwtDecodersTests {
.hasMessageContaining("This iss claim is not equal to the configured issuer");
}
@Test
public void issuerWhenContainsTrailingSlashThenSuccess() {
prepareOpenIdConfigurationResponse();
this.server.enqueue(new MockResponse().setBody(JWK_SET));
assertThat(JwtDecoders.fromOidcIssuerLocation(this.issuer)).isNotNull();
assertThat(this.issuer.endsWith("/")).isTrue();
}
@Test
public void issuerWhenResponseIsNonCompliantThenThrowsRuntimeException() {
prepareOpenIdConfigurationResponse("{ \"missing_required_keys\" : \"and_values\" }");