How to get the role for the current user using Spring Security

I am trying to get all the roles for the current authenticated user and show them on the JSP page.

I noticed that there are some built-in expressions listed here: http://static.springsource.org/spring-security/site/docs/3.0.x/reference/el-access.html , but I do not see anything that would list all roles.

+5
source share
1 answer

You can use SecurityContextHolder.getContext().getAuthentication().getAuthorities()to obtain a collection of currently registered user roles.

+8
source

All Articles