Class OAuthTokenResponse
java.lang.Object
org.apache.sling.auth.oauth_client.OAuthTokenResponse
Encapsulates the response to a token request.
This class has two top-level states:
- has a valid access token:
hasValidToken()
returnstrue
, andgetTokenValue()
returns the token value. - does not have a valid access token:
hasValidToken()
returnsfalse
, andgetRedirectUri()
returns the URI to redirect the user to.
Methods generally throw IllegalStateException
if they are called in an unexpected state and do not return null values.
-
Constructor Summary
ConstructorsConstructorDescriptionOAuthTokenResponse
(Optional<String> token, ClientConnection connection, org.apache.sling.api.SlingHttpServletRequest request, String redirectPath) -
Method Summary
Modifier and TypeMethodDescriptionReturns the URI to redirect the user to in order to start the OAuth flowReturns the a valid access token value and throws anIllegalStateException
otherwiseboolean
Returns true if a valid access token is present and false otherwise
-
Constructor Details
-
OAuthTokenResponse
public OAuthTokenResponse(Optional<String> token, ClientConnection connection, org.apache.sling.api.SlingHttpServletRequest request, String redirectPath)
-
-
Method Details
-
hasValidToken
public boolean hasValidToken()Returns true if a valid access token is present and false otherwise- Returns:
- true if a valid access token is present
-
getTokenValue
Returns the a valid access token value and throws anIllegalStateException
otherwise- Returns:
- a valid access token value
- Throws:
IllegalStateException
- if no access token is present
-
getRedirectUri
Returns the URI to redirect the user to in order to start the OAuth flow- Returns:
- the URI to redirect the user to
- Throws:
IllegalStateException
- if an access token is present
-