I am working on Spring Framework and I wanted to write an interceptor and I wrote it eventually and it is working fine. but at a point, I dont want my interceptor to intercept the request that is when user wants to logout and the session is being invalidated. But it is not happening as per my expectation.
I am adding interceptors by extending the WebMvcConfigurerAdapter and by utilizing the addInterceptors method and here is the code.
public void addInterceptors(InterceptorRegistry registry) {
super.addInterceptors(registry);
registry.addInterceptor( loggerInterceptor );
registry.addInterceptor( authenticationInterceptor ).excludePathPatterns("/invalidate");
}
Have I done anything wrong here.? excludePathPatterns - > My URL ends with /invalidate. So please guide me, how to device a proper pattern.