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 classAmService.BuilderBuilder ofAmService.static classAmService.DiscoveryA 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 AmVersionDEFAULT_AM_VERSIONAM 6.0.0.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description URIdefaultOidcJwkSetUri()Returns the default Open ID Connect JWK Set URI exposed by AM.static AmService.Discoverydiscovery(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.StringgetAgentId()Returns the agent's ID.HandlergetAuthenticatedHandler()Returns aHandlerthat will perform automatic authentication with the provided agent credentials.URIgetBaseUri()Return the base URI for this server.StringgetCookieName()Returns the cookie header name used by AM server.HandlergetHandler()Returns the handler to use with this configuration.Optional<NotificationService>getNotificationService()Returns the AM notification service.RealmgetRealm()Returns the realm to use with this configuration.SessionServicegetSessionService()Returns theSessionServicefor this server.AsyncRefreshableSupplier<SsoToken,AuthenticationException>getTokenProvider()Returns theAsyncRefreshableSupplierbeing used as aSsoTokenprovider for this server.VersiongetVersion()Return the version of the configured OpenAM Server.Stringjson()Build the endpoint URI for an endpoint located in the/jsonnamespace.Stringjson(String endpoint)Build the endpoint URI for an endpoint located in the/jsonnamespace.URIjsonUri()Build the endpoint URI for an endpoint located in the/jsonnamespace.URIjsonUri(String endpoint)Build the endpoint URI for an endpoint located in the/jsonnamespace.Stringoauth2(String endpoint)Build the endpoint URI for an endpoint located in the/oauth2namespace.URIoauth2Uri(String endpoint)Build the endpoint URI for an endpoint located in the/oauth2namespace.Promise<Void,Exception>start()Starts this server instance (and associated services).Promise<Void,NeverThrowsException>stop()Stops this server instance (and associated services).Stringsts()Returns the transformation endpoint located in the/rest-stsnamespace.Stringsts(String endpoint)Returns the transformation endpoint located in the/rest-stsnamespace.URIstsUri(String endpoint)Returns the URI of the transformation endpoint located in the/rest-stsnamespace.Stringuma(String endpoint)Build the endpoint URI for an endpoint located in the/umanamespace.URIumaUri(String endpoint)Build the endpoint URI for an endpoint located in the/umanamespace.UriServiceuriService(Realm realm)Provides anUriServiceinstance that creates URI for the given realm.HandlerwithHeadlessAuthentication(Handler delegate)Returns aHandlerwhich 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 aHandlerthat will perform automatic authentication with the provided agent credentials.- Returns:
- the
Handlerthat will perform automatic authentication.
-
withHeadlessAuthentication
public Handler withHeadlessAuthentication(Handler delegate)
Returns aHandlerwhich wraps theHeadlessAuthenticationFilter.- Parameters:
delegate- The delegate Handler.- Returns:
- a
Handlerwhich wraps theHeadlessAuthenticationFilter.
-
getSessionService
public SessionService getSessionService()
Returns theSessionServicefor this server.- Returns:
- the
SessionServicein use for this server.
-
getTokenProvider
public AsyncRefreshableSupplier<SsoToken,AuthenticationException> getTokenProvider()
Returns theAsyncRefreshableSupplierbeing used as aSsoTokenprovider for this server.- Returns:
- the
AsyncRefreshableSupplierbeing used as aSsoTokenprovider for this server.
-
json
public String json()
Build the endpoint URI for an endpoint located in the/jsonnamespace.- Returns:
- an absolute endpoint URI.
-
json
public String json(String endpoint)
Build the endpoint URI for an endpoint located in the/jsonnamespace.- 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/jsonnamespace.- Returns:
- an absolute endpoint URI.
-
jsonUri
public URI jsonUri(String endpoint)
Build the endpoint URI for an endpoint located in the/jsonnamespace.- 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/oauth2namespace.- 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/oauth2namespace.- 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/umanamespace.- 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-stsnamespace.- Returns:
- the transformation endpoint located in the
/rest-stsnamespace.
-
sts
public String sts(String endpoint)
Returns the transformation endpoint located in the/rest-stsnamespace.- 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-stsnamespace.
-
stsUri
public URI stsUri(String endpoint)
Returns the URI of the transformation endpoint located in the/rest-stsnamespace.- 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/umanamespace.- 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 anUriServiceinstance 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.
-
-