Class AuthorizationUtil


  • public class AuthorizationUtil
    extends java.lang.Object
    AuthorizationUtil provides utility methods for constructing authorization resource maps.
    Since:
    2014-03-24
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static AuthResource authResource​(AuthResource.Context context, java.lang.String type, java.util.Map<java.lang.String,​java.lang.String> meta)  
      static AuthResource authResource​(AuthResource.Context context, java.util.Map<java.lang.String,​java.lang.String> resourceMap)  
      static AuthResource authResourceKind​(AuthResource.Context context, java.lang.String kind)  
      static AuthResource authResourceKind​(AuthResource.Context context, java.lang.String kind, java.util.Map<java.lang.String,​java.lang.String> meta)  
      static java.util.Set<Attribute> context​(java.lang.String key, java.lang.String value)
      Create a singleton context attribute set
      static java.lang.String contextAsString​(java.util.Set<Attribute> context)
      Generate a string representation of the context attribute set
      static AuthResource projectAuthResource​(java.util.Map<java.lang.String,​java.lang.String> resourceMap)  
      static java.util.Set<Attribute> projectContext​(java.lang.String projectName)
      Create a project context singleton attribute set
      static java.util.Map<java.lang.String,​java.lang.String> resource​(java.lang.String type)
      Return a resource map for a resource of a certain type.
      static java.util.Map<java.lang.String,​java.lang.String> resource​(java.lang.String type, java.util.Map<java.lang.String,​java.lang.String> meta)
      Return a resource map for a resource of a certain type, with attributes
      static java.util.Map<java.lang.String,​java.lang.Object> resourceRule​(java.lang.String type, java.util.Map<java.lang.String,​java.lang.Object> meta)
      Return a resource map for a resource of a certain type, with attributes
      static java.util.Map<java.lang.String,​java.lang.String> resourceType​(java.lang.String kind)
      Return a resource map for a generic resource type
      static java.util.Map<java.lang.String,​java.lang.String> resourceType​(java.lang.String kind, java.util.Map<java.lang.String,​java.lang.String> meta)
      Return a resource map for a generic resource type
      static java.util.Map<java.lang.String,​java.lang.String> resourceTypeRule​(java.lang.String kind)
      Return a resource map for a generic resource type
      static java.util.Map<java.lang.String,​java.lang.String> resourceTypeRule​(java.lang.String kind, java.util.Map<java.lang.String,​java.lang.String> meta)
      Return a resource map for a generic resource type
      static AuthResource systemAuthResource​(java.util.Map<java.lang.String,​java.lang.String> resourceMap)  
      • Methods inherited from class java.lang.Object

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

      • URI_BASE

        public static final java.lang.String URI_BASE
        Base URI for rundeck environment attribute URIs
        See Also:
        Constant Field Values
      • PROJECT_BASE_URI

        public static final java.net.URI PROJECT_BASE_URI
      • RUNDECK_APP_ENV

        public static final java.util.Set<Attribute> RUNDECK_APP_ENV
        the rundeck app environment for authorization
      • GENERIC_RESOURCE_TYPE_NAME

        public static final java.lang.String GENERIC_RESOURCE_TYPE_NAME
        See Also:
        Constant Field Values
    • Method Detail

      • resource

        public static java.util.Map<java.lang.String,​java.lang.String> resource​(java.lang.String type)
        Return a resource map for a resource of a certain type.
        Parameters:
        type - the type name
        Returns:
        the resource map
      • resource

        public static java.util.Map<java.lang.String,​java.lang.String> resource​(java.lang.String type,
                                                                                      java.util.Map<java.lang.String,​java.lang.String> meta)
        Return a resource map for a resource of a certain type, with attributes
        Parameters:
        type - the type name
        meta - the attributes about the resource
        Returns:
        the resource map
      • resourceRule

        public static java.util.Map<java.lang.String,​java.lang.Object> resourceRule​(java.lang.String type,
                                                                                          java.util.Map<java.lang.String,​java.lang.Object> meta)
        Return a resource map for a resource of a certain type, with attributes
        Parameters:
        type - the type name
        meta - the attributes about the resource
        Returns:
        the resource map
      • resourceType

        public static java.util.Map<java.lang.String,​java.lang.String> resourceType​(java.lang.String kind)
        Return a resource map for a generic resource type
        Parameters:
        kind - the resource type name
        Returns:
        the resource map describing a resource type
      • resourceTypeRule

        public static java.util.Map<java.lang.String,​java.lang.String> resourceTypeRule​(java.lang.String kind)
        Return a resource map for a generic resource type
        Parameters:
        kind - the resource type name
        Returns:
        the resource map describing a resource type
      • resourceType

        public static java.util.Map<java.lang.String,​java.lang.String> resourceType​(java.lang.String kind,
                                                                                          java.util.Map<java.lang.String,​java.lang.String> meta)
        Return a resource map for a generic resource type
        Parameters:
        kind - the resource type name
        meta - the attributes about the resource type
        Returns:
        the resource map describing a resource type
      • authResourceKind

        public static AuthResource authResourceKind​(AuthResource.Context context,
                                                    java.lang.String kind,
                                                    java.util.Map<java.lang.String,​java.lang.String> meta)
      • authResource

        public static AuthResource authResource​(AuthResource.Context context,
                                                java.lang.String type,
                                                java.util.Map<java.lang.String,​java.lang.String> meta)
      • resourceTypeRule

        public static java.util.Map<java.lang.String,​java.lang.String> resourceTypeRule​(java.lang.String kind,
                                                                                              java.util.Map<java.lang.String,​java.lang.String> meta)
        Return a resource map for a generic resource type
        Parameters:
        kind - the resource type name
        meta - the attributes about the resource type
        Returns:
        the resource map describing a resource type
      • systemAuthResource

        public static AuthResource systemAuthResource​(java.util.Map<java.lang.String,​java.lang.String> resourceMap)
      • projectAuthResource

        public static AuthResource projectAuthResource​(java.util.Map<java.lang.String,​java.lang.String> resourceMap)
      • projectContext

        public static java.util.Set<Attribute> projectContext​(java.lang.String projectName)
        Create a project context singleton attribute set
        Parameters:
        projectName - project name
        Returns:
        attribute set
      • context

        public static java.util.Set<Attribute> context​(java.lang.String key,
                                                       java.lang.String value)
        Create a singleton context attribute set
        Parameters:
        key - context key
        value - context value
        Returns:
        attribute set
      • contextAsString

        public static java.lang.String contextAsString​(java.util.Set<Attribute> context)
        Generate a string representation of the context attribute set
        Parameters:
        context - context set
        Returns:
        string