UserDetails getPassword returns null in spring security 3.1. How to get password of currently logged in user?

前端 未结 3 980
旧时难觅i
旧时难觅i 2020-12-10 03:46

I have implemented change password functionality using spring security but ((UserDetails) principal).getPassword()) is returning null for logged in user.

If I remem

3条回答
  •  一向
    一向 (楼主)
    2020-12-10 04:21

    Yes, this has changed in version 3.1. Credentials are cleared after a successfull authentication by default. You can set eraseCredentialsAfterAuthentication to false on the ProviderManager to prevent this. See details here: http://static.springsource.org/spring-security/site/docs/3.2.x/reference/core-services.html#core-services-erasing-credentials

提交回复
热议问题