diff --git a/src/main/java/org/edgegallery/website/config/ClientWebSecurityConfigurer.java b/src/main/java/org/edgegallery/website/config/ClientWebSecurityConfigurer.java index 115f3f96eae4f8c1951e8162f33f163bfdd23dbb..e7545d252b7f636a8dfe82f71b9f750d950df1db 100644 --- a/src/main/java/org/edgegallery/website/config/ClientWebSecurityConfigurer.java +++ b/src/main/java/org/edgegallery/website/config/ClientWebSecurityConfigurer.java @@ -96,7 +96,7 @@ public class ClientWebSecurityConfigurer extends WebSecurityConfigurerAdapter { .antMatchers(HttpMethod.GET, "/mecm-inventory/inventory/v1/mechosts").permitAll() .antMatchers(HttpMethod.GET, "/health").permitAll().antMatchers("/webssh").permitAll() .antMatchers("/wsserver/**").permitAll().anyRequest().authenticated().and() - .addFilterBefore(oauth2ClientAuthenticationProcessingFilter(), ExceptionTranslationFilter.class).logout() + .addFilterAfter(new AuthentionSuccessFilter(), ExceptionTranslationFilter.class).logout() .addLogoutHandler(new LogoutHandler() { @Override public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, @@ -114,7 +114,6 @@ public class ClientWebSecurityConfigurer extends WebSecurityConfigurerAdapter { /** * oauth2ClientAuthenticationProcessingFilter. */ - @Bean public OAuth2ClientAuthenticationProcessingFilter oauth2ClientAuthenticationProcessingFilter() { LOGGER.info("oauth2ClientAuthenticationProcessingFilter in."); OAuth2ClientAuthenticationProcessingFilter filter = new OAuth2ClientAuthenticationProcessingFilter("/login"); diff --git a/src/main/java/org/edgegallery/website/controller/JwtServer.java b/src/main/java/org/edgegallery/website/controller/JwtServer.java index 72351eaff5d0b6069ac2cd83d1778240216227ea..8320fd683a78c5173d06334397159416ed156e14 100644 --- a/src/main/java/org/edgegallery/website/controller/JwtServer.java +++ b/src/main/java/org/edgegallery/website/controller/JwtServer.java @@ -16,6 +16,8 @@ package org.edgegallery.website.controller; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; @@ -26,16 +28,18 @@ import org.springframework.stereotype.Component; @Component public class JwtServer { + private static final Logger LOGGER = LoggerFactory.getLogger(JwtServer.class); @Autowired TokenStore jwtTokenStore; public OAuth2AccessToken getToken(String token) { - return jwtTokenStore.readAccessToken(token); + return jwtTokenStore.readAccessToken(token); } public OAuth2AuthenticationDetails getAuthDetails() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + LOGGER.info("authentication is {} type", authentication.getClass().getName()); return (OAuth2AuthenticationDetails) authentication.getDetails(); } }