🎨 Improving structure / format of the code. up format 0.0.39

This commit is contained in:
lbw 2023-08-17 22:16:13 +08:00
parent e0a9c78a1d
commit 2f673068ef
3 changed files with 26 additions and 27 deletions

View File

@ -21,7 +21,7 @@
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<git.commit.plugin>4.9.9</git.commit.plugin> <git.commit.plugin>4.9.9</git.commit.plugin>
<spring.checkstyle.plugin>0.0.38</spring.checkstyle.plugin> <spring.checkstyle.plugin>0.0.39</spring.checkstyle.plugin>
<fastjson.version>1.2.83</fastjson.version> <fastjson.version>1.2.83</fastjson.version>
<springdoc.version>1.6.9</springdoc.version> <springdoc.version>1.6.9</springdoc.version>
<swagger.core.version>2.2.0</swagger.core.version> <swagger.core.version>2.2.0</swagger.core.version>

View File

@ -86,16 +86,15 @@ public class PigRemoteRegisteredClientRepository implements RegisteredClientRepo
public RegisteredClient findByClientId(String clientId) { public RegisteredClient findByClientId(String clientId) {
SysOauthClientDetails clientDetails = RetOps SysOauthClientDetails clientDetails = RetOps
.of(clientDetailsService.getClientDetailsById(clientId, SecurityConstants.FROM_IN)) .of(clientDetailsService.getClientDetailsById(clientId, SecurityConstants.FROM_IN))
.getData() .getData()
.orElseThrow(() -> new OAuth2AuthorizationCodeRequestAuthenticationException( .orElseThrow(() -> new OAuth2AuthorizationCodeRequestAuthenticationException(
new OAuth2Error("客户端查询异常,请检查数据库链接"), null)); new OAuth2Error("客户端查询异常,请检查数据库链接"), null));
RegisteredClient.Builder builder = RegisteredClient.withId(clientDetails.getClientId()) RegisteredClient.Builder builder = RegisteredClient.withId(clientDetails.getClientId())
.clientId(clientDetails.getClientId()) .clientId(clientDetails.getClientId())
.clientSecret(SecurityConstants.NOOP + clientDetails.getClientSecret()) .clientSecret(SecurityConstants.NOOP + clientDetails.getClientSecret())
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC); .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC);
for (String authorizedGrantType : clientDetails.getAuthorizedGrantTypes()) { for (String authorizedGrantType : clientDetails.getAuthorizedGrantTypes()) {
builder.authorizationGrantType(new AuthorizationGrantType(authorizedGrantType)); builder.authorizationGrantType(new AuthorizationGrantType(authorizedGrantType));
@ -103,28 +102,28 @@ public class PigRemoteRegisteredClientRepository implements RegisteredClientRepo
// 回调地址 // 回调地址
Optional.ofNullable(clientDetails.getWebServerRedirectUri()) Optional.ofNullable(clientDetails.getWebServerRedirectUri())
.ifPresent(redirectUri -> Arrays.stream(redirectUri.split(StrUtil.COMMA)) .ifPresent(redirectUri -> Arrays.stream(redirectUri.split(StrUtil.COMMA))
.filter(StrUtil::isNotBlank) .filter(StrUtil::isNotBlank)
.forEach(builder::redirectUri)); .forEach(builder::redirectUri));
// scope // scope
Optional.ofNullable(clientDetails.getScope()) Optional.ofNullable(clientDetails.getScope())
.ifPresent(scope -> Arrays.stream(scope.split(StrUtil.COMMA)) .ifPresent(scope -> Arrays.stream(scope.split(StrUtil.COMMA))
.filter(StrUtil::isNotBlank) .filter(StrUtil::isNotBlank)
.forEach(builder::scope)); .forEach(builder::scope));
return builder return builder
.tokenSettings(TokenSettings.builder() .tokenSettings(TokenSettings.builder()
.accessTokenFormat(OAuth2TokenFormat.REFERENCE) .accessTokenFormat(OAuth2TokenFormat.REFERENCE)
.accessTokenTimeToLive(Duration.ofSeconds( .accessTokenTimeToLive(Duration.ofSeconds(
Optional.ofNullable(clientDetails.getAccessTokenValidity()).orElse(accessTokenValiditySeconds))) Optional.ofNullable(clientDetails.getAccessTokenValidity()).orElse(accessTokenValiditySeconds)))
.refreshTokenTimeToLive(Duration.ofSeconds(Optional.ofNullable(clientDetails.getRefreshTokenValidity()) .refreshTokenTimeToLive(Duration.ofSeconds(Optional.ofNullable(clientDetails.getRefreshTokenValidity())
.orElse(refreshTokenValiditySeconds))) .orElse(refreshTokenValiditySeconds)))
.build()) .build())
.clientSettings(ClientSettings.builder() .clientSettings(ClientSettings.builder()
.requireAuthorizationConsent(!BooleanUtil.toBoolean(clientDetails.getAutoapprove())) .requireAuthorizationConsent(!BooleanUtil.toBoolean(clientDetails.getAutoapprove()))
.build()) .build())
.build(); .build();
} }

View File

@ -51,7 +51,7 @@
<docker.username>username</docker.username> <docker.username>username</docker.username>
<docker.password>password</docker.password> <docker.password>password</docker.password>
<git.commit.plugin>4.9.9</git.commit.plugin> <git.commit.plugin>4.9.9</git.commit.plugin>
<spring.checkstyle.plugin>0.0.38</spring.checkstyle.plugin> <spring.checkstyle.plugin>0.0.39</spring.checkstyle.plugin>
</properties> </properties>
<!-- 以下依赖 全局所有的模块都会引入 --> <!-- 以下依赖 全局所有的模块都会引入 -->