Class RoleMapper


  • public class RoleMapper
    extends java.lang.Object
    Holds and maintains the RoleMapper configuration and performs the mapping.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.slf4j.Logger log  
      static java.lang.String ROLEMAPPER  
    • 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
      void checkConfigResource​(io.vertx.core.buffer.Buffer buffer)  
      void configUpdate()
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        public static final org.slf4j.Logger log
    • 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 from
        securityRoot - 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