Is there a Spring interceptor that is called before the UsernamePasswordAuthenticationFilter name?

I want to call a method before UsernamePasswordAuthenticationFilter . attemptAuthentication()called (and before any other requests are processed in the application).

I tried calling the method in the HandlerInterceptorAdapter . preHandle()but this does not work before attemptAuthentication(), although it will take care of other types of queries.

Is there a Spring interceptor that is called before UsernamePasswordAuthenticationFilter?

+5
source share
2 answers

I think you are talking about the spring security filter chain.

Filters with these names must be called before UsernamePasswordAuthenticationFilter

  • FIRST
  • CHANNEL_FILTER,
  • CONCURRENT_SESSION_FILTER,
  • SECURITY_CONTEXT_FILTER,
  • LOGOUT_FILTER,
  • X509_FILTER,
  • PRE_AUTH_FILTER,
  • CAS_FILTER,

. org.springframework.security.config.http.SecurityFilters.


before:

<security:custom-filter ref="myFiler" before="FORM_LOGIN_FILTER" />
+4

- Spring MVC, DispatcherServlet. .

- UsernamePasswordAuthenticationFilter, .

+3