The javax.servlet.http.HttpServletRequest
class has a method called isUserInRole
. I use this to check if a user has, for example, the admin
role. However, that method is case sensitive. So, if the role in the request was Admin
or ADMIN
, then isUserInRole("admin")
would be false. I use the isUserInRole
method in a number of places accross multiple applications to check for a number of different roles.
Is there a way to achieve the isUserInRole
functionality case-insensitively that does not require checking each different possible case combination with isUserInRole
?