public class SimplePermissionMapper extends Object implements PermissionMapper
PermissionMapper implementation that maps to pre-defined PermissionVerifier instances.
This PermissionMapper is constructed using a SimplePermissionMapper.Builder which is used to construct an ordered list of
PermissionVerifier instances along with a set of principal names and a list of principal names.
At the time mapPermissions(PermissionMappable, Roles) is called this list is iterated to find corresponding
definitions where either the name of the Principal within the PermissionMappable is contained
within the mapping or the Roles in the mapPermission call contain at least one of the roles in the mapping
then the associated PermissionVerifier will be used.
It is possible that multiple mappings could be matched during the call to mapPermissions(PermissionMappable, Roles)
and this is why the ordering is important, by default only the first match will be used however this can be overridden by
calling Builder#setMappingMode(MappingMode) to choose a different mode to combine the resulting
PermissionVerifier instances.| Modifier and Type | Class and Description |
|---|---|
static class |
SimplePermissionMapper.Builder |
static class |
SimplePermissionMapper.MappingMode |
EMPTY_PERMISSION_MAPPER| Modifier and Type | Method and Description |
|---|---|
static SimplePermissionMapper.Builder |
builder()
Construct a new
SimplePermissionMapper.Builder for creating the PermissionMapper. |
PermissionVerifier |
mapPermissions(PermissionMappable permissionMappable,
Roles roles)
Returns a
PermissionVerifier with all the permissions associated with the given information. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitand, createConstant, or, unless, xorpublic PermissionVerifier mapPermissions(PermissionMappable permissionMappable, Roles roles)
PermissionMapperReturns a PermissionVerifier with all the permissions associated with the given information.
Once returned, client code can use the PermissionVerifier.implies(Permission) to check if a given permission is granted or not
to the given principal. Implementors must make sure that the returned collection is immutable.
mapPermissions in interface PermissionMapperpermissionMappable - the object to which permissions can be mapped (must not be null)roles - a set of effective roles after all role mapping was applied by security domain (may be null)null)public static SimplePermissionMapper.Builder builder()
SimplePermissionMapper.Builder for creating the PermissionMapper.SimplePermissionMapper.Builder for creating the PermissionMapper.Copyright © 2017 JBoss by Red Hat. All rights reserved.