Skip to content

Commit 365ae4e

Browse files
committed
Fix checkstyle violations for main module in 1.2.x
Issue gh-1624
1 parent 43fbafe commit 365ae4e

File tree

6 files changed

+54
-50
lines changed

6 files changed

+54
-50
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,6 @@
7171
@ImportRuntimeHints(JdbcOAuth2AuthorizationConsentService.JdbcOAuth2AuthorizationConsentServiceRuntimeHintsRegistrar.class)
7272
public class JdbcOAuth2AuthorizationConsentService implements OAuth2AuthorizationConsentService {
7373

74-
static class JdbcOAuth2AuthorizationConsentServiceRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
75-
76-
@Override
77-
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
78-
hints.resources()
79-
.registerResource(new ClassPathResource(
80-
"org/springframework/security/oauth2/server/authorization/oauth2-authorization-consent-schema.sql"));
81-
}
82-
83-
}
84-
8574
// @formatter:off
8675
private static final String COLUMN_NAMES = "registered_client_id, "
8776
+ "principal_name, "
@@ -288,4 +277,15 @@ public List<SqlParameterValue> apply(OAuth2AuthorizationConsent authorizationCon
288277

289278
}
290279

280+
static class JdbcOAuth2AuthorizationConsentServiceRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
281+
282+
@Override
283+
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
284+
hints.resources()
285+
.registerResource(new ClassPathResource(
286+
"org/springframework/security/oauth2/server/authorization/oauth2-authorization-consent-schema.sql"));
287+
}
288+
289+
}
290+
291291
}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,6 @@
9797
@ImportRuntimeHints(JdbcOAuth2AuthorizationService.JdbcOAuth2AuthorizationServiceRuntimeHintsRegistrar.class)
9898
public class JdbcOAuth2AuthorizationService implements OAuth2AuthorizationService {
9999

100-
static class JdbcOAuth2AuthorizationServiceRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
101-
102-
@Override
103-
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
104-
hints.resources()
105-
.registerResource(new ClassPathResource(
106-
"org/springframework/security/oauth2/server/authorization/oauth2-authorization-schema.sql"));
107-
}
108-
109-
}
110-
111100
// @formatter:off
112101
private static final String COLUMN_NAMES = "id, "
113102
+ "registered_client_id, "
@@ -822,4 +811,15 @@ private int getDataType() {
822811

823812
}
824813

814+
static class JdbcOAuth2AuthorizationServiceRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
815+
816+
@Override
817+
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
818+
hints.resources()
819+
.registerResource(new ClassPathResource(
820+
"org/springframework/security/oauth2/server/authorization/oauth2-authorization-schema.sql"));
821+
}
822+
823+
}
824+
825825
}

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/aot/hint/OAuth2AuthorizationServerBeanRegistrationAotProcessor.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ public BeanRegistrationAotContribution processAheadOfTime(RegisteredBean registe
6969
// @formatter:off
7070
if ((beanClassName.equals("org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationService") ||
7171
beanClassName.equals("org.springframework.security.oauth2.server.authorization.client.JdbcRegisteredClientRepository")) &&
72-
!jackson2Contributed) {
72+
!this.jackson2Contributed) {
7373
Jackson2ConfigurationBeanRegistrationAotContribution jackson2Contribution =
7474
new Jackson2ConfigurationBeanRegistrationAotContribution();
75-
jackson2Contributed = true;
75+
this.jackson2Contributed = true;
7676
return jackson2Contribution;
7777
}
7878
// @formatter:on
@@ -113,7 +113,7 @@ private void registerHints(RuntimeHints hints) {
113113
TypeReference.of(AuthorizationGrantType.class),
114114
TypeReference.of(OAuth2AuthorizationResponseType.class),
115115
TypeReference.of(OAuth2TokenFormat.class)),
116-
builder -> builder.withMembers(MemberCategory.DECLARED_FIELDS,
116+
(builder) -> builder.withMembers(MemberCategory.DECLARED_FIELDS,
117117
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS));
118118

119119
// Jackson Modules - Spring Security and Spring Authorization Server
@@ -122,7 +122,7 @@ private void registerHints(RuntimeHints hints) {
122122
Arrays.asList(TypeReference.of(CoreJackson2Module.class),
123123
TypeReference.of(WebServletJackson2Module.class),
124124
TypeReference.of(OAuth2AuthorizationServerJackson2Module.class)),
125-
builder -> builder.withMembers(MemberCategory.DECLARED_FIELDS,
125+
(builder) -> builder.withMembers(MemberCategory.DECLARED_FIELDS,
126126
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS, MemberCategory.INVOKE_DECLARED_METHODS));
127127

128128
// Jackson Mixins - Spring Security and Spring Authorization Server
@@ -162,7 +162,7 @@ private void registerHints(RuntimeHints hints) {
162162
.of("org.springframework.security.oauth2.client.jackson2.OAuth2ClientJackson2Module"),
163163
TypeReference
164164
.of("org.springframework.security.oauth2.client.authentication.OAuth2AuthenticationToken")),
165-
builder -> builder.withMembers(MemberCategory.DECLARED_FIELDS,
165+
(builder) -> builder.withMembers(MemberCategory.DECLARED_FIELDS,
166166
MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
167167
MemberCategory.INVOKE_DECLARED_METHODS));
168168

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,6 @@
8282
@ImportRuntimeHints(JdbcRegisteredClientRepository.JdbcRegisteredClientRepositoryRuntimeHintsRegistrar.class)
8383
public class JdbcRegisteredClientRepository implements RegisteredClientRepository {
8484

85-
static class JdbcRegisteredClientRepositoryRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
86-
87-
@Override
88-
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
89-
hints.resources()
90-
.registerResource(new ClassPathResource(
91-
"org/springframework/security/oauth2/server/authorization/client/oauth2-registered-client-schema.sql"));
92-
}
93-
94-
}
95-
9685
// @formatter:off
9786
private static final String COLUMN_NAMES = "id, "
9887
+ "client_id, "
@@ -431,4 +420,15 @@ private String writeMap(Map<String, Object> data) {
431420

432421
}
433422

423+
static class JdbcRegisteredClientRepositoryRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
424+
425+
@Override
426+
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
427+
hints.resources()
428+
.registerResource(new ClassPathResource(
429+
"org/springframework/security/oauth2/server/authorization/client/oauth2-registered-client-schema.sql"));
430+
}
431+
432+
}
433+
434434
}

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/oidc/converter/OidcClientRegistrationRegisteredClientConverter.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,35 @@ public RegisteredClient convert(OidcClientRegistration clientRegistration) {
6262
builder
6363
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_POST)
6464
.clientSecret(CLIENT_SECRET_GENERATOR.generateKey());
65-
} else if (ClientAuthenticationMethod.CLIENT_SECRET_JWT.getValue().equals(clientRegistration.getTokenEndpointAuthenticationMethod())) {
65+
}
66+
else if (ClientAuthenticationMethod.CLIENT_SECRET_JWT.getValue().equals(clientRegistration.getTokenEndpointAuthenticationMethod())) {
6667
builder
6768
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_JWT)
6869
.clientSecret(CLIENT_SECRET_GENERATOR.generateKey());
69-
} else if (ClientAuthenticationMethod.PRIVATE_KEY_JWT.getValue().equals(clientRegistration.getTokenEndpointAuthenticationMethod())) {
70+
}
71+
else if (ClientAuthenticationMethod.PRIVATE_KEY_JWT.getValue().equals(clientRegistration.getTokenEndpointAuthenticationMethod())) {
7072
builder.clientAuthenticationMethod(ClientAuthenticationMethod.PRIVATE_KEY_JWT);
71-
} else {
73+
}
74+
else {
7275
builder
7376
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)
7477
.clientSecret(CLIENT_SECRET_GENERATOR.generateKey());
7578
}
7679

77-
builder.redirectUris(redirectUris ->
80+
builder.redirectUris((redirectUris) ->
7881
redirectUris.addAll(clientRegistration.getRedirectUris()));
7982

8083
if (!CollectionUtils.isEmpty(clientRegistration.getPostLogoutRedirectUris())) {
81-
builder.postLogoutRedirectUris(postLogoutRedirectUris ->
84+
builder.postLogoutRedirectUris((postLogoutRedirectUris) ->
8285
postLogoutRedirectUris.addAll(clientRegistration.getPostLogoutRedirectUris()));
8386
}
8487

8588
if (!CollectionUtils.isEmpty(clientRegistration.getGrantTypes())) {
86-
builder.authorizationGrantTypes(authorizationGrantTypes ->
87-
clientRegistration.getGrantTypes().forEach(grantType ->
89+
builder.authorizationGrantTypes((authorizationGrantTypes) ->
90+
clientRegistration.getGrantTypes().forEach((grantType) ->
8891
authorizationGrantTypes.add(new AuthorizationGrantType(grantType))));
89-
} else {
92+
}
93+
else {
9094
builder.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE);
9195
}
9296
if (CollectionUtils.isEmpty(clientRegistration.getResponseTypes()) ||
@@ -95,7 +99,7 @@ public RegisteredClient convert(OidcClientRegistration clientRegistration) {
9599
}
96100

97101
if (!CollectionUtils.isEmpty(clientRegistration.getScopes())) {
98-
builder.scopes(scopes ->
102+
builder.scopes((scopes) ->
99103
scopes.addAll(clientRegistration.getScopes()));
100104
}
101105

@@ -109,7 +113,8 @@ public RegisteredClient convert(OidcClientRegistration clientRegistration) {
109113
macAlgorithm = MacAlgorithm.HS256;
110114
}
111115
clientSettingsBuilder.tokenEndpointAuthenticationSigningAlgorithm(macAlgorithm);
112-
} else if (ClientAuthenticationMethod.PRIVATE_KEY_JWT.getValue().equals(clientRegistration.getTokenEndpointAuthenticationMethod())) {
116+
}
117+
else if (ClientAuthenticationMethod.PRIVATE_KEY_JWT.getValue().equals(clientRegistration.getTokenEndpointAuthenticationMethod())) {
113118
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.from(clientRegistration.getTokenEndpointAuthenticationSigningAlgorithm());
114119
if (signatureAlgorithm == null) {
115120
signatureAlgorithm = SignatureAlgorithm.RS256;

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/authentication/OAuth2ErrorAuthenticationFailureHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import jakarta.servlet.ServletException;
2121
import jakarta.servlet.http.HttpServletRequest;
2222
import jakarta.servlet.http.HttpServletResponse;
23-
2423
import org.apache.commons.logging.Log;
2524
import org.apache.commons.logging.LogFactory;
2625

@@ -40,9 +39,9 @@
4039
* Error Response}.
4140
*
4241
* @author Dmitriy Dubson
42+
* @since 1.2
4343
* @see AuthenticationFailureHandler
4444
* @see OAuth2ErrorHttpMessageConverter
45-
* @since 1.2
4645
*/
4746
public final class OAuth2ErrorAuthenticationFailureHandler implements AuthenticationFailureHandler {
4847

0 commit comments

Comments
 (0)