Interface OAuthTokenAccess


@NotNull public interface OAuthTokenAccess
Entry point for accessing and clearing OAuth access tokens

The tokens are stored distinctly for each client connection and user. The client connection is identified by name and the user is identified by the user id.

The storage strategy may vary and is controlled by the currently active implementation of the OAuthTokenStore.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    clearAccessToken(ClientConnection connection, org.apache.sling.api.resource.ResourceResolver resolver)
    Clears the access token for the given connection and user, as identified by the resource resolver
    clearAccessToken(ClientConnection connection, org.apache.sling.api.SlingHttpServletRequest request, String redirectPath)
    Clears the access token for the given connection and user, as identified by the request.
    getAccessToken(ClientConnection connection, org.apache.sling.api.SlingHttpServletRequest request, String redirectPath)
    Retrieves an existing access, valid, access token from storage.
  • Method Details

    • getAccessToken

      OAuthTokenResponse getAccessToken(ClientConnection connection, org.apache.sling.api.SlingHttpServletRequest request, String redirectPath)
      Retrieves an existing access, valid, access token from storage.

      Refreshes expired access tokens if a refresh token is available but does not attempt to retrieve new access tokens.

      Parameters:
      connection - the client connection to retrieve token for
      request - the request used to determine the current user for which to retrieve the token and to build the redirect URL
      redirectPath - the path to redirect to after completing the OAuth flow
      Returns:
      the token response
    • clearAccessToken

      OAuthTokenResponse clearAccessToken(ClientConnection connection, org.apache.sling.api.SlingHttpServletRequest request, String redirectPath)
      Clears the access token for the given connection and user, as identified by the request.

      Returns a response that does not have a valid token and contains a URI to redirect the user to.

      Parameters:
      connection - the client connection to clear the token for
      request - the request used to determine the current user for which to retrieve the token and to build the redirect URL
      redirectPath - the path to redirect to after completing the OAuth flow
      Returns:
      the token response
    • clearAccessToken

      void clearAccessToken(ClientConnection connection, org.apache.sling.api.resource.ResourceResolver resolver)
      Clears the access token for the given connection and user, as identified by the resource resolver

      For scenarios where a redirect URI should be generated after clearing the access token clearAccessToken(ClientConnection, SlingHttpServletRequest, String) should be used instead.

      Parameters:
      connection - the client connection to clear the token for
      resolver - used to determine the current user for which to retrieve the token