Class OAuthTokenCredential


  • public final class OAuthTokenCredential
    extends Credential
    Encapsulates a credential created from the OAuth workflow. Allows access to the token, and to be passed to various objects to provide authentication against token secured resources.
    Since:
    100.0.0
    • Method Detail

      • getAccessToken

        public String getAccessToken()
        Returns the access token used to authenticate against token secured services.
        Returns:
        the access token
        Since:
        100.0.0
      • getExpiresIn

        public long getExpiresIn()
        Returns the amount of time (in seconds) from the point of creation that the access token expires.
        Returns:
        the time from creation in which the access token will expire
        Since:
        100.0.0
      • getUsername

        public String getUsername()
        Returns the username of the user that provided credentials during the OAuth authorization workflow.
        Overrides:
        getUsername in class Credential
        Returns:
        the username of the OAuth user
        Since:
        100.0.0
      • getExpiration

        public Calendar getExpiration()
        Returns the expiration time of the access token. This is simply the timestamp at the creation of the credential plus the returned "expiresIn".
        Returns:
        the expiration time of this credential's access token
        Since:
        100.0.0
      • refreshTokenAsync

        public ListenableFuture<String> refreshTokenAsync()
        Asynchronously refreshes the access token on this OAuthTokenCredential.
        Returns:
        a ListenableFuture for tracking when the computation is done and getting the resulting new access token
        Since:
        100.0.0
      • copy

        public OAuthTokenCredential copy()
        Creates a deep copy of this OAuthTokenCredential instance.
        Specified by:
        copy in class Credential
        Returns:
        a deep copy of this OAuthTokenCredential instance
        Since:
        100.1.0