Class OAuthAccessToken

java.lang.Object
eu.webtoolkit.jwt.auth.OAuthAccessToken

public class OAuthAccessToken
extends java.lang.Object
An OAuth access token.

A access token is the result of an authorization process, and encapsulates the authorization to access protected information.

Next to its getValue(), it also contains optionally an expires date and a refresh token.

See Also:
OAuthProcess.startAuthorize(), OAuthProcess.authorized()
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static OAuthAccessToken Invalid
    An invalid token constant.
  • Constructor Summary

    Constructors 
    Constructor Description
    OAuthAccessToken()
    Default constructor.
    OAuthAccessToken​(java.lang.String accessToken, WDate expires, java.lang.String refreshToken)
    Constructor.
    OAuthAccessToken​(java.lang.String accessToken, WDate expires, java.lang.String refreshToken, java.lang.String idToken)
    Constructor with an OpenID Connect ID token.
  • Method Summary

    Modifier and Type Method Description
    WDate expires()
    Returns the token expires time (if available).
    java.lang.String getIdToken()  
    java.lang.String getRefreshToken()
    Returns the refresh token (if available).
    java.lang.String getValue()
    Returns the access token value.
    boolean isValid()
    Returns whether the token is valid.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • OAuthAccessToken

      public OAuthAccessToken()
      Default constructor.

      Creates an invalid access token.

    • OAuthAccessToken

      public OAuthAccessToken​(java.lang.String accessToken, WDate expires, java.lang.String refreshToken)
      Constructor.
    • OAuthAccessToken

      public OAuthAccessToken​(java.lang.String accessToken, WDate expires, java.lang.String refreshToken, java.lang.String idToken)
      Constructor with an OpenID Connect ID token.
  • Method Details

    • isValid

      public boolean isValid()
      Returns whether the token is valid.

      An invalid access token is used to signal for example that the user denied the authorization request.

    • getValue

      public java.lang.String getValue()
      Returns the access token value.

      This value can be used to access protected resources.

    • expires

      public WDate expires()
      Returns the token expires time (if available).

      Returns null if not available.

    • getRefreshToken

      public java.lang.String getRefreshToken()
      Returns the refresh token (if available).

      The refresh token is an optional token that can be used when the access token has expired.

      If not available, returns an empty string.

    • getIdToken

      public java.lang.String getIdToken()