Package org.wildfly.security.authz
Class MappedRoleMapper
- java.lang.Object
-
- org.wildfly.security.authz.MappedRoleMapper
-
- All Implemented Interfaces:
RoleMapper
public class MappedRoleMapper extends Object implements RoleMapper
A simple mapping role mapper. Maps each role to a set of new roles using a String to Setmap. - Author:
- Martin Mazanek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MappedRoleMapper.Builder
A builder for map backed role mappers.
-
Field Summary
Fields Modifier and Type Field Description private boolean
initialized
private Map<String,Set<String>>
reverseRoleMap
-
Fields inherited from interface org.wildfly.security.authz.RoleMapper
IDENTITY_ROLE_MAPPER
-
-
Constructor Summary
Constructors Modifier Constructor Description MappedRoleMapper()
Construct a new instance.private
MappedRoleMapper(Map<String,Set<String>> roleMap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MappedRoleMapper.Builder
builder()
Construct a newMappedRoleMapper.Builder
for creating theMappedRoleMapper
.void
initialize(Map<String,String> configuration)
Custom component method.Roles
mapRoles(Roles rolesToMap)
Returns a set of strings representing the roles mapped from the given roles in their raw form.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.authz.RoleMapper
and, minus, or, xor
-
-
-
-
Constructor Detail
-
MappedRoleMapper
public MappedRoleMapper()
Construct a new instance. Called from WildFly core when using this as a custom component. You should not use this constructor and useMappedRoleMapper.Builder
instead. You must callinitialize(Map)
to configure mapping map before usage.- See Also:
MappedRoleMapper.Builder
-
-
Method Detail
-
initialize
public void initialize(Map<String,String> configuration)
Custom component method. Called from WildFly core. Used to include mapped role mapping functionality in older WildFly versions.- Parameters:
configuration
- map of mapping rules where key is delegate role and value is whitespace separated list of new roles- Throws:
IllegalStateException
- when called mapper is already initialized
-
mapRoles
public Roles mapRoles(Roles rolesToMap)
Description copied from interface:RoleMapper
Returns a set of strings representing the roles mapped from the given roles in their raw form.- Specified by:
mapRoles
in interfaceRoleMapper
- Parameters:
rolesToMap
- the roles in their raw form to apply mapping- Returns:
- the mapped role set
-
builder
public static MappedRoleMapper.Builder builder()
Construct a newMappedRoleMapper.Builder
for creating theMappedRoleMapper
.- Returns:
- a new
MappedRoleMapper.Builder
for creating theMappedRoleMapper
.
-
-