Package com.authlete.common.dto
Class AccessToken
- java.lang.Object
-
- com.authlete.common.dto.AccessToken
-
- All Implemented Interfaces:
Serializable
public class AccessToken extends Object implements Serializable
Information about an access token.- Since:
- 2.22
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AccessToken()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAccessTokenExpiresAt()Get the timestamp at which the access token will expire.StringgetAccessTokenHash()Get the hash of the access token.longgetClientId()Get the ID of the client associated with the access token.longgetCreatedAt()Get the timestamp at which the access token was first created.GrantTypegetGrantType()Get the grant type of the access token when the access token was created.longgetLastRefreshedAt()Get the timestamp at which the access token was last refreshed using the refresh token.Property[]getProperties()Get the properties associated with the access token.longgetRefreshTokenExpiresAt()Get the timestamp at which the refresh token will expire.StringgetRefreshTokenHash()Get the hash of the refresh token.String[]getRefreshTokenScopes()Get the scopes associated with the refresh token.String[]getScopes()Get the scopes associated with the access token.StringgetSubject()Get the subject (= unique user ID) associated with the access token.AccessTokensetAccessTokenExpiresAt(long expiresAt)Set the timestamp at which the access token will expire.AccessTokensetAccessTokenHash(String hash)Set the hash of the access token.AccessTokensetClientId(long clientId)Set the ID of the client associated with the access token.AccessTokensetCreatedAt(long createdAt)Set the timestamp at which the access token was first created.AccessTokensetGrantType(GrantType grantType)Set the grant type of the access token when the access token was created.AccessTokensetLastRefreshedAt(long lastRefreshedAt)Set the timestamp at which the access token was last refreshed using the refresh token.AccessTokensetProperties(Property[] properties)Set the properties associated with the access token.AccessTokensetRefreshTokenExpiresAt(long expiresAt)Set the timestamp at which the refresh token will expire.AccessTokensetRefreshTokenHash(String hash)Set the hash of the refresh token.AccessTokensetRefreshTokenScopes(String[] refreshTokenScopes)Set the scopes associated with the refresh token.AccessTokensetScopes(String[] scopes)Set the scopes associated with the access token.AccessTokensetSubject(String subject)Set the subject (= unique user ID) associated with the access token.
-
-
-
Method Detail
-
getAccessTokenHash
public String getAccessTokenHash()
Get the hash of the access token.- Returns:
- The hash of the access token.
-
setAccessTokenHash
public AccessToken setAccessTokenHash(String hash)
Set the hash of the access token.- Parameters:
hash- The hash of the access token.- Returns:
thisobject.
-
getRefreshTokenHash
public String getRefreshTokenHash()
Get the hash of the refresh token.nullmay be returned.- Returns:
- The hash of the refresh token or
null.
-
setRefreshTokenHash
public AccessToken setRefreshTokenHash(String hash)
Set the hash of the refresh token.- Parameters:
hash- The hash of the refresh token.- Returns:
thisobject.
-
getClientId
public long getClientId()
Get the ID of the client associated with the access token.- Returns:
- The ID of the client associated with the access token.
-
setClientId
public AccessToken setClientId(long clientId)
Set the ID of the client associated with the access token.- Parameters:
clientId- The ID of the client associated with the access token.- Returns:
thisobject.
-
getSubject
public String getSubject()
Get the subject (= unique user ID) associated with the access token.nullis returned if the access token was created using the Client Credentials flow.- Returns:
- The subject (= unique user ID) associated with the access token or
nullif the access token was created using the Client Credentials flow.
-
setSubject
public AccessToken setSubject(String subject)
Set the subject (= unique user ID) associated with the access token.- Parameters:
subject- The subject (= unique user ID) associated with the access token.- Returns:
thisobject.
-
getGrantType
public GrantType getGrantType()
Get the grant type of the access token when the access token was created. Note that the value of the grant type is not changed when the access token is refreshed using the refresh token.- Returns:
- The grant type of the access token when the access token was created.
-
setGrantType
public AccessToken setGrantType(GrantType grantType)
Set the grant type of the access token when the access token was created.- Parameters:
grantType- The grant type of the access token when the access token was created.- Returns:
thisobject.
-
getScopes
public String[] getScopes()
Get the scopes associated with the access token.- Returns:
- The scopes associated with the access token.
-
setScopes
public AccessToken setScopes(String[] scopes)
Set the scopes associated with the access token.- Parameters:
scopes- The scopes associated with the access token.- Returns:
thisobject.
-
getAccessTokenExpiresAt
public long getAccessTokenExpiresAt()
Get the timestamp at which the access token will expire.- Returns:
- The expiration timestamp in milliseconds since the Unix epoch (1970-01-01).
-
setAccessTokenExpiresAt
public AccessToken setAccessTokenExpiresAt(long expiresAt)
Set the timestamp at which the access token will expire.- Parameters:
expiresAt- The expiration timestamp in milliseconds since the Unix epoch (1970-01-01).- Returns:
thisobject.
-
getRefreshTokenExpiresAt
public long getRefreshTokenExpiresAt()
Get the timestamp at which the refresh token will expire.0is returned ifgetRefreshTokenHash()returnsnull.- Returns:
- The expiration timestamp in milliseconds since the Unix epoch (1970-01-01).
-
setRefreshTokenExpiresAt
public AccessToken setRefreshTokenExpiresAt(long expiresAt)
Set the timestamp at which the refresh token will expire.- Parameters:
expiresAt- The expiration timestamp in milliseconds since the Unix epoch (1970-01-01).- Returns:
thisobject.
-
getCreatedAt
public long getCreatedAt()
Get the timestamp at which the access token was first created. Note that the value of the timestamp is not changed when the access token is refreshed with the refresh token.- Returns:
- The timestamp at which the access token was first created in milliseconds since the Unix epoch (1970-01-01).
-
setCreatedAt
public AccessToken setCreatedAt(long createdAt)
Set the timestamp at which the access token was first created.- Parameters:
createdAt- The timestamp at which the access token was first created in milliseconds since the Unix epoch (1970-01-01).- Returns:
thisobject.
-
getLastRefreshedAt
public long getLastRefreshedAt()
Get the timestamp at which the access token was last refreshed using the refresh token.0is returned if it has never been refreshed.- Returns:
- The timestamp at which the access token was last refreshed using
the refreshed token in milliseconds since the Unix epoch (1970-01-01).
0is returned if it has never been refreshed.
-
setLastRefreshedAt
public AccessToken setLastRefreshedAt(long lastRefreshedAt)
Set the timestamp at which the access token was last refreshed using the refresh token.- Parameters:
lastRefreshedAt- The timestamp at which the access token was last refreshed using the refreshed token in milliseconds since the Unix epoch (1970-01-01).- Returns:
thisobject.
-
getProperties
public Property[] getProperties()
Get the properties associated with the access token.- Returns:
- The properties associated with the access token.
-
setProperties
public AccessToken setProperties(Property[] properties)
Set the properties associated with the access token.- Parameters:
properties- The properties associated with the access token.- Returns:
thisobject.
-
getRefreshTokenScopes
public String[] getRefreshTokenScopes()
Get the scopes associated with the refresh token.- Returns:
- The scopes associated with the refresh token. May be
null. - Since:
- 3.89, Authlete API 3.0
-
setRefreshTokenScopes
public AccessToken setRefreshTokenScopes(String[] refreshTokenScopes)
Set the scopes associated with the refresh token.- Parameters:
refreshTokenScopes- The scopes associated with the refresh token.- Returns:
thisobject.- Since:
- 3.89, Authlete API 3.0
-
-