public class CacheSessionService extends Object implements SessionService, LifeCycle
SessionInfo
.
The cache is an AsyncLoadingCache
, which loads entries asynchronously.
By default a cached entry will expire once the duration (now - SessionInfo's attribute:
'getMaxSessionExpirationTime()') has elapsed. But it is possible to cap that duration to a maximum
through the parametermaximumTimeout
. In that case, the cached entry will expire once the smallest duration
between the maximumTimeout
and (now - SessionInfo's attribute:
'getMaxSessionExpirationTime()') has elapsed.
Constructor and Description |
---|
CacheSessionService(NotificationService notificationService,
SessionInfoCache sessionInfoCache)
Creates a new CacheSessionService.
|
Modifier and Type | Method and Description |
---|---|
Promise<Optional<SessionInfo>,SessionException> |
getSessionInfo(Context context,
String ssoToken)
Returns a promise that will be completed with an optional
SessionInfo or with an SessionException
in case of errors. |
Promise<Void,SessionException> |
logout(Context context,
String ssoToken)
Returns a promise that will be completed with a
Void or with an SessionException in case
of errors. |
void |
start()
Starts this object.
|
void |
stop()
Stops this object.
|
public CacheSessionService(NotificationService notificationService, SessionInfoCache sessionInfoCache)
notificationService
- The notification service used for entry eviction, can be null
if none.sessionInfoCache
- The cache implementation to use.NullPointerException
- if sessionService or caffeine or clock are null
.public Promise<Optional<SessionInfo>,SessionException> getSessionInfo(Context context, String ssoToken)
SessionService
SessionInfo
or with an SessionException
in case of errors. The optional SessionInfo
will be empty only when the given ssoToken
is
invalid or expired.getSessionInfo
in interface SessionService
context
- The request context.ssoToken
- The ssoToken used to retrieve the session information about.SessionInfo
or with an SessionException
in case
of errors.public Promise<Void,SessionException> logout(Context context, String ssoToken)
SessionService
Void
or with an SessionException
in case
of errors.logout
in interface SessionService
context
- The request context.ssoToken
- The ssoToken to logout.Void
or with an SessionException
in case
of errors.public void start()
LifeCycle
Copyright 2011-2017 ForgeRock AS.