Accessing my custom user object in jsp page, using spring 3 security

前端 未结 3 1318
情话喂你
情话喂你 2021-01-19 01:40

I have implemented UserDetailsService, it returns an instance of MyUser (which implements UserDetails)

public MyUser l         


        
3条回答
  •  情书的邮戳
    2021-01-19 02:27

    If your MyUser object implements Principal and you place it in the http session on successful login, you could get it from the session and cast it.


    You could implement the AuthenticationSuccessHandler inject your UserDetailsService in there and place it in the session.

    Then you could inject your AuthenticationSuccessHandler into the UsernamePasswordauthenticationFilter which handles the element.

    If you give me details about your security context config I could give you more details.

提交回复
热议问题