Class OAuth2SessionContext

  • All Implemented Interfaces:
    Context

    public class OAuth2SessionContext
    extends AbstractContext
    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.

    • Method Detail

      • findSession

        public 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.
        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 be null).
        Parameters:
        newSession - the new managed session (can be null).
      • clearSession

        public void clearSession()
        Clear the existing managed session.