Class CrestSessionService
- java.lang.Object
-
- org.forgerock.openig.tools.session.CrestSessionService
-
- All Implemented Interfaces:
SessionService
public final class CrestSessionService extends Object implements SessionService
TheCrestSessionServiceis responsible for performing interactions with the AM sessions endpoint.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCrestSessionService.BuilderBuilder of theCrestSessionService.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CrestSessionService.Builderbuilder(RequestHandler sessionInfoRequestHandler, RequestHandler logoutRequestHandler, Clock clock)Returns a newCrestSessionService.Builderfor creating a newCrestSessionServiceinstance.Promise<Optional<SessionInfo>,SessionException>getSessionInfo(Context context, String ssoToken)Returns a promise that will be completed with an optionalSessionInfoor with anSessionExceptionin case of errors.Promise<Void,SessionException>logout(Context context, String ssoToken)Returns a promise that will be completed with aVoidor with anSessionExceptionin case of errors.
-
-
-
Method Detail
-
builder
public static CrestSessionService.Builder builder(RequestHandler sessionInfoRequestHandler, RequestHandler logoutRequestHandler, Clock clock)
Returns a newCrestSessionService.Builderfor creating a newCrestSessionServiceinstance.- 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:SessionServiceReturns a promise that will be completed with an optionalSessionInfoor with anSessionExceptionin case of errors. The optionalSessionInfowill be empty only when the givenssoTokenis invalid or expired.- Specified by:
getSessionInfoin interfaceSessionService- Parameters:
context- The request context.ssoToken- The ssoToken used to retrieve the session information about.- Returns:
- a promise that will be completed with
SessionInfoor with anSessionExceptionin case of errors.
-
logout
public Promise<Void,SessionException> logout(Context context, String ssoToken)
Description copied from interface:SessionServiceReturns a promise that will be completed with aVoidor with anSessionExceptionin case of errors.- Specified by:
logoutin interfaceSessionService- Parameters:
context- The request context.ssoToken- The ssoToken to logout.- Returns:
- a promise that will be completed with a
Voidor with anSessionExceptionin case of errors.
-
-