diff --git a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTest.java b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTest.java index 35576d7e6f..5ec0e07a8f 100644 --- a/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTest.java +++ b/oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/registration/ClientRegistrationsTest.java @@ -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 * diff --git a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java index 22c149d7d5..ffee56264f 100644 --- a/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java +++ b/oauth2/oauth2-jose/src/test/java/org/springframework/security/oauth2/jwt/JwtDecodersTests.java @@ -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\" }");