|
|
@ -69,6 +69,7 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
|
|
|
provider.setAuthorizationUri("http://example.com/auth");
|
|
|
|
provider.setAuthorizationUri("http://example.com/auth");
|
|
|
|
provider.setTokenUri("http://example.com/token");
|
|
|
|
provider.setTokenUri("http://example.com/token");
|
|
|
|
provider.setUserInfoUri("http://example.com/info");
|
|
|
|
provider.setUserInfoUri("http://example.com/info");
|
|
|
|
|
|
|
|
provider.setUserInfoAuthenticationMethod("form");
|
|
|
|
provider.setUserNameAttribute("sub");
|
|
|
|
provider.setUserNameAttribute("sub");
|
|
|
|
provider.setJwkSetUri("http://example.com/jwk");
|
|
|
|
provider.setJwkSetUri("http://example.com/jwk");
|
|
|
|
Registration registration = new Registration();
|
|
|
|
Registration registration = new Registration();
|
|
|
@ -91,6 +92,9 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
|
|
|
assertThat(adaptedProvider.getTokenUri()).isEqualTo("http://example.com/token");
|
|
|
|
assertThat(adaptedProvider.getTokenUri()).isEqualTo("http://example.com/token");
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getUri())
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getUri())
|
|
|
|
.isEqualTo("http://example.com/info");
|
|
|
|
.isEqualTo("http://example.com/info");
|
|
|
|
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getAuthenticationMethod())
|
|
|
|
|
|
|
|
.isEqualTo(
|
|
|
|
|
|
|
|
org.springframework.security.oauth2.core.AuthenticationMethod.FORM);
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getUserNameAttributeName())
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getUserNameAttributeName())
|
|
|
|
.isEqualTo("sub");
|
|
|
|
.isEqualTo("sub");
|
|
|
|
assertThat(adaptedProvider.getJwkSetUri()).isEqualTo("http://example.com/jwk");
|
|
|
|
assertThat(adaptedProvider.getJwkSetUri()).isEqualTo("http://example.com/jwk");
|
|
|
@ -167,6 +171,9 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v3/userinfo");
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v3/userinfo");
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getUserNameAttributeName())
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getUserNameAttributeName())
|
|
|
|
.isEqualTo(IdTokenClaimNames.SUB);
|
|
|
|
.isEqualTo(IdTokenClaimNames.SUB);
|
|
|
|
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getAuthenticationMethod())
|
|
|
|
|
|
|
|
.isEqualTo(
|
|
|
|
|
|
|
|
org.springframework.security.oauth2.core.AuthenticationMethod.HEADER);
|
|
|
|
assertThat(adaptedProvider.getJwkSetUri())
|
|
|
|
assertThat(adaptedProvider.getJwkSetUri())
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v3/certs");
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v3/certs");
|
|
|
|
assertThat(adapted.getRegistrationId()).isEqualTo("registration");
|
|
|
|
assertThat(adapted.getRegistrationId()).isEqualTo("registration");
|
|
|
@ -210,6 +217,9 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v4/token");
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v4/token");
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getUri())
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getUri())
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v3/userinfo");
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v3/userinfo");
|
|
|
|
|
|
|
|
assertThat(adaptedProvider.getUserInfoEndpoint().getAuthenticationMethod())
|
|
|
|
|
|
|
|
.isEqualTo(
|
|
|
|
|
|
|
|
org.springframework.security.oauth2.core.AuthenticationMethod.HEADER);
|
|
|
|
assertThat(adaptedProvider.getJwkSetUri())
|
|
|
|
assertThat(adaptedProvider.getJwkSetUri())
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v3/certs");
|
|
|
|
.isEqualTo("https://www.googleapis.com/oauth2/v3/certs");
|
|
|
|
assertThat(adapted.getRegistrationId()).isEqualTo("google");
|
|
|
|
assertThat(adapted.getRegistrationId()).isEqualTo("google");
|
|
|
@ -334,6 +344,9 @@ public class OAuth2ClientPropertiesRegistrationAdapterTests {
|
|
|
|
.isEqualTo("https://example.com/oauth2/v3/certs");
|
|
|
|
.isEqualTo("https://example.com/oauth2/v3/certs");
|
|
|
|
assertThat(providerDetails.getUserInfoEndpoint().getUri())
|
|
|
|
assertThat(providerDetails.getUserInfoEndpoint().getUri())
|
|
|
|
.isEqualTo("https://example.com/oauth2/v3/userinfo");
|
|
|
|
.isEqualTo("https://example.com/oauth2/v3/userinfo");
|
|
|
|
|
|
|
|
assertThat(providerDetails.getUserInfoEndpoint().getAuthenticationMethod())
|
|
|
|
|
|
|
|
.isEqualTo(
|
|
|
|
|
|
|
|
org.springframework.security.oauth2.core.AuthenticationMethod.HEADER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String cleanIssuerPath(String issuer) {
|
|
|
|
private String cleanIssuerPath(String issuer) {
|
|
|
|