Announcement Announcement Module
Collapse
No announcement yet.
Is it possible to pass params from custom login page to initial Controller? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to pass params from custom login page to initial Controller?

    Hi,

    I am using Spring 3.1, and was wondering if its pssible to gather extra information in a custom login page,
    and then have that information available later on in the Controller that gets called after the login is
    processed by j_security_check ?


    What I want to avoid is having a default target, whoes purpose is simply to gather more info, if that can already be
    done on the login form.


    Another use for this may be to pass this information on to the custom Authentication / Authorization classes that I have added for ldap user mappings etc.


    Eg:- I want to collect all this on my login form

    User ID :
    Password :
    Domain :

    Then I want spring security to "do its stuff"

    When I reach my Controller (default taget), I want to reference "Domain"

    Is this possible ?

    Thanks

  • #2
    Yes it is possible. You can replace an existing (look at what a filter like UsernamePasswordAuthenticationFilter does) or a custom filter to filter chain.

    Reference http://static.springsource.org/sprin...custom-filters

    Comment


    • #3
      Thanks.

      I have not looked at filters yet, but have currently implemented a custom provider for username and password authentication.

      It accepts a tagged input in the username "username/extrainfo" from the login form, and then keeps this in a Custom UserDetails
      object that I return as part of my Authentication.getPrinciple()

      Not sure if I could do this simply with a filter, and not have to also customize the rest of the processing chain, but will
      look at filters now to see if there is a way.


      Thanks!

      Comment


      • #4
        You can also use UserDetails for extra field. Extend UserDetails, add your own there

        Comment

        Working...
        X