5

I'm trying to fetch all the roles for the current user who has been authenticated and show them in a JSP page.

I notice 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 don't see any that would list all the roles.

Omnipresent
  • 29,434
  • 47
  • 142
  • 186

1 Answers1

8

You can use SecurityContextHolder.getContext().getAuthentication().getAuthorities() to obtain a collection of the currently logged in user's roles.

zagyi
  • 17,223
  • 4
  • 51
  • 48