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 jwkSetUri;
private String clientAuthenticationMethod;
private String clientName;
private String loginButtonLabel;
private String loginButtonIcon;
}

View File

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

View File

@ -521,9 +521,6 @@ public class OAuth2ServiceImpl implements OAuth2Service {
if (StringUtils.isEmpty(clientRegistration.getClientAuthenticationMethod())) {
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())) {
throw new DataValidationException("Login button label should be specified!");
}

View File

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