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 TypeMethodDescription@NotNull OAuthTokenResponse
clearAccessToken
(@NotNull ClientConnection connection, @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull String redirectPath) Clears the access token for the given connection and user, as identified by the request.void
clearAccessToken
(@NotNull ClientConnection connection, @NotNull org.apache.sling.api.resource.ResourceResolver resolver) Clears the access token for the given connection and user, as identified by the resource resolver@NotNull OAuthTokenResponse
getAccessToken
(@NotNull ClientConnection connection, @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull String redirectPath) Retrieves an existing access, valid, access token from storage.
-
Method Details
-
getAccessToken
@NotNull @NotNull OAuthTokenResponse getAccessToken(@NotNull @NotNull ClientConnection connection, @NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull 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 forrequest
- the request used to determine the current user for which to retrieve the token and to build the redirect URLredirectPath
- the path to redirect to after completing the OAuth flow- Returns:
- the token response
-
clearAccessToken
@NotNull @NotNull OAuthTokenResponse clearAccessToken(@NotNull @NotNull ClientConnection connection, @NotNull @NotNull org.apache.sling.api.SlingHttpServletRequest request, @NotNull @NotNull 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 forrequest
- the request used to determine the current user for which to retrieve the token and to build the redirect URLredirectPath
- the path to redirect to after completing the OAuth flow- Returns:
- the token response
-
clearAccessToken
void clearAccessToken(@NotNull @NotNull ClientConnection connection, @NotNull @NotNull org.apache.sling.api.resource.ResourceResolver resolver) Clears the access token for the given connection and user, as identified by the resource resolverFor 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 forresolver
- used to determine the current user for which to retrieve the token
-