Provides methods to check on a user’s roles.
Description
The RoleAuthorizer class provides methods to check on a user’s roles.
Instance methods
userInRoles
Checks on the roles a user has been assigned.
public
AuthorizeFunction<ContainerRequestContext, Inflector<ContainerRequestContext, Response>, Response> userInRoles(Listroles)
- roles: List
- roles list. - returns: AuthorizeFunction<ContainerRequestContext, Inflector<ContainerRequestContext, Response>, Response> - returns roles handler.
userInRole
Check if the role is assigned to the user.
public
AuthorizeFunction<ContainerRequestContext, Inflector<ContainerRequestContext, Response>, Response> userInRole(String role)
- role: String - the user role.
- returns: AuthorizeFunction<ContainerRequestContext, Inflector<ContainerRequestContext, Response>, Response> - returns role handler.
admin
Check if the user has admin role.
Throws UnauthorizedException exception if not authorized or not owner.
public
AuthorizeFunction<ContainerRequestContext, Inflector<ContainerRequestContext, Response>, Response> admin()
- returns: AuthorizeFunction<ContainerRequestContext, Inflector<ContainerRequestContext, Response>, Response> - returns admin handler.