In a scenario where a filter needs to restrict access based on user roles, which object or method is essential for implementing this?

  • checkUserRole()
  • getRoleNames()
  • getUserPrincipal()
  • getUserRoles()
The getUserPrincipal() method is essential for implementing access restrictions based on user roles in a filter. It returns a java.security.Principal object representing the user making the request. The filter can then extract information from this object, such as the user's roles, to make decisions about whether to allow or deny access.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *