Class SCIMSubResourceTypeHandler

  • All Implemented Interfaces:
    Configurable, ExampleUsageProvider, Reconfigurable<SCIMSubResourceTypeHandlerConfig>, UnboundIDExtension

    @Extensible
    @BrokerExtension
    public abstract class SCIMSubResourceTypeHandler
    extends java.lang.Object
    implements UnboundIDExtension, Reconfigurable<SCIMSubResourceTypeHandlerConfig>, ExampleUsageProvider
    This class defines an API that may be implemented by PingAuthorize Server extensions that need to extend the server's standard SCIM 2 capabilities.

    A SCIM sub-resource type is a child type of a SCIM resource type. Where a SCIM resource type strictly provides a view of a data store record (such as an LDAP directory server entry), a SCIM sub-resource type may expose arbitrary capabilities or data associated with a parent SCIM resource type.

    A SCIM sub-resource type REST API endpoint is accessed as a child path of the parent SCIM resource. For example, a SCIM Sub-Resource Type Handler that provides an account state management API for a "User" SCIM resource type might be accessed via the path /scim/v2/Users/{resourceId}/account.

    One-to-one vs. one-to-many relationships

    A SCIM sub-resource type may have a one-to-one relationship with its parent resource type, meaning that only one sub-resource exists per parent SCIM resource, or it may have a one-to-many relationship, meaning that multiple sub-resources may exist parent SCIM resource. Each resource belonging to a one-to-many SCIM sub-resource type should have a unique identifier, just as each resource of a SCIM resource type has a unique identifier. For example, a SCIM sub-resource representing a user's pet cat might have the path /scim/v2/Users/{resourceId}/Cats/{subresourceId}, where "{subresourceId}" is the cat resource's unique identifier.

    Configuring SCIM Sub-Resource Type Handlers

    In order to configure a SCIM Sub-Resource Type Handler created using this API, use a command like:
          dsconfig create-scim-sub-resource-type-handler \
               --type-name "{parent-resource-type} \
               ---handler-name "{name}" \
               --type third-party \
               --set enabled:true \
               --set "endpoint:{endpoint}" \
               --set "extension-class:{class-name}" \
               --set "extension-argument:{name=value}"
     
    where "{parent-resource-type}" is the name of the parent SCIM Resource Type (such as "Users"), "{name}" is the name to use for the SCIM Sub-Resource Type Handler instance, "{endpoint}" is the HTTP addressable endpoint of the SCIM sub-resource type relative to the base resource URL, "{class-name}" is the fully-qualified name of the Java class that extends com.unboundid.directory.sdk.scim2.api.SCIMSubResourceTypeHandler, and "{name=value}" represents name-value pairs for any arguments to provide to the SCIM Sub-Resource Type Handler. If multiple arguments should be provided to the extension, then the "--set extension-argument:{name=value}" option should be provided multiple times.
    • Method Detail

      • getExtensionDescription

        public abstract java.lang.String[] getExtensionDescription()
        Retrieves a human-readable description for this extension. Each element of the array that is returned will be considered a separate paragraph in generated documentation.
        Specified by:
        getExtensionDescription in interface UnboundIDExtension
        Returns:
        A human-readable description for this extension, or null or an empty array if no description should be available.
      • defineConfigArguments

        public void defineConfigArguments​(ArgumentParser parser)
                                   throws ArgumentException
        Updates the provided argument parser to define any configuration arguments which may be used by this extension. The argument parser may also be updated to define relationships between arguments (e.g., to specify required, exclusive, or dependent argument sets).
        Specified by:
        defineConfigArguments in interface Configurable
        Parameters:
        parser - The argument parser to be updated with the configuration arguments which may be used by this extension.
        Throws:
        ArgumentException - If a problem is encountered while updating the provided argument parser.
      • getExamplesArgumentSets

        public java.util.Map<java.util.List<java.lang.String>,​java.lang.String> getExamplesArgumentSets()
        Retrieves a map containing examples of configurations that may be used for this extension. The map key should be a list of sample arguments, and the corresponding value should be a description of the behavior that will be exhibited by the extension when used with that configuration.
        Specified by:
        getExamplesArgumentSets in interface ExampleUsageProvider
        Returns:
        A map containing examples of configurations that may be used for this extension. It may be null or empty if there should not be any example argument sets.
      • isConfigurationAcceptable

        public boolean isConfigurationAcceptable​(SCIMSubResourceTypeHandlerConfig config,
                                                 ArgumentParser parser,
                                                 java.util.List<java.lang.String> unacceptableReasons)
        Indicates whether the configuration represented by the provided argument parser is acceptable for use by this extension. The parser will have been used to parse any configuration available for this extension, and any automatic validation will have been performed. This method may be used to perform any more complex validation which cannot be performed automatically by the argument parser.
        Specified by:
        isConfigurationAcceptable in interface Reconfigurable<SCIMSubResourceTypeHandlerConfig>
        Parameters:
        config - The general configuration for this extension.
        parser - The argument parser that has been used to parse the proposed configuration for this extension.
        unacceptableReasons - A list to which messages may be added to provide additional information about why the provided configuration is not acceptable.
        Returns:
        true if the configuration in the provided argument parser appears to be acceptable, or false if not.
      • applyConfiguration

        public ResultCode applyConfiguration​(SCIMSubResourceTypeHandlerConfig config,
                                             ArgumentParser parser,
                                             java.util.List<java.lang.String> adminActionsRequired,
                                             java.util.List<java.lang.String> messages)
        Attempts to apply the configuration from the provided argument parser to this extension.
        Specified by:
        applyConfiguration in interface Reconfigurable<SCIMSubResourceTypeHandlerConfig>
        Parameters:
        config - The general configuration for this extension.
        parser - The argument parser that has been used to parse the new configuration for this extension.
        adminActionsRequired - A list to which messages may be added to provide additional information about any additional administrative actions that may be required to apply some of the configuration changes.
        messages - A list to which messages may be added to provide additional information about the processing performed by this method.
        Returns:
        A result code providing information about the result of applying the configuration change. A result of SUCCESS should be used to indicate that all processing completed successfully. Any other result will indicate that a problem occurred during processing.
      • initializeHandler

        public abstract void initializeHandler​(SCIMServerContext serverContext,
                                               SCIMSubResourceTypeHandlerConfig config,
                                               ArgumentParser parser)
                                        throws java.lang.Exception
        Initializes this SCIM Sub-Resource Type Handler.
        Parameters:
        serverContext - A handle to the server context for the server in which this extension is running.
        config - The configuration for this SCIM Sub-Resource Type Handler.
        parser - The argument parser which has been initialized from the configuration for this SCIM Sub-Resource Type Handler.
        Throws:
        java.lang.Exception - If a problem occurs while initializing this SCIM Sub-Resource Type Handler.
      • finalizeHandler

        public void finalizeHandler()
        Performs any cleanup that might be necessary when this SCIM Sub-Resource Type Handler is taken out of service.
      • getCoreSchema

        public abstract com.unboundid.scim2.common.types.SchemaResource getCoreSchema()
        Gets the SCIM Sub-Resource Type's core schema.
        Returns:
        The core schema for the SCIM Sub-Resource Type. This must not return null.
      • getSchemaExtensions

        public java.util.Map<com.unboundid.scim2.common.types.SchemaResource,​java.lang.Boolean> getSchemaExtensions()
        Gets the SCIM Sub-Resource Type's schema extensions, if any.

        By default, this method will return an empty map, indicating that no schema extensions are supported.

        Returns:
        A map of schema extensions, where each key is a SchemaResource and the value is a boolean indicating whether the schema extension is required.
      • supportsOneToMany

        public abstract boolean supportsOneToMany()
        Indicates whether the SCIM Sub-Resource Type implemented by this handler is supports one and only one sub-resource per parent resource or supports multiple sub-resources per parent resource.
        Returns:
        True if this SCIM Sub-Resource Type Handler supports multiple sub-resources per parent resource, or false if it supports a single sub-resource per parent resource.
      • create

        public com.unboundid.scim2.common.ScimResource create​(SCIMCreateRequest request)
                                                       throws com.unboundid.scim2.common.exceptions.ScimException
        Handles SCIM create requests.

        By default, this method will throw a NotImplementedException if it is not overridden.

        Parameters:
        request - A SCIM create request.
        Returns:
        The created sub-resource.
        Throws:
        com.unboundid.scim2.common.exceptions.ScimException - If an error occurs.
      • retrieve

        public com.unboundid.scim2.common.ScimResource retrieve​(SCIMRetrieveRequest request)
                                                         throws com.unboundid.scim2.common.exceptions.ScimException
        Handles SCIM retrieve requests.

        By default, this method will throw a NotImplementedException if it is not overridden.

        Parameters:
        request - A SCIM retrieve request.
        Returns:
        The retrieved sub-resource.
        Throws:
        com.unboundid.scim2.common.exceptions.ScimException - If an error occurs.
      • modify

        public com.unboundid.scim2.common.ScimResource modify​(SCIMModifyRequest request)
                                                       throws com.unboundid.scim2.common.exceptions.ScimException
        Handles SCIM modify requests.

        By default, this method will throw a NotImplementedException if it is not overridden.

        Parameters:
        request - A SCIM modify request.
        Returns:
        The modified sub-resource.
        Throws:
        com.unboundid.scim2.common.exceptions.ScimException - If an error occurs.
      • replace

        public com.unboundid.scim2.common.ScimResource replace​(SCIMReplaceRequest request)
                                                        throws com.unboundid.scim2.common.exceptions.ScimException
        Handles SCIM replace requests.

        By default, this method will throw a NotImplementedException if it is not overridden.

        Parameters:
        request - A SCIM replace request.
        Returns:
        The replaced sub-resource.
        Throws:
        com.unboundid.scim2.common.exceptions.ScimException - If an error occurs.
      • delete

        public void delete​(SCIMDeleteRequest request)
                    throws com.unboundid.scim2.common.exceptions.ScimException
        Handles SCIM delete requests.

        By default, this method will throw a NotImplementedException if it is not overridden.

        Parameters:
        request - A SCIM delete request.
        Throws:
        com.unboundid.scim2.common.exceptions.ScimException - If an error occurs.
      • search

        public void search​(SCIMSearchRequest request)
                    throws com.unboundid.scim2.common.exceptions.ScimException
        Handles SCIM search requests.

        By default, this method will throw a NotImplementedException if it is not overridden.

        Parameters:
        request - A SCIM search request.
        Throws:
        com.unboundid.scim2.common.exceptions.ScimException - If an error occurs.