Class AuthorizationPolicyMarshaller


  • public class AuthorizationPolicyMarshaller
    extends Object
    Class used to convert an AuthorizationPolicy instance into/from a set of key/value pairs.

    The format of the key/value pairs is:

    "classifier.identifier.setting.extra=value"
    Where:
    • classifier = role|group
    • identifier = An existing role or group identifier (depending on the classifier type)
    • setting = home|priority|permission
    • extra = Extra setting information. Mandatory for instance to define the permission's name
    • value = The setting value (depends on the setting selected). Value expected per setting type:
      • home: An existing perspective identifier to redirect after login
      • priority: An integer indicating how priority is this role|group compared to others. Used for conflict resolution.
      • permission: A name representing a specific feature or capability over a given resource.

    For example:

     #Role "admin"
     role.admin.home=Home
     role.admin.priority=10
     role.admin.permission.perspective.read=true
     role.admin.permission.perspective.read.Dashboard=false
    
     # Role "user"
     role.user.home=Dashboard
     role.user.priority=0
     role.user.permission.perspective.read=false
     role.user.permission.perspective.read.Home=true
     role.user.permission.perspective.read.Dashboard=true
     
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      AuthorizationPolicyMarshaller.Key parse​(String key)  
      void read​(org.uberfire.security.impl.authz.AuthorizationPolicyBuilder builder, String key, String value)
      It reads key/value pair passed as a parameter and it calls to the right AuthorizationPolicyBuilder method .
      void read​(org.uberfire.security.impl.authz.AuthorizationPolicyBuilder builder, String key, String value, AuthorizationPolicyMarshaller.ReadMode readMode)
      It reads key/value pair passed as a parameter and it calls to the right AuthorizationPolicyBuilder method .
      void read​(org.uberfire.security.impl.authz.AuthorizationPolicyBuilder builder, Map... input)
      It reads all the entries from the collection of property files passed as a parameter.
      void remove​(org.jboss.errai.security.shared.api.Group group, org.uberfire.security.authz.AuthorizationPolicy policy, Map out)  
      void write​(String homePerspectiveId, Map out)  
      void write​(org.jboss.errai.security.shared.api.Group group, int priority, Map out)  
      void write​(org.jboss.errai.security.shared.api.Group group, String homePerspectiveId, Map out)  
      void write​(org.jboss.errai.security.shared.api.Group group, org.uberfire.security.authz.PermissionCollection permissions, Map out)  
      void write​(org.jboss.errai.security.shared.api.Role role, int priority, Map out)  
      void write​(org.jboss.errai.security.shared.api.Role role, String homePerspectiveId, Map out)  
      void write​(org.jboss.errai.security.shared.api.Role role, org.uberfire.security.authz.PermissionCollection permissions, Map out)  
      void write​(org.uberfire.security.authz.AuthorizationPolicy policy, Map out)
      Dumps the AuthorizationPolicy instance passed as a parameter into the output Properties object specified.
      void write​(org.uberfire.security.authz.PermissionCollection permissions, Map out)  
    • Constructor Detail

      • AuthorizationPolicyMarshaller

        public AuthorizationPolicyMarshaller()
    • Method Detail

      • read

        public void read​(org.uberfire.security.impl.authz.AuthorizationPolicyBuilder builder,
                         Map... input)
        It reads all the entries from the collection of property files passed as a parameter. For every entry a call to the proper AuthorizationPolicyBuilder method is executed.

        The valid format for the entries is specified in the class description.

        Parameters:
        builder - The AuthorizationPolicyBuilder used to register every processed entry.
        input - The property objects containing the authz policy entries
      • read

        public void read​(org.uberfire.security.impl.authz.AuthorizationPolicyBuilder builder,
                         String key,
                         String value)
        It reads key/value pair passed as a parameter and it calls to the right AuthorizationPolicyBuilder method .

        The valid format for an key/value pair is specified in the class description.

        Parameters:
        builder - The AuthorizationPolicyBuilder used to register the entry.
        key - The key to read
        value - The value to read
      • read

        public void read​(org.uberfire.security.impl.authz.AuthorizationPolicyBuilder builder,
                         String key,
                         String value,
                         AuthorizationPolicyMarshaller.ReadMode readMode)
        It reads key/value pair passed as a parameter and it calls to the right AuthorizationPolicyBuilder method .

        The valid format for an key/value pair is specified in the class description.

        Parameters:
        builder - The AuthorizationPolicyBuilder used to register the entry.
        key - The key to read
        value - The value to read
        readMode - The AuthorizationPolicyMarshaller.ReadMode determines if the specified key shall be included or excluded
      • write

        public void write​(org.uberfire.security.authz.AuthorizationPolicy policy,
                          Map out)
        Dumps the AuthorizationPolicy instance passed as a parameter into the output Properties object specified.

        The format for an key/value pair is specified in the class description.

        Parameters:
        policy - The AuthorizationPolicy to serialize
        out - The Properties instance used as output
      • write

        public void write​(String homePerspectiveId,
                          Map out)
      • write

        public void write​(org.uberfire.security.authz.PermissionCollection permissions,
                          Map out)
      • write

        public void write​(org.jboss.errai.security.shared.api.Role role,
                          String homePerspectiveId,
                          Map out)
      • write

        public void write​(org.jboss.errai.security.shared.api.Role role,
                          int priority,
                          Map out)
      • write

        public void write​(org.jboss.errai.security.shared.api.Role role,
                          org.uberfire.security.authz.PermissionCollection permissions,
                          Map out)
      • write

        public void write​(org.jboss.errai.security.shared.api.Group group,
                          String homePerspectiveId,
                          Map out)
      • write

        public void write​(org.jboss.errai.security.shared.api.Group group,
                          int priority,
                          Map out)
      • write

        public void write​(org.jboss.errai.security.shared.api.Group group,
                          org.uberfire.security.authz.PermissionCollection permissions,
                          Map out)
      • remove

        public void remove​(org.jboss.errai.security.shared.api.Group group,
                           org.uberfire.security.authz.AuthorizationPolicy policy,
                           Map out)