Announcement Announcement Module
No announcement yet.
not able to retrieve principle from authentication object Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • not able to retrieve principle from authentication object

    Hi Guys,
    This is really urgent since I need to give application for testing

    I am not able to login 2nd time after i logout. I am using spring security 3
    I will describe the scenerio in details

    I have written MyAuthenticationProvider it implements AuthenticationProvider i override authenticate method in it
    I have my own MyAuthenticationToken it extends UsernamePasswordAuthenticationToken.
    I have written my own accessdecision manager and i override decide method in it.

    In MyAuthenticationProvider
    I authenticate user when user logs in. I Create MyAuthenticationToken using 3 - argument constructor principle,credential and authrities.
    I set this myAuthentication token in securityCotextHolder using SecurityContextHolder.getContext().setAuthenticati on

    Later flow goes to MyAccessDecisionProvider.
    decide method consists of Authentication userObj, Object url, Collection<ConfigAttribute> configAttribute parameters.

    Problem :
    When I login for 1st time i am able to login absollutely and i am able to get principle and related info from userObj
    then i logout then again relogin using same username aand password and for my surprise this time flow goes to MyAuthentication provider where i do all above mentioned actions which is same as I logged in for 1st time then flow comes to MyAccessDecisionManager in decide method and my userObj now shows principle as anonymous. While during 1st time i am able to get principle from userObj correctly

    Why is this silly behaviour. can any of you please guide me its urgent

    Thanks and Regards

  • #2
    issule solved !!!