Class PendingToken

java.lang.Object
org.openhab.core.auth.PendingToken

@NonNullByDefault public class PendingToken extends Object
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 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 client
      clientId - the client ID making the request
      redirectUri - the provided redirect URI
      scope - the requested scopes
      codeChallenge - the code challenge (optional)
      codeChallengeMethod - the code challenge method (optional)
  • Method Details

    • getAuthorizationCode

      public String getAuthorizationCode()
      Gets the authorization code provided to the client.
      Returns:
      the authorization code
    • getClientId

      public String getClientId()
      Gets the ID of the client requesting the upcoming token.
      Returns:
      the client ID
    • getRedirectUri

      public String getRedirectUri()
      Gets the redirect URI of the client requesting the upcoming token.
      Returns:
      the redirect URI
    • getScope

      public String getScope()
      Gets the requested scopes for the upcoming token.
      Returns:
      the requested scopes
    • getCodeChallenge

      public @Nullable String getCodeChallenge()
      Gets the code challenge
      Returns:
      the code challenge
    • getCodeChallengeMethod

      public @Nullable String getCodeChallengeMethod()
      Gets the code challenge method
      Returns:
      the code challenge method