Class OAuth2SessionContext
- java.lang.Object
-
- org.forgerock.services.context.AbstractContext
-
- org.forgerock.openig.filter.oauth2.client.OAuth2SessionContext
-
- All Implemented Interfaces:
Context
public class OAuth2SessionContext extends AbstractContext
This context helps to manage theOAuth2Session
when used withOAuth2ClientFilter
.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearSession()
Clear the existing managed session.org.forgerock.openig.filter.oauth2.client.OAuth2Session
findOrCreateSession()
Returns the managed session, or create a new one if none are managed at the time of this call.Optional<org.forgerock.openig.filter.oauth2.client.OAuth2Session>
findSession()
Returns the managed session, or an emptyOptional
if none are managed at the time of this call.void
updateSession(org.forgerock.openig.filter.oauth2.client.OAuth2Session newSession)
Replace the existing managed session (if any) with the provided one (can benull
).-
Methods inherited from class org.forgerock.services.context.AbstractContext
asContext, containsContext, containsContext, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
-
-
-
-
Method Detail
-
findSession
public Optional<org.forgerock.openig.filter.oauth2.client.OAuth2Session> 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
public org.forgerock.openig.filter.oauth2.client.OAuth2Session 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
public void updateSession(org.forgerock.openig.filter.oauth2.client.OAuth2Session newSession)
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.
-
-