Get 'clientName' from 'registrationId'

This commit is contained in:
vzikratyi 2020-07-10 13:16:34 +03:00
parent 483a3b847b
commit d8fecd18d9
4 changed files with 1 additions and 6 deletions

View File

@ -40,7 +40,6 @@ public class OAuth2ClientRegistration {
private String userNameAttributeName; private String userNameAttributeName;
private String jwkSetUri; private String jwkSetUri;
private String clientAuthenticationMethod; private String clientAuthenticationMethod;
private String clientName;
private String loginButtonLabel; private String loginButtonLabel;
private String loginButtonIcon; private String loginButtonIcon;
} }

View File

@ -39,13 +39,13 @@ public class HybridClientRegistrationRepository implements ClientRegistrationRep
private ClientRegistration toSpringClientRegistration(String redirectUriTemplate, OAuth2ClientRegistration localClientRegistration){ private ClientRegistration toSpringClientRegistration(String redirectUriTemplate, OAuth2ClientRegistration localClientRegistration){
return ClientRegistration.withRegistrationId(localClientRegistration.getRegistrationId()) return ClientRegistration.withRegistrationId(localClientRegistration.getRegistrationId())
.clientName(localClientRegistration.getRegistrationId())
.clientId(localClientRegistration.getClientId()) .clientId(localClientRegistration.getClientId())
.authorizationUri(localClientRegistration.getAuthorizationUri()) .authorizationUri(localClientRegistration.getAuthorizationUri())
.clientSecret(localClientRegistration.getClientSecret()) .clientSecret(localClientRegistration.getClientSecret())
.tokenUri(localClientRegistration.getAccessTokenUri()) .tokenUri(localClientRegistration.getAccessTokenUri())
.redirectUriTemplate(redirectUriTemplate) .redirectUriTemplate(redirectUriTemplate)
.scope(localClientRegistration.getScope()) .scope(localClientRegistration.getScope())
.clientName(localClientRegistration.getClientName())
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
.userInfoUri(localClientRegistration.getUserInfoUri()) .userInfoUri(localClientRegistration.getUserInfoUri())
.userNameAttributeName(localClientRegistration.getUserNameAttributeName()) .userNameAttributeName(localClientRegistration.getUserNameAttributeName())

View File

@ -521,9 +521,6 @@ public class OAuth2ServiceImpl implements OAuth2Service {
if (StringUtils.isEmpty(clientRegistration.getClientAuthenticationMethod())) { if (StringUtils.isEmpty(clientRegistration.getClientAuthenticationMethod())) {
throw new DataValidationException("Client authentication method should be specified!"); throw new DataValidationException("Client authentication method should be specified!");
} }
if (StringUtils.isEmpty(clientRegistration.getClientName())) {
throw new DataValidationException("Client name should be specified!");
}
if (StringUtils.isEmpty(clientRegistration.getLoginButtonLabel())) { if (StringUtils.isEmpty(clientRegistration.getLoginButtonLabel())) {
throw new DataValidationException("Login button label should be specified!"); throw new DataValidationException("Login button label should be specified!");
} }

View File

@ -493,7 +493,6 @@ public class BaseOAuth2ServiceTest extends AbstractServiceTest {
.userNameAttributeName("userNameAttributeName") .userNameAttributeName("userNameAttributeName")
.jwkSetUri("jwkSetUri") .jwkSetUri("jwkSetUri")
.clientAuthenticationMethod("clientAuthenticationMethod") .clientAuthenticationMethod("clientAuthenticationMethod")
.clientName("clientName")
.loginButtonLabel("loginButtonLabel") .loginButtonLabel("loginButtonLabel")
.build(); .build();
} }