Here is the log from client application
2018-07-14 11:42:43 DEBUG AndRequestMatcher:66 - Trying to match using Ant [pattern='/**', GET]
2018-07-14 11:42:43 DEBUG AntPathRequestMatcher:147 - Request '/login' matched by universal pattern '/**'
2018-07-14 11:42:43 DEBUG AndRequestMatcher:66 - Trying to match using NegatedRequestMatcher [requestMatcher=Ant [pattern='/**/favicon.ico']]
2018-07-14 11:42:43 DEBUG AntPathRequestMatcher:157 - Checking match of request : '/login'; against '/**/favicon.ico'
2018-07-14 11:42:43 DEBUG NegatedRequestMatcher:51 - matches = true
2018-07-14 11:42:43 DEBUG AndRequestMatcher:66 - Trying to match using NegatedRequestMatcher [requestMatcher=MediaTypeRequestMatcher [contentNegotiationStrategy=org.springframework.web.accept.HeaderContentNegotiationStrategy@2440314a, matchingMediaTypes=[application/json], useEquals=false, ignoredMediaTypes=[*/*]]]
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:185 - httpRequestMediaTypes=[text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8]
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:189 - Processing text/html
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:205 - application/json .isCompatibleWith text/html = false
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:189 - Processing application/xhtml+xml
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:205 - application/json .isCompatibleWith application/xhtml+xml = false
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:189 - Processing application/xml;q=0.9
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:205 - application/json .isCompatibleWith application/xml;q=0.9 = false
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:189 - Processing */*;q=0.8
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:192 - Ignoring
2018-07-14 11:42:43 DEBUG MediaTypeRequestMatcher:213 - Did not match any media types
2018-07-14 11:42:43 DEBUG NegatedRequestMatcher:51 - matches = true
2018-07-14 11:42:43 DEBUG AndRequestMatcher:66 - Trying to match using NegatedRequestMatcher [requestMatcher=RequestHeaderRequestMatcher [expectedHeaderName=X-Requested-With, expectedHeaderValue=XMLHttpRequest]]
2018-07-14 11:42:43 DEBUG NegatedRequestMatcher:51 - matches = true
2018-07-14 11:42:43 DEBUG AndRequestMatcher:73 - All requestMatchers returned true
2018-07-14 11:42:43 DEBUG HttpSessionRequestCache:58 - DefaultSavedRequest added to Session: DefaultSavedRequest[
http://localhost:8080/sso/login]
2018-07-14 11:42:43 DEBUG ExceptionTranslationFilter:203 - Calling Authentication entry point.
2018-07-14 11:42:43 DEBUG HstsHeaderWriter:130 - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@2ed98901
2018-07-14 11:42:43 DEBUG HttpSessionSecurityContextRepository:352 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
2018-07-14 11:42:43 DEBUG SecurityContextPersistenceFilter:119 - SecurityContextHolder now cleared, as request processing completed
In LoggerFilter after doFilter
/sso/login/cas
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 1 of 14 in additional filter chain; firing Filter: 'WebAsyncManagerIntegrationFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 2 of 14 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2018-07-14 11:44:40 DEBUG HttpSessionSecurityContextRepository:174 - No HttpSession currently exists
2018-07-14 11:44:40 DEBUG HttpSessionSecurityContextRepository:116 - No SecurityContext was available from the HttpSession: null. A new one will be created.
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 3 of 14 in additional filter chain; firing Filter: 'HeaderWriterFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 4 of 14 in additional filter chain; firing Filter: 'CsrfFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 5 of 14 in additional filter chain; firing Filter: 'LogoutFilter'
2018-07-14 11:44:40 DEBUG AntPathRequestMatcher:157 - Checking match of request : '/login/cas'; against '/logout/cas'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 6 of 14 in additional filter chain; firing Filter: 'LogoutFilter'
2018-07-14 11:44:40 DEBUG AntPathRequestMatcher:137 - Request 'GET /login/cas' doesn't match 'POST /logout
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 7 of 14 in additional filter chain; firing Filter: 'SingleSignOutFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 8 of 14 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 9 of 14 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 10 of 14 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 11 of 14 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
2018-07-14 11:44:40 DEBUG AnonymousAuthenticationFilter:100 - Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@6faa1b5a: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@ffff6a82: RemoteIpAddress: 192.168.2.24; SessionId: 0B03A9D8B9746A65E6A2842400557CBC; Granted Authorities: ROLE_ANONYMOUS'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 12 of 14 in additional filter chain; firing Filter: 'SessionManagementFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 13 of 14 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
2018-07-14 11:44:40 DEBUG FilterChainProxy:325 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 at position 14 of 14 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
2018-07-14 11:44:40 DEBUG RegexRequestMatcher:109 - Checking match of request : '/login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2'; against '/secured.*'
2018-07-14 11:44:40 DEBUG RegexRequestMatcher:109 - Checking match of request : '/login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2'; against '/login'
2018-07-14 11:44:40 DEBUG RegexRequestMatcher:109 - Checking match of request : '/login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2'; against '/'
2018-07-14 11:44:40 DEBUG FilterSecurityInterceptor:210 - Public object - authentication not attempted
2018-07-14 11:44:40 DEBUG FilterChainProxy:310 - /login/cas?ticket=ST-1-uf0QEa3GAoYnaCWur5IgKxO6CQErajeswari-H110M-S2 reached end of additional filter chain; proceeding with original chain
2018-07-14 11:44:40 DEBUG HstsHeaderWriter:130 - Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@2ed98901
2018-07-14 11:44:40 DEBUG HttpSessionSecurityContextRepository:352 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
2018-07-14 11:44:40 DEBUG ExceptionTranslationFilter:117 - Chain processed normally
2018-07-14 11:44:40 DEBUG SecurityContextPersistenceFilter:119 - SecurityContextHolder now cleared, as request processing completed
============================================================================
this is the WebSecurityConfig
@EnableWebMvcSecurity
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private AuthenticationProvider authenticationProvider;
private AuthenticationEntryPoint authenticationEntryPoint;
private SingleSignOutFilter singleSignOutFilter;
private LogoutFilter logoutFilter;
// public SecurityConfig() {
// // TODO Auto-generated constructor stub
// }
@Autowired
public SecurityConfig(CasAuthenticationProvider casAuthenticationProvider, AuthenticationEntryPoint eP,
LogoutFilter lF
, SingleSignOutFilter ssF
) {
this.authenticationProvider = casAuthenticationProvider;
this.authenticationEntryPoint = eP;
this.logoutFilter = lF;
this.singleSignOutFilter = ssF;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.regexMatchers("/secured.*", "/login")
.authenticated()
.and()
.authorizeRequests()
.regexMatchers("/")
.permitAll()
.and()
.httpBasic()
.authenticationEntryPoint(authenticationEntryPoint)
.and()
.logout().logoutSuccessUrl("/logout")
.and()
.addFilterBefore(singleSignOutFilter, CasAuthenticationFilter.class)
.addFilterBefore(logoutFilter, LogoutFilter.class);
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authenticationProvider);
}
@Override
protected AuthenticationManager authenticationManager() throws Exception {
return new ProviderManager(Arrays.asList(authenticationProvider));
}
@Bean
public CasAuthenticationFilter casAuthenticationFilter(ServiceProperties sP) throws Exception {
CasAuthenticationFilter filter = new CasAuthenticationFilter();
filter.setServiceProperties(sP);
filter.setAuthenticationManager(authenticationManager());
return filter;