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 6.0.0.
    • Method Detail

      • 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 Promise<Void,​Exception> start()
        Starts this server instance (and associated services).
        Returns:
        A promise of a started AM service or an 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
      • discovery

        public static AmService.Discovery discovery​(URI baseUri,
                                                    Realm realm,
                                                    String cookieName,
                                                    Version versionHint,
                                                    String agentId,
                                                    SecretReference<GenericSecret> agentPassword,
                                                    Handler amHandler)
        Create an AM Discovery object which will get information from AM upon building.
        Parameters:
        baseUri - the AM base URI
        realm - the realm to use, defaults to root realm
        cookieName - the cookie name used for agent authentication (may be null)
        versionHint - a hint on the expected version (may be null)
        agentId - the agent ID
        agentPassword - the agent password
        amHandler - the Handler used for AM calls
        Returns:
        an AM Discovery object ready to build.