Class RoleMapper
- java.lang.Object
-
- org.swisspush.gateleen.security.authorization.RoleMapper
-
public class RoleMapper extends java.lang.ObjectHolds and maintains the RoleMapper configuration and performs the mapping.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classRoleMapper.MappedRole
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Loggerlogstatic java.lang.StringROLEMAPPER
-
Constructor Summary
Constructors Constructor Description RoleMapper(org.swisspush.gateleen.core.storage.ResourceStorage storage, java.lang.String securityRoot, java.util.Map<java.lang.String,java.lang.Object> properties)Holds the list of all configured RoleMappings and executes the mapping
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckConfigResource(io.vertx.core.buffer.Buffer buffer)voidconfigUpdate()Retrieve the configured RoleMapper from Storage and populate the corresponding List of mappers.java.util.Map<java.lang.String,RoleMapper.MappedRole>mapRoles(java.util.Set<java.lang.String> roles)Maps the received roles from http header according the rolemapper rules and return the set of mapped roles including the initial list of roles according to the given mapping rule sets.
-
-
-
Field Detail
-
log
public static final org.slf4j.Logger log
-
ROLEMAPPER
public static final java.lang.String ROLEMAPPER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RoleMapper
public RoleMapper(org.swisspush.gateleen.core.storage.ResourceStorage storage, java.lang.String securityRoot, java.util.Map<java.lang.String,java.lang.Object> properties)Holds the list of all configured RoleMappings and executes the mapping- Parameters:
storage- Reference to the storage to retrieve the RoleMappings fromsecurityRoot- Base url to retrieve the rolemapper config resource from (no trailing slash expected nor necessary)properties- The system properties given to the application, used to exctract the Environement where we are running in
-
-
Method Detail
-
checkConfigResource
public void checkConfigResource(io.vertx.core.buffer.Buffer buffer) throws org.swisspush.gateleen.validation.ValidationException- Throws:
org.swisspush.gateleen.validation.ValidationException
-
configUpdate
public void configUpdate()
Retrieve the configured RoleMapper from Storage and populate the corresponding List of mappers.
-
mapRoles
public java.util.Map<java.lang.String,RoleMapper.MappedRole> mapRoles(java.util.Set<java.lang.String> roles)
Maps the received roles from http header according the rolemapper rules and return the set of mapped roles including the initial list of roles according to the given mapping rule sets.- Parameters:
roles- The roles to be mapped and enriched according to the rolemapper object- Returns:
- The resulting list of initial plus mapped roles
-
-