Package org.openhab.core.auth
Class PendingToken
java.lang.Object
org.openhab.core.auth.PendingToken
The pending information used in an OAuth2 authorization flow, set after the user has authorized the client to access
resources, and has been redirected to the callback URI with an authorization code. The information will be used when
it calls the token endpoint to exchange the authorization code for an access token and a refresh token.
The authorization code for a token is sensible information while it is valid, therefore the client is supposed to
call the token endpoint to perform the exchange it immediately after receiving it. The information should remain in
the @link
ManagedUser
profile for a limited time only.
Additionally, and optionally, information about the code challenge as specified by PKCE (RFC 7636) can be stored
along with the code.- Author:
- Yannick Schaus - initial contribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the authorization code provided to the client.Gets the ID of the client requesting the upcoming token.@Nullable String
Gets the code challenge@Nullable String
Gets the code challenge methodGets the redirect URI of the client requesting the upcoming token.getScope()
Gets the requested scopes for the upcoming token.
-
Constructor Details
-
PendingToken
public PendingToken(String authorizationCode, String clientId, String redirectUri, String scope, @Nullable String codeChallenge, @Nullable String codeChallengeMethod) Constructs a pending token.- Parameters:
authorizationCode
- the authorization code provided to the clientclientId
- the client ID making the requestredirectUri
- the provided redirect URIscope
- the requested scopescodeChallenge
- the code challenge (optional)codeChallengeMethod
- the code challenge method (optional)
-
-
Method Details
-
getAuthorizationCode
Gets the authorization code provided to the client.- Returns:
- the authorization code
-
getClientId
Gets the ID of the client requesting the upcoming token.- Returns:
- the client ID
-
getRedirectUri
Gets the redirect URI of the client requesting the upcoming token.- Returns:
- the redirect URI
-
getScope
Gets the requested scopes for the upcoming token.- Returns:
- the requested scopes
-
getCodeChallenge
Gets the code challenge- Returns:
- the code challenge
-
getCodeChallengeMethod
Gets the code challenge method- Returns:
- the code challenge method
-