Class OAuth2SessionContext
java.lang.Object
org.forgerock.services.context.AbstractContext
org.forgerock.openig.filter.oauth2.client.OAuth2SessionContext
- All Implemented Interfaces:
Context
This context helps to manage the
OAuth2Session
when used with OAuth2ClientFilter
.
Instead of frequently loading/saving the session object (potentially expensive operations), this context keep
a unique managed instance of OAuth2Session
.
It also offers some methods that helps maintain the session for the duration of request processing.
-
Field Summary
Fields inherited from class org.forgerock.services.context.AbstractContext
data
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear the existing managed session.Returns the managed session, or create a new one if none are managed at the time of this call.Returns the managed session, or an emptyOptional
if none are managed at the time of this call.void
Replace the existing managed session (if any) with the provided one (can benull
).Methods inherited from class org.forgerock.services.context.AbstractContext
as, asContext, containsContext, containsContext, get, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
-
Method Details
-
findSession
Returns the managed session, or an emptyOptional
if none are managed at the time of this call.- Returns:
- the managed session, or an empty
Optional
.
-
findOrCreateSession
Returns the managed session, or create a new one if none are managed at the time of this call.- Returns:
- the managed session, or create a new one.
-
updateSession
Replace the existing managed session (if any) with the provided one (can benull
).- Parameters:
newSession
- the new managed session (can benull
).
-
clearSession
public void clearSession()Clear the existing managed session.
-