Package com.smartcar.sdk.data
Class Auth
- java.lang.Object
-
- com.smartcar.sdk.data.ApiData
-
- com.smartcar.sdk.data.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.
-
-
-
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 tokenrefreshToken
- the refresh tokenexpiration
- the access token expiration timestamprefreshExpiration
- 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
-
-