Class CrestSessionService
- java.lang.Object
-
- org.forgerock.openig.tools.session.CrestSessionService
-
- All Implemented Interfaces:
SessionService
public final class CrestSessionService extends Object implements SessionService
TheCrestSessionService
is responsible for performing interactions with the AM sessions endpoint.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CrestSessionService.Builder
Builder of theCrestSessionService
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CrestSessionService.Builder
builder(RequestHandler sessionInfoRequestHandler, RequestHandler logoutRequestHandler, Clock clock)
Returns a newCrestSessionService.Builder
for creating a newCrestSessionService
instance.Promise<Optional<SessionInfo>,SessionException>
getSessionInfo(Context context, String ssoToken)
Returns a promise that will be completed with an optionalSessionInfo
or with anSessionException
in case of errors.Promise<Void,SessionException>
logout(Context context, String ssoToken)
Returns a promise that will be completed with aVoid
or with anSessionException
in case of errors.
-
-
-
Method Detail
-
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
public Promise<Void,SessionException> logout(Context context, String ssoToken)
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.
-
-