
Originally Posted by
mauromol
Hello,
I'm adding Spring Security to an application which is currently using its own security management implementation. This application is saving some information in the session upon a successful login. This information is needed by the other application pages and hence I need to do the same with Spring Security.
The SessionManagementFilter seems to be the perfect solution for me: I can add a sessionManagementFilter to my filter chain and add my session initialization custom code in the onAuthentication method.
The problem is that the SessionManagementFilter is invoked only when a non-interactive login has been performed. This means that if I login interactively (for instance through a username+password login form), the SessionManagementFilter.onAuthentication is not invoked and hence my session initialization code is not executed.
What I need to do is to call my code also in an AuthenticationSucessHandler.
However, this need to call the same code in two different places makes me think that there might be a better way to solve my problem, however I can't understand what it might be.
On the other hand, I still think the SessionManagementFilter nature should be perfect to perform such tasks, but my feeling is that the actual use-cases that led the Spring Security team to create and implement that filter in this way was just the ones for which implementations have been provided (i.e.: protection against session-fixation attacks and concurrent session control) and for these use cases the current SessionManagementFilter invocation scheme is just appropriate.
Any suggestions from the Spring Security experts would be really appreciated.
Thanks in advance,
Mauro.