Class CrestSessionService
java.lang.Object
org.forgerock.openig.tools.session.CrestSessionService
- All Implemented Interfaces:
SessionService
The
CrestSessionService
is responsible for performing interactions with the AM sessions endpoint.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CrestSessionService.Builder
builder
(RequestHandler sessionInfoRequestHandler, RequestHandler logoutRequestHandler, Clock clock) Returns a newCrestSessionService.Builder
for creating a newCrestSessionService
instance.getSessionInfo
(Context context, String ssoToken) Returns a promise that will be completed with an optionalSessionInfo
or with anSessionException
in case of errors.Returns a promise that will be completed with aVoid
or with anSessionException
in case of errors.
-
Method Details
-
builder
public static CrestSessionService.Builder builder(RequestHandler sessionInfoRequestHandler, RequestHandler logoutRequestHandler, Clock clock) Returns a newCrestSessionService.Builder
for creating a newCrestSessionService
instance.- Parameters:
sessionInfoRequestHandler
- The sessionInfoRequestHandler used when interacting with the AM session info endpoint.logoutRequestHandler
- The logoutRequestHandler used when interacting with the AM session logout endpoint.clock
- The clock to use for any time-based functions.- Returns:
- a new builder
-
getSessionInfo
public Promise<Optional<SessionInfo>,SessionException> getSessionInfo(Context context, String ssoToken) Description copied from interface:SessionService
Returns a promise that will be completed with an optionalSessionInfo
or with anSessionException
in case of errors. The optionalSessionInfo
will be empty only when the givenssoToken
is invalid or expired.- Specified by:
getSessionInfo
in interfaceSessionService
- Parameters:
context
- The request context.ssoToken
- The ssoToken used to retrieve the session information about.- Returns:
- a promise that will be completed with
SessionInfo
or with anSessionException
in case of errors.
-
logout
Description copied from interface:SessionService
Returns a promise that will be completed with aVoid
or with anSessionException
in case of errors.- Specified by:
logout
in interfaceSessionService
- Parameters:
context
- The request context.ssoToken
- The ssoToken to logout.- Returns:
- a promise that will be completed with a
Void
or with anSessionException
in case of errors.
-