Skip to content

Commit af9e762

Browse files
sarahwaltherjgrandja
authored andcommitted
Update RegisteredClient.Builder to use getters
- Since the class is not final, it is possible to extend it. Because the Builder was directly accessing the properties rather than using the getters, it was not possible to use the .from(id) constructor in the extended class. Closes spring-projectsgh-451
1 parent cdb97dd commit af9e762

File tree

1 file changed

+14
-14
lines changed
  • oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client

1 file changed

+14
-14
lines changed

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/client/RegisteredClient.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -262,23 +262,23 @@ protected Builder(String id) {
262262
}
263263

264264
protected Builder(RegisteredClient registeredClient) {
265-
this.id = registeredClient.id;
266-
this.clientId = registeredClient.clientId;
267-
this.clientIdIssuedAt = registeredClient.clientIdIssuedAt;
268-
this.clientSecret = registeredClient.clientSecret;
269-
this.clientSecretExpiresAt = registeredClient.clientSecretExpiresAt;
270-
this.clientName = registeredClient.clientName;
271-
if (!CollectionUtils.isEmpty(registeredClient.clientAuthenticationMethods)) {
272-
this.clientAuthenticationMethods.addAll(registeredClient.clientAuthenticationMethods);
265+
this.id = registeredClient.getId();
266+
this.clientId = registeredClient.getClientId();
267+
this.clientIdIssuedAt = registeredClient.getClientIdIssuedAt();
268+
this.clientSecret = registeredClient.getClientSecret();
269+
this.clientSecretExpiresAt = registeredClient.getClientSecretExpiresAt();
270+
this.clientName = registeredClient.getClientName();
271+
if (!CollectionUtils.isEmpty(registeredClient.getClientAuthenticationMethods())) {
272+
this.clientAuthenticationMethods.addAll(registeredClient.getClientAuthenticationMethods());
273273
}
274-
if (!CollectionUtils.isEmpty(registeredClient.authorizationGrantTypes)) {
275-
this.authorizationGrantTypes.addAll(registeredClient.authorizationGrantTypes);
274+
if (!CollectionUtils.isEmpty(registeredClient.getAuthorizationGrantTypes())) {
275+
this.authorizationGrantTypes.addAll(registeredClient.getAuthorizationGrantTypes());
276276
}
277-
if (!CollectionUtils.isEmpty(registeredClient.redirectUris)) {
278-
this.redirectUris.addAll(registeredClient.redirectUris);
277+
if (!CollectionUtils.isEmpty(registeredClient.getRedirectUris())) {
278+
this.redirectUris.addAll(registeredClient.getRedirectUris());
279279
}
280-
if (!CollectionUtils.isEmpty(registeredClient.scopes)) {
281-
this.scopes.addAll(registeredClient.scopes);
280+
if (!CollectionUtils.isEmpty(registeredClient.getScopes())) {
281+
this.scopes.addAll(registeredClient.getScopes());
282282
}
283283
this.clientSettings = ClientSettings.withSettings(registeredClient.getClientSettings().getSettings()).build();
284284
this.tokenSettings = TokenSettings.withSettings(registeredClient.getTokenSettings().getSettings()).build();

0 commit comments

Comments
 (0)