Interface RoleBasedAccessController
- All Superinterfaces:
AccessController
An access controller that uses roles to control the access to services or resources based on the permissions that were granted to an authenticated entity.
This basically follows the Role-based access control approach which control the access to services or resources based on roles assigned to the authenticated entity.
Access to a service or a resouce is granted when the authenticated entity has a particular role. This can be checked as follows:
RoleBasedAccessController accessController = ...
accessController.hasRole("admin").doOnNext(granted -> {...})...
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Method Summary
Modifier and TypeMethodDescriptionhasAllRoles
(String... roles) Determines whether the authenticated entity has all of the specified roles.hasAllRoles
(Collection<String> roles) Determines whether the authenticated entity has all of the specified roles.hasAnyRole
(String... roles) Determines whether the authenticated entity has any of the specified roles.hasAnyRole
(Collection<String> roles) Determines whether the authenticated entity has any of the specified roles.Determines whether the authenticated entity has the specified role.static RoleBasedAccessController
Creates a new role based access controller with the specified roles.static RoleBasedAccessController
of
(Collection<String> roles) Creates a new role based access controller with the specified roles.
-
Method Details
-
hasRole
Determines whether the authenticated entity has the specified role.
- Parameters:
role
- the role to evaluate- Returns:
- a mono emitting true if access is granted, false otherwise
-
hasAnyRole
Determines whether the authenticated entity has any of the specified roles.
- Parameters:
roles
- the array of role to evaluate- Returns:
- a mono emitting true if access is granted, false otherwise
-
hasAnyRole
Determines whether the authenticated entity has any of the specified roles.
- Parameters:
roles
- the collection of role to evaluate- Returns:
- a mono emitting true if access is granted, false otherwise
-
hasAllRoles
Determines whether the authenticated entity has all of the specified roles.
- Parameters:
roles
- the array of role to evaluate- Returns:
- a mono emitting true if access is granted, false otherwise
-
hasAllRoles
Determines whether the authenticated entity has all of the specified roles.
- Parameters:
roles
- the collection of role to evaluate- Returns:
- a mono emitting true if access is granted, false otherwise
-
of
Creates a new role based access controller with the specified roles.
- Parameters:
roles
- the array of roles associated with an authenticated entity- Returns:
- a new role based access controller
-
of
Creates a new role based access controller with the specified roles.
- Parameters:
roles
- the collection of roles associated with an authenticated entity- Returns:
- a new role based access controller
-