Package org.wildfly.security.authz
Class SimplePermissionMapper.Builder
- java.lang.Object
-
- org.wildfly.security.authz.SimplePermissionMapper.Builder
-
- Enclosing class:
- SimplePermissionMapper
public static class SimplePermissionMapper.Builder extends Object
A builder for simple permission mappers.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
built
private SimplePermissionMapper.MappingMode
mappingMode
private List<SimplePermissionMapper.Mapping>
mappings
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimplePermissionMapper.Builder
addMapping(Set<String> principals, Set<String> roles, PermissionVerifier permissionVerifier)
Add a new mapping to aPermissionVerifier
, if thePermissionMappable
being mapped has a principal name that is in theSet
of principals or of any of the assigned roles are matched this mapping will be a match.SimplePermissionMapper.Builder
addMatchAllPrincipals(PermissionVerifier permissionVerifier)
Add a new mapping to aPermissionVerifier
, if thePermissionMappable
being mapped has a principal or any of the assigned roles are matched this mapping will be a match.private void
assertNotBuilt()
PermissionMapper
build()
Build and return the resultingPermissionMapper
.SimplePermissionMapper.Builder
setMappingMode(SimplePermissionMapper.MappingMode mappingMode)
Set the mapping mode that the newly createdPermissionMapper
should use.
-
-
-
Field Detail
-
built
private boolean built
-
mappingMode
private SimplePermissionMapper.MappingMode mappingMode
-
mappings
private final List<SimplePermissionMapper.Mapping> mappings
-
-
Method Detail
-
setMappingMode
public SimplePermissionMapper.Builder setMappingMode(SimplePermissionMapper.MappingMode mappingMode)
Set the mapping mode that the newly createdPermissionMapper
should use.- Parameters:
mappingMode
- the mapping mode.- Returns:
this
builder to allow chaining.
-
addMapping
public SimplePermissionMapper.Builder addMapping(Set<String> principals, Set<String> roles, PermissionVerifier permissionVerifier)
Add a new mapping to aPermissionVerifier
, if thePermissionMappable
being mapped has a principal name that is in theSet
of principals or of any of the assigned roles are matched this mapping will be a match.- Parameters:
principals
- the principal names to compare with thePermissionMappable
principal.roles
- the role names to compare with the roles being passed for mapping.permissionVerifier
- thePermissionVerifier
to use in the event of a resulting match.- Returns:
this
builder to allow chaining.
-
addMatchAllPrincipals
public SimplePermissionMapper.Builder addMatchAllPrincipals(PermissionVerifier permissionVerifier)
Add a new mapping to aPermissionVerifier
, if thePermissionMappable
being mapped has a principal or any of the assigned roles are matched this mapping will be a match.- Parameters:
permissionVerifier
- thePermissionVerifier
to use in the event of a resulting match.- Returns:
this
builder to allow chaining.
-
build
public PermissionMapper build()
Build and return the resultingPermissionMapper
.- Returns:
- the resulting
PermissionMapper
-
assertNotBuilt
private void assertNotBuilt()
-
-