public class OAuth2SessionContext extends AbstractContext
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.
data
Modifier and Type | Method and 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 empty
Optional 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 be
null ). |
asContext, containsContext, containsContext, getContext, getContextName, getId, getParent, getRootId, isRootContext, toJsonValue, toString
public Optional<org.forgerock.openig.filter.oauth2.client.OAuth2Session> findSession()
Optional
if none are managed at the time of this call.Optional
.public org.forgerock.openig.filter.oauth2.client.OAuth2Session findOrCreateSession()
public void updateSession(org.forgerock.openig.filter.oauth2.client.OAuth2Session newSession)
null
).newSession
- the new managed session (can be null
).public void clearSession()
Copyright 2011-2017 ForgeRock AS.