Results 1 to 4 of 4

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

  1. #1
    Join Date
    Dec 2011
    Posts
    24

    Default 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. #2
    Join Date
    Dec 2010
    Location
    Singapore
    Posts
    285

    Default

    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
    Amila Domingo

  3. #3
    Join Date
    Dec 2011
    Posts
    24

    Default

    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!

  4. #4
    Join Date
    Dec 2008
    Location
    India
    Posts
    295

    Default

    You can also use UserDetails for extra field. Extend UserDetails, add your own there
    Enjoy
    Rohan Chauhan
    ------------------------------------------------------------------------------
    SpringSource Certified Spring 3.0 Professional


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •