Package org.forgerock.openig.tools.am
Class AmService
- java.lang.Object
-
- org.forgerock.openig.tools.am.AmService
-
public final class AmService extends Object
Creates a configuration class for AM.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AmService.Builder
Builder ofAmService
.static class
AmService.Discovery
A pre-builder class used to discover AM details such as its version and expected cookie name.
-
Field Summary
Fields Modifier and Type Field Description static AmVersion
DEFAULT_AM_VERSION
AM 6.0.0.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description URI
defaultOidcJwkSetUri()
Returns the default Open ID Connect JWK Set URI exposed by AM.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.String
getAgentId()
Returns the agent's ID.Handler
getAuthenticatedHandler()
Returns aHandler
that will perform automatic authentication with the provided agent credentials.URI
getBaseUri()
Return the base URI for this server.String
getCookieName()
Returns the cookie header name used by AM server.Handler
getHandler()
Returns the handler to use with this configuration.Optional<NotificationService>
getNotificationService()
Returns the AM notification service.Realm
getRealm()
Returns the realm to use with this configuration.SessionService
getSessionService()
Returns theSessionService
for this server.AsyncRefreshableSupplier<SsoToken,AuthenticationException>
getTokenProvider()
Returns theAsyncRefreshableSupplier
being used as aSsoToken
provider for this server.Version
getVersion()
Return the version of the configured OpenAM Server.String
json()
Build the endpoint URI for an endpoint located in the/json
namespace.String
json(String endpoint)
Build the endpoint URI for an endpoint located in the/json
namespace.URI
jsonUri()
Build the endpoint URI for an endpoint located in the/json
namespace.URI
jsonUri(String endpoint)
Build the endpoint URI for an endpoint located in the/json
namespace.String
oauth2(String endpoint)
Build the endpoint URI for an endpoint located in the/oauth2
namespace.URI
oauth2Uri(String endpoint)
Build the endpoint URI for an endpoint located in the/oauth2
namespace.Promise<Void,Exception>
start()
Starts this server instance (and associated services).Promise<Void,NeverThrowsException>
stop()
Stops this server instance (and associated services).String
sts()
Returns the transformation endpoint located in the/rest-sts
namespace.String
sts(String endpoint)
Returns the transformation endpoint located in the/rest-sts
namespace.URI
stsUri(String endpoint)
Returns the URI of the transformation endpoint located in the/rest-sts
namespace.String
uma(String endpoint)
Build the endpoint URI for an endpoint located in the/uma
namespace.URI
umaUri(String endpoint)
Build the endpoint URI for an endpoint located in the/uma
namespace.UriService
uriService(Realm realm)
Provides anUriService
instance that creates URI for the given realm.Handler
withHeadlessAuthentication(Handler delegate)
Returns aHandler
which wraps theHeadlessAuthenticationFilter
.
-
-
-
Field Detail
-
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.
-
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 aHandler
that will perform automatic authentication with the provided agent credentials.- Returns:
- the
Handler
that will perform automatic authentication.
-
withHeadlessAuthentication
public Handler withHeadlessAuthentication(Handler delegate)
Returns aHandler
which wraps theHeadlessAuthenticationFilter
.- Parameters:
delegate
- The delegate Handler.- Returns:
- a
Handler
which wraps theHeadlessAuthenticationFilter
.
-
getSessionService
public SessionService getSessionService()
Returns theSessionService
for this server.- Returns:
- the
SessionService
in use for this server.
-
getTokenProvider
public AsyncRefreshableSupplier<SsoToken,AuthenticationException> getTokenProvider()
Returns theAsyncRefreshableSupplier
being used as aSsoToken
provider for this server.- Returns:
- the
AsyncRefreshableSupplier
being used as aSsoToken
provider for this server.
-
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 anUriService
instance that creates URI for the given realm.- Parameters:
realm
- the realm we want URIs for (nevernull
)- Returns:
- the associated UriService
-
defaultOidcJwkSetUri
public URI defaultOidcJwkSetUri()
Returns the default Open ID Connect JWK Set URI exposed by AM.This AM URL is stable. Although being an OIDC endpoint it is accessible even if OIDC is not configured.
- Returns:
- the OpenID Connect JWK Set URI
-
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 URIrealm
- the realm to use, defaults to root realmcookieName
- the cookie name used for agent authentication (may be null)versionHint
- a hint on the expected version (may be null)agentId
- the agent IDagentPassword
- the agent password as a secret referenceamHandler
- the Handler used for AM calls- Returns:
- an AM Discovery object ready to build.
-
-