diff options
Diffstat (limited to 'server/sonar-webserver-auth')
3 files changed, 8 insertions, 8 deletions
diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/InitFilter.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/InitFilter.java index faa28b4783d..fe35388cc5b 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/InitFilter.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/InitFilter.java @@ -73,11 +73,11 @@ public class InitFilter extends AuthenticationFilter { private void handleProvider(HttpServletRequest request, HttpServletResponse response, IdentityProvider provider) { try { - if (provider instanceof BaseIdentityProvider) { - handleBaseIdentityProvider(request, response, (BaseIdentityProvider) provider); - } else if (provider instanceof OAuth2IdentityProvider) { + if (provider instanceof BaseIdentityProvider baseIdentityProvider) { + handleBaseIdentityProvider(request, response, baseIdentityProvider); + } else if (provider instanceof OAuth2IdentityProvider oAuth2IdentityProvider) { oAuthOAuth2AuthenticationParameters.init(request, response); - handleOAuth2IdentityProvider(request, response, (OAuth2IdentityProvider) provider); + handleOAuth2IdentityProvider(request, response, oAuth2IdentityProvider); } else { handleError(request, response, format("Unsupported IdentityProvider class: %s", provider.getClass())); } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2CallbackFilter.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2CallbackFilter.java index 389436e5636..c3b5a664073 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2CallbackFilter.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/OAuth2CallbackFilter.java @@ -71,8 +71,8 @@ public class OAuth2CallbackFilter extends AuthenticationFilter { private void handleProvider(HttpServletRequest request, HttpServletResponse response, IdentityProvider provider) { try { - if (provider instanceof OAuth2IdentityProvider) { - handleOAuth2Provider(response, request, (OAuth2IdentityProvider) provider); + if (provider instanceof OAuth2IdentityProvider oAuth2IdentityProvider) { + handleOAuth2Provider(response, request, oAuth2IdentityProvider); } else { handleError(request, response, format("Not an OAuth2IdentityProvider: %s", provider.getClass())); } diff --git a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/UserSessionInitializer.java b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/UserSessionInitializer.java index 66376c77170..fa6be146e7e 100644 --- a/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/UserSessionInitializer.java +++ b/server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/UserSessionInitializer.java @@ -141,8 +141,8 @@ public class UserSessionInitializer { } private static void checkTokenUserSession(HttpServletResponse response, UserSession session) { - if (session instanceof TokenUserSession) { - UserTokenDto userTokenDto = ((TokenUserSession) session).getUserToken(); + if (session instanceof TokenUserSession tokenUserSession) { + UserTokenDto userTokenDto = tokenUserSession.getUserToken(); Optional.ofNullable(userTokenDto.getExpirationDate()).ifPresent(expirationDate -> response.addHeader(SQ_AUTHENTICATION_TOKEN_EXPIRATION, formatDateTime(expirationDate))); } } |