Class Auth

  • All Implemented Interfaces:
    java.io.Serializable

    public class Auth
    extends ApiData
    A container for the authentication tokens obtained from the Smartcar OAuth 2.0 service.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Auth​(java.lang.String accessToken, java.lang.String refreshToken, java.util.Date expiration, java.util.Date refreshExpiration)
      Initializes a new instance with the specified token values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAccessToken()
      Returns the currently stored access token.
      java.util.Date getExpiration()
      Returns the expiration timestamp for the current access token.
      java.util.Date getRefreshExpiration()
      Returns the expiration timestamp for the current refresh token.
      java.lang.String getRefreshToken()
      Returns the currently stored refresh token.
      boolean isExpired()
      Determines whether or not the current auth token has expired.
      java.lang.String toString()
      Returns the stored data string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Auth

        public Auth​(java.lang.String accessToken,
                    java.lang.String refreshToken,
                    java.util.Date expiration,
                    java.util.Date refreshExpiration)
        Initializes a new instance with the specified token values.
        Parameters:
        accessToken - the access token
        refreshToken - the refresh token
        expiration - the access token expiration timestamp
        refreshExpiration - the refresh token expiration timestamp
    • Method Detail

      • isExpired

        public boolean isExpired()
        Determines whether or not the current auth token has expired.
        Returns:
        whether or not the token has expired
      • getAccessToken

        public java.lang.String getAccessToken()
        Returns the currently stored access token.
        Returns:
        the access token
      • getRefreshToken

        public java.lang.String getRefreshToken()
        Returns the currently stored refresh token.
        Returns:
        the refresh token
      • getExpiration

        public java.util.Date getExpiration()
        Returns the expiration timestamp for the current access token.
        Returns:
        the access token expiration timestamp
      • getRefreshExpiration

        public java.util.Date getRefreshExpiration()
        Returns the expiration timestamp for the current refresh token.
        Returns:
        the refresh token expiration timestamp
      • toString

        public java.lang.String toString()
        Description copied from class: ApiData
        Returns the stored data string.
        Overrides:
        toString in class ApiData
        Returns:
        a stringified representation of Auth