How to get current user role with spring security plugin?

前端 未结 6 1927
一个人的身影
一个人的身影 2020-12-29 05:21

I am using the spring-security-core plugin in my grails app. I need to know the current user\'s role in a controller action. How can I retrieve that?

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 06:17

    You can also use getAuthenticatedUser() by itself. This method is automatically injected in every controller, and thus only available from controllers. You will have to use one of the other methods if you want to access the current logged in user from anywhere else.

提交回复
热议问题