Spring security authentication: get username without SPRING_SECURITY_LAST_USERNAME

后端 未结 2 1365
陌清茗
陌清茗 2021-02-08 04:37

I\'m new at spring framework. I\'m creating a login page for my webapp and I want the user to login before any action on the app. If the user enters good credentials everything

2条回答
  •  暖寄归人
    2021-02-08 05:00

    If anyone comes here who is having this problem in Grails Spring security. You can now use the following-

    import grails.plugin.springsecurity.SpringSecurityUtils;
    

    Now use SpringSecurityUtils.SPRING_SECURITY_LAST_USERNAME_KEY this will work and is not deprecated.

提交回复
热议问题