HttpServletRequest isUserInRole() - How to get full role list?

Deena picture Deena · Jan 31, 2013 · Viewed 8.2k times · Source

HttpServletRequest isUserInRole() method will return a boolean value based on whether the role is present or not. Now if it is doing that it should have the full role list for the logged in user somewhere. How do I get that full role list?

Answer

user1596371 picture user1596371 · Jan 31, 2013

isUserInRole() uses the request's SecurityContext, which your authenticator needs to set. The SecurityContext interface does not supply a method to allow you to access this information, but you could do something in your authenticator to make the information accessible as a provider, or add it as a request attribute and access it that way.