Announcement Announcement Module
No announcement yet.
Custom SecureContext object to load other stuff on login Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom SecureContext object to load other stuff on login

    I have a UserContext object which contains other things like user email, local e besides the authentication object. Now I need to populate these things after the user logs in.
    Initially I put these things in the onSuccessfulAuthentication() of my authentication processing filter. But the problem here is that when authentication takes place through the Remember Me filter then this method is not called.
    Is there a standard way in which this can be done or do I need to call a common method from the autoLogin() in rememberMeServices and onSuccessfulAuthentication in authenticationProcessingFilter???

  • #2
    do it in a separate filter ?

    Hi grasshopper,

    On our project we separated the authentication from the "complete profile loading".

    We use the standard acegi filters for authentication and remember me and in the filter chain after acegi we have a specific filter that does the following :
    - checks if the user is authenticated
    - checks if the user profile is loaded and if not loads the profile.

    The big advantage is that you use the standard acegi filters and you can re-use your custom filter in a non acegi context (in case you use a REALM ie).

    So each filter has its own simple responsability. The less thing a class does the less bug you'll have. KISS (Keep It Simple and Stupid).

    Hope it helps.



    • #3
      this makes perfrect sense, I have been contemplating this and now that you mention you have already done this, i guess i ll follow suite. thanks a lot for sharing valuable experience.