Form Authentication - Listener
-
03-07-2021 - |
Question
I use FORM-based authentication method in Java JSP/Servlet app. I want to "do something" after a successful login. Is there any listener which help me to do it? I don't want to put any code at the beginning of each page.
Solution
Generally, authentication being a cross-cutting concern, you would have extracted it to an authentication ServletFilter
that is applied to all the servlets that need the user to be authenticated. If you have such a filter, this logic would go into that filter after successful authentication.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow