Załóżmy, że chcę wykonać jakąś akcję po poprawnym zalogowaniu użytkownika. Jaka w tym wypadku będzie różnica między użyciem np:
klasy UsernamePasswordAuthenticationFilter
i nadpisaniem metody:
protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
FilterChain chain, Authentication authResult) throws IOException, ServletException
a implementacją interfejsu AuthenticationSuccessHandler
i meody:
void onAuthenticationSuccess(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
Authentication authentication)
throws java.io.IOException,
javax.servlet.ServletException
Z dokumentacji:
protected void successfulAuthentication
- Default behaviour for successful authentication.
void onAuthenticationSuccess
- Called when a user has been successfully authenticated.
Czym powinno się sugerować w danej sytuacji w wyborze jednego lub drugiego i od czego ten wybór powinien zależeć ? Któraś opcja jest "lepsza/gorsza" ?