parent
9b05afdee8
commit
0cba0874f3
|
@ -248,7 +248,7 @@ public final class ClientRegistrations {
|
|||
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
|
||||
.clientAuthenticationMethod(method)
|
||||
.redirectUri("{baseUrl}/{action}/oauth2/code/{registrationId}")
|
||||
.authorizationUri(metadata.getAuthorizationEndpointURI().toASCIIString())
|
||||
.authorizationUri((metadata.getAuthorizationEndpointURI() != null) ? metadata.getAuthorizationEndpointURI().toASCIIString() : null)
|
||||
.providerConfigurationMetadata(configurationMetadata)
|
||||
.tokenUri(metadata.getTokenEndpointURI().toASCIIString())
|
||||
.issuerUri(issuer)
|
||||
|
|
|
@ -258,6 +258,30 @@ public class ClientRegistrationsTests {
|
|||
assertThat(registration.getAuthorizationGrantType()).isEqualTo(AuthorizationGrantType.AUTHORIZATION_CODE);
|
||||
}
|
||||
|
||||
// gh-9795
|
||||
@Test
|
||||
public void issuerWhenResponseAuthorizationEndpointIsNullThenSuccess() throws Exception {
|
||||
this.response.put("grant_types_supported", Arrays.asList("urn:ietf:params:oauth:grant-type:jwt-bearer"));
|
||||
this.response.remove("authorization_endpoint");
|
||||
ClientRegistration registration = registration("").authorizationGrantType(AuthorizationGrantType.JWT_BEARER)
|
||||
.build();
|
||||
assertThat(registration.getAuthorizationGrantType()).isEqualTo(AuthorizationGrantType.JWT_BEARER);
|
||||
ClientRegistration.ProviderDetails provider = registration.getProviderDetails();
|
||||
assertThat(provider.getAuthorizationUri()).isNull();
|
||||
}
|
||||
|
||||
// gh-9795
|
||||
@Test
|
||||
public void issuerWhenOAuth2ResponseAuthorizationEndpointIsNullThenSuccess() throws Exception {
|
||||
this.response.put("grant_types_supported", Arrays.asList("urn:ietf:params:oauth:grant-type:jwt-bearer"));
|
||||
this.response.remove("authorization_endpoint");
|
||||
ClientRegistration registration = registrationOAuth2("", null)
|
||||
.authorizationGrantType(AuthorizationGrantType.JWT_BEARER).build();
|
||||
assertThat(registration.getAuthorizationGrantType()).isEqualTo(AuthorizationGrantType.JWT_BEARER);
|
||||
ClientRegistration.ProviderDetails provider = registration.getProviderDetails();
|
||||
assertThat(provider.getAuthorizationUri()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void issuerWhenTokenEndpointAuthMethodsNullThenDefaulted() throws Exception {
|
||||
this.response.remove("token_endpoint_auth_methods_supported");
|
||||
|
|
Loading…
Reference in New Issue