Class AmService


  • public final class AmService
    extends Object
    Creates a configuration class for AM.
    • Field Detail

      • DEFAULT_COOKIE_NAME

        public static final String DEFAULT_COOKIE_NAME
        The default cookie header name for the OpenAM Server.
        See Also:
        Constant Field Values
      • DEFAULT_AM_VERSION

        public static final AmVersion DEFAULT_AM_VERSION
        AM 5.0.0 (equivalent of OpenAM 14.0.0).
    • Method Detail

      • builder

        public static AmService.Builder builder​(URI baseUri,
                                                Handler amHandler,
                                                Clock clock,
                                                String agentId,
                                                SecretReference<GenericSecret> agentPassword)
        Returns a new AmService.Builder for creating a new AmService instance.
        Parameters:
        baseUri - AM base URI (ex: http://openam.example.com/openam), never null.
        amHandler - The handler to use the CrestSessionService, not null.
        clock - The clock to use when dealing with time, not null.
        agentId - The agent id, not null.
        agentPassword - The agent's password, not null.
        Returns:
        a new builder
      • builder

        public static AmService.Builder builder​(AmService amService)
        Returns a new AmService.Builder for creating a new AmService instance from a given one.
        Parameters:
        amService - The AmService to copy.
        Returns:
        a new builder based on the given AmService.
      • getHandler

        public Handler getHandler()
        Returns the handler to use with this configuration.
        Returns:
        The handler used in this configuration.
      • getAuthenticationService

        public AuthenticationService getAuthenticationService()
        Returns the service used to authenticate subjects to AM.
        Returns:
        the service used to authenticate subjects to AM.
      • getNotificationService

        public Optional<NotificationService> getNotificationService()
        Returns the AM notification service.
        Returns:
        the AM notification service.
      • getAgentId

        public String getAgentId()
        Returns the agent's ID.
        Returns:
        the agent's ID.
      • start

        public void start()
                   throws Exception
        Starts this server instance (and associated services).
        Throws:
        Exception - if startup failed
      • stop

        public Promise<Void,​NeverThrowsException> stop()
        Stops this server instance (and associated services).
        Returns:
        Promise completing the service being stopped
      • getRealm

        public Realm getRealm()
        Returns the realm to use with this configuration.
        Returns:
        The realm used in this configuration.
      • getCookieName

        public String getCookieName()
        Returns the cookie header name used by AM server.
        Returns:
        the cookie header name used by AM server.
      • getBaseUri

        public URI getBaseUri()
        Return the base URI for this server.
        Returns:
        the base URI for this server.
      • getVersion

        public Version getVersion()
        Return the version of the configured OpenAM Server.
        Returns:
        the version of the configured OpenAM Server.
      • getAuthenticatedHandler

        public Handler getAuthenticatedHandler()
        Returns a Handler that will perform automatic authentication with the provided agent credentials.
        Returns:
        the Handler that will perform automatic authentication.
      • json

        public String json()
        Build the endpoint URI for an endpoint located in the /json namespace.
        Returns:
        an absolute endpoint URI.
      • json

        public String json​(String endpoint)
        Build the endpoint URI for an endpoint located in the /json namespace.
        Parameters:
        endpoint - endpoint name, such as policies or /serverinfo/version. The endpoint MUST be a proper encoded path.
        Returns:
        an absolute endpoint URI.
      • jsonUri

        public URI jsonUri()
        Build the endpoint URI for an endpoint located in the /json namespace.
        Returns:
        an absolute endpoint URI.
      • jsonUri

        public URI jsonUri​(String endpoint)
        Build the endpoint URI for an endpoint located in the /json namespace.
        Parameters:
        endpoint - endpoint name, such as policies or /serverinfo/version. The endpoint MUST be a proper encoded path.
        Returns:
        an absolute endpoint URI
      • oauth2

        public String oauth2​(String endpoint)
        Build the endpoint URI for an endpoint located in the /oauth2 namespace.
        Parameters:
        endpoint - endpoint name, such as .well-known/openid-configuration or /authorize. The endpoint MUST be a proper encoded path.
        Returns:
        an absolute endpoint URI
      • oauth2Uri

        public URI oauth2Uri​(String endpoint)
        Build the endpoint URI for an endpoint located in the /oauth2 namespace.
        Parameters:
        endpoint - endpoint name, such as .well-known/openid-configuration or /authorize. The endpoint MUST be a proper encoded path.
        Returns:
        an absolute endpoint URI.
      • uma

        public String uma​(String endpoint)
        Build the endpoint URI for an endpoint located in the /uma namespace.
        Parameters:
        endpoint - endpoint name, such as .well-known/uma-configuration or /authz_request. The endpoint MUST be a proper encoded path.
        Returns:
        an absolute endpoint URI.
      • sts

        public String sts()
        Returns the transformation endpoint located in the /rest-sts namespace.
        Returns:
        the transformation endpoint located in the /rest-sts namespace.
      • sts

        public String sts​(String endpoint)
        Returns the transformation endpoint located in the /rest-sts namespace.
        Parameters:
        endpoint - The endpoint name, such as rest-sts/username-transformer. The endpoint MUST be a proper encoded path.
        Returns:
        the transformation endpoint located in the /rest-sts namespace.
      • stsUri

        public URI stsUri​(String endpoint)
        Returns the URI of the transformation endpoint located in the /rest-sts namespace.
        Parameters:
        endpoint - The endpoint name, such as rest-sts/username-transformer. The endpoint MUST be a proper encoded path.
        Returns:
        an absolute endpoint URI.
      • umaUri

        public URI umaUri​(String endpoint)
        Build the endpoint URI for an endpoint located in the /uma namespace.
        Parameters:
        endpoint - endpoint name, such as .well-known/uma-configuration or /authz_request. The endpoint MUST be a proper encoded path.
        Returns:
        an absolute endpoint URI.
      • uriService

        public UriService uriService​(Realm realm)
        Provides an UriService instance that creates URI for the given realm.
        Parameters:
        realm - the realm we want URIs for (never null)
        Returns:
        the associated UriService