Package org.wildfly.security.authz
Interface PermissionMapper
-
- All Known Implementing Classes:
SimplePermissionMapper
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface PermissionMapper
A permission mapper is responsible to enable permission mapping to aSecurityDomain
in order to obtain and check permissions based on an previously authorized identity and any other authorization information (eg.: roles) associated with it.- Author:
- Pedro Igor
-
-
Field Summary
Fields Modifier and Type Field Description static PermissionMapper
EMPTY_PERMISSION_MAPPER
A default implementation that does nothing but returns an empty and read-onlyPermissionVerifier
.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default PermissionMapper
and(PermissionMapper other)
Returns a new mapper where thePermissionVerifier
created by thisPermissionMapper
is combined with thePermissionVerifier
of theother
PermissionMapper
using 'and'.static PermissionMapper
createConstant(PermissionVerifier verifier)
Returns a new mapper that maps all to pre-definedPermissionVerifier
instance.PermissionVerifier
mapPermissions(PermissionMappable permissionMappable, Roles roles)
Returns aPermissionVerifier
with all the permissions associated with the given information.default PermissionMapper
or(PermissionMapper other)
Returns a new mapper where thePermissionVerifier
created by thisPermissionMapper
is combined with thePermissionVerifier
of theother
PermissionMapper
using 'or'.default PermissionMapper
unless(PermissionMapper other)
Returns a new mapper where thePermissionVerifier
created by thisPermissionMapper
is combined with thePermissionVerifier
of theother
PermissionMapper
using 'unless'.default PermissionMapper
xor(PermissionMapper other)
Returns a new mapper where thePermissionVerifier
created by thisPermissionMapper
is combined with thePermissionVerifier
of theother
PermissionMapper
using 'xor'.
-
-
-
Field Detail
-
EMPTY_PERMISSION_MAPPER
static final PermissionMapper EMPTY_PERMISSION_MAPPER
A default implementation that does nothing but returns an empty and read-onlyPermissionVerifier
.
-
-
Method Detail
-
mapPermissions
PermissionVerifier mapPermissions(PermissionMappable permissionMappable, Roles roles)
Returns 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.- Parameters:
permissionMappable
- the object to which permissions can be mapped (must not benull
)roles
- a set of effective roles after all role mapping was applied by security domain (may benull
)- Returns:
- a permission verifier (not
null
)
-
and
default PermissionMapper and(PermissionMapper other)
Returns a new mapper where thePermissionVerifier
created by thisPermissionMapper
is combined with thePermissionVerifier
of theother
PermissionMapper
using 'and'.- Parameters:
other
- the otherPermissionMapper
to combine with thisPermissionMapper
- Returns:
- the combined
PermissionMapper
-
or
default PermissionMapper or(PermissionMapper other)
Returns a new mapper where thePermissionVerifier
created by thisPermissionMapper
is combined with thePermissionVerifier
of theother
PermissionMapper
using 'or'.- Parameters:
other
- the otherPermissionMapper
to combine with thisPermissionMapper
- Returns:
- the combined
PermissionMapper
-
xor
default PermissionMapper xor(PermissionMapper other)
Returns a new mapper where thePermissionVerifier
created by thisPermissionMapper
is combined with thePermissionVerifier
of theother
PermissionMapper
using 'xor'.- Parameters:
other
- the otherPermissionMapper
to combine with thisPermissionMapper
- Returns:
- the combined
PermissionMapper
-
unless
default PermissionMapper unless(PermissionMapper other)
Returns a new mapper where thePermissionVerifier
created by thisPermissionMapper
is combined with thePermissionVerifier
of theother
PermissionMapper
using 'unless'.- Parameters:
other
- the otherPermissionMapper
to combine with thisPermissionMapper
- Returns:
- the combined
PermissionMapper
-
createConstant
static PermissionMapper createConstant(PermissionVerifier verifier)
Returns a new mapper that maps all to pre-definedPermissionVerifier
instance.- Parameters:
verifier
- thePermissionVerifier
that will be returned for anybody.- Returns:
- the constant
PermissionVerifier
-
-