Skip to content

Commit c54f44c

Browse files
committed
[backend] lint code with spotless (#5483)
1 parent ad3d8e1 commit c54f44c

5 files changed

Lines changed: 27 additions & 20 deletions

File tree

openaev-api/src/main/java/io/openaev/config/AppSecurityConfig.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,18 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
120120
.logout(
121121
logout ->
122122
logout
123-
// Audit Log: audit handler fires first, then Spring Security's built-in
124-
// SecurityContextLogoutHandler
125-
// invalidates the session and clears cookies
126-
.addLogoutHandler(
127-
(request, response, authentication) -> {
128-
try {
129-
accessControlAuditLogger.logAuthEvent("logout", "success", null, null, null);
130-
} catch (Exception e) {
131-
// Never block the logout flow
132-
}
133-
})
123+
// Audit Log: audit handler fires first, then Spring Security's built-in
124+
// SecurityContextLogoutHandler
125+
// invalidates the session and clears cookies
126+
.addLogoutHandler(
127+
(request, response, authentication) -> {
128+
try {
129+
accessControlAuditLogger.logAuthEvent(
130+
"logout", "success", null, null, null);
131+
} catch (Exception e) {
132+
// Never block the logout flow
133+
}
134+
})
134135
.invalidateHttpSession(true)
135136
.deleteCookies("JSESSIONID", openAEVConfig.getCookieName())
136137
.logoutSuccessUrl(
@@ -145,9 +146,11 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
145146
auth.authorizationRequestResolver(
146147
authorizationRequestResolver(
147148
http.getSharedObject(ClientRegistrationRepository.class))))
148-
.successHandler(new SsoRefererAuthenticationSuccessHandler(this.accessControlAuditLogger))
149+
.successHandler(
150+
new SsoRefererAuthenticationSuccessHandler(this.accessControlAuditLogger))
149151
.failureHandler(
150-
new SsoRefererAuthenticationFailureHandler(this.userEventService, this.accessControlAuditLogger)));
152+
new SsoRefererAuthenticationFailureHandler(
153+
this.userEventService, this.accessControlAuditLogger)));
151154
}
152155

153156
if (openAEVConfig.isAuthSaml2Enable()) {

openaev-api/src/main/java/io/openaev/config/security/OpenSamlConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ public void addOpenSamlConfig(@NotNull final HttpSecurity http) throws Exception
6868
saml2Login ->
6969
saml2Login
7070
.authenticationManager(new ProviderManager(authenticationProvider))
71-
.successHandler(new SsoRefererAuthenticationSuccessHandler(this.accessControlAuditLogger))
72-
);
71+
.successHandler(
72+
new SsoRefererAuthenticationSuccessHandler(this.accessControlAuditLogger)));
7373
}
7474

7575
// -- PRIVATE --

openaev-api/src/main/java/io/openaev/rest/user/UserApi.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ public User login(@Valid @RequestBody LoginUserInput input) {
7676
return user;
7777
}
7878
}
79-
userEventService.createLoginFailedEvent("local login", BadCredentialsException.class.getSimpleName());
80-
accessControlAuditLogger.logAuthEvent("login", "error", "local", BadCredentialsException.class.getSimpleName(), null);
79+
userEventService.createLoginFailedEvent(
80+
"local login", BadCredentialsException.class.getSimpleName());
81+
accessControlAuditLogger.logAuthEvent(
82+
"login", "error", "local", BadCredentialsException.class.getSimpleName(), null);
8183

8284
throw new BadCredentialsException("Invalid credential.");
8385
}

openaev-api/src/main/java/io/openaev/security/SsoRefererAuthenticationFailureHandler.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ public class SsoRefererAuthenticationFailureHandler extends SimpleUrlAuthenticat
2121
private final UserEventService userEventService;
2222
private final AccessControlAuditLogger accessControlAuditLogger;
2323

24-
public SsoRefererAuthenticationFailureHandler(UserEventService userEventService, AccessControlAuditLogger accessControlAuditLogger) {
24+
public SsoRefererAuthenticationFailureHandler(
25+
UserEventService userEventService, AccessControlAuditLogger accessControlAuditLogger) {
2526
this.userEventService = userEventService;
2627
this.accessControlAuditLogger = accessControlAuditLogger;
2728
}
@@ -33,7 +34,8 @@ public void onAuthenticationFailure(
3334
userEventService.createLoginFailedEvent(
3435
request.getRequestURI(), exception.getClass().getSimpleName());
3536

36-
accessControlAuditLogger.logAuthEvent("login", "error", request.getRequestURI(), exception.getClass().getSimpleName(), null);
37+
accessControlAuditLogger.logAuthEvent(
38+
"login", "error", request.getRequestURI(), exception.getClass().getSimpleName(), null);
3739

3840
this.saveException(request, exception);
3941
SavedRequest savedRequest = this.requestCache.getRequest(request, response);

openaev-api/src/main/java/io/openaev/security/SsoRefererAuthenticationSuccessHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void onAuthenticationSuccess(
3535
if (authentication instanceof OAuth2AuthenticationToken oauth2Token) {
3636
provider = oauth2Token.getAuthorizedClientRegistrationId();
3737
}
38-
38+
3939
accessControlAuditLogger.logAuthEvent("login", "success", provider, null, null);
4040
} catch (Exception e) {
4141
// Never block the login flow

0 commit comments

Comments
 (0)