Add ClientRegistration.Builder.registrationId
Fixes: gh-5527
This commit is contained in:
parent
2cd548221d
commit
981d35a92c
|
@ -255,6 +255,17 @@ public final class ClientRegistration {
|
||||||
this.registrationId = registrationId;
|
this.registrationId = registrationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the client identifier.
|
||||||
|
*
|
||||||
|
* @param registrationId the registration id
|
||||||
|
* @return the {@link Builder}
|
||||||
|
*/
|
||||||
|
public Builder registrationId(String registrationId) {
|
||||||
|
this.registrationId = registrationId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the client identifier.
|
* Sets the client identifier.
|
||||||
*
|
*
|
||||||
|
|
|
@ -351,4 +351,24 @@ public class ClientRegistrationTests {
|
||||||
.clientName(null)
|
.clientName(null)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void buildWhenOverrideRegistrationIdThenOverridden() {
|
||||||
|
String overriddenId = "override";
|
||||||
|
ClientRegistration registration = ClientRegistration.withRegistrationId(REGISTRATION_ID)
|
||||||
|
.registrationId(overriddenId)
|
||||||
|
.clientId(CLIENT_ID)
|
||||||
|
.clientSecret(CLIENT_SECRET)
|
||||||
|
.clientAuthenticationMethod(ClientAuthenticationMethod.BASIC)
|
||||||
|
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
|
||||||
|
.redirectUriTemplate(REDIRECT_URI)
|
||||||
|
.scope(SCOPES.toArray(new String[0]))
|
||||||
|
.authorizationUri(AUTHORIZATION_URI)
|
||||||
|
.tokenUri(TOKEN_URI)
|
||||||
|
.jwkSetUri(JWK_SET_URI)
|
||||||
|
.clientName(CLIENT_NAME)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
assertThat(registration.getRegistrationId()).isEqualTo(overriddenId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue