public class TokenCreateResponse extends ApiResponse
/auth/token/create API.
Authlete's /auth/token/create API returns JSON which can
be mapped to this class. The first step that a caller should take is
to retrieve the value of action parameter from the response.
The list below shows possible values of action parameter and
their meanings.
INTERNAL_SERVER_ERRORWhen the value of
actionparameter is"INTERNAL_SERVER_ERROR", it means that an error occurred on Authlete side.BAD_REQUESTWhen the value of
actionparameter is"BAD_REQUEST", it means that the request from the caller was wrong. For example, this happens when thegrantTyperequest parameter is not specified.FORBIDDENWhen the value of
actionparameter is"FORBIDDEN", it means that the request from the caller is not allowed. For example, this happens when the client application identified by theclientIdrequest parameter does not belong to the service identified by the API key used for the API call.OKWhen the value of
actionparameter is"OK", it means that everything was processed successfully and an access token and optionally a refresh token were issued.
So, in short, when the value of action parameter in the response
from Authlete's /auth/token/create API is "OK", you can
find a new access token and optionally a new refresh token in accessToken parameter and refreshToken parameter.
| Modifier and Type | Class and Description |
|---|---|
static class |
TokenCreateResponse.Action
The code indicating how the response should be interpreted.
|
| Constructor and Description |
|---|
TokenCreateResponse() |
| Modifier and Type | Method and Description |
|---|---|
String |
getAccessToken()
Get the newly issued access token.
|
TokenCreateResponse.Action |
getAction()
Get the code indicating how the response should be interpreted.
|
long |
getClientId()
Get the client ID associated with the newly issued access token.
|
long |
getExpiresAt()
Get the date at which the newly issued access token will expire.
|
long |
getExpiresIn()
Get the duration of the newly issued access token in seconds.
|
GrantType |
getGrantType()
Get the
grant type for the newly issued
access token. |
Property[] |
getProperties()
Get the properties associated with the access token.
|
String |
getRefreshToken()
Get the newly issued refresh token.
|
String[] |
getScopes()
Get the scopes associated with the newly issued access token.
|
String |
getSubject()
Get the subject (= unique identifier) of the user associated
with the newly issued access token.
|
String |
getTokenType()
Get the token type of the access token.
|
TokenCreateResponse |
setAccessToken(String accessToken)
Set the newly issued access token.
|
TokenCreateResponse |
setAction(TokenCreateResponse.Action action)
Set the code indicating how the response should be interpreted.
|
TokenCreateResponse |
setClientId(long clientId)
Set the client ID associated with the newly issued access token.
|
TokenCreateResponse |
setExpiresAt(long expiresAt)
Set the date at which the newly issued access token will expire.
|
TokenCreateResponse |
setExpiresIn(long expiresIn)
Set the duration of the newly issued access token in seconds.
|
TokenCreateResponse |
setGrantType(GrantType grantType)
Set the
grant type for the newly issued
access token. |
TokenCreateResponse |
setProperties(Property[] properties)
Set the properties associated with the access token.
|
TokenCreateResponse |
setRefreshToken(String refreshToken)
Set the newly issued refresh token.
|
TokenCreateResponse |
setScopes(String[] scopes)
Set the scopes associated with the newly issued access token.
|
TokenCreateResponse |
setSubject(String subject)
Set the subject (= unique identifier) of the user associated
with the newly issued access token.
|
TokenCreateResponse |
setTokenType(String tokenType)
Set the token type of the access token.
|
String |
summarize()
Get the summary of this instance.
|
getResultCode, getResultMessage, setResultCode, setResultMessagepublic TokenCreateResponse.Action getAction()
description of this class
for details.public TokenCreateResponse setAction(TokenCreateResponse.Action action)
description of this class
for details.action - The code indicating how the response should be interpreted.this object.public GrantType getGrantType()
grant type for the newly issued
access token.public TokenCreateResponse setGrantType(GrantType grantType)
grant type for the newly issued
access token.grantType - Grant type.this object.public long getClientId()
public TokenCreateResponse setClientId(long clientId)
clientId - Client ID.this object.public String getSubject()
null
when the grant type obtained by getGrantType() is CLIENT_CREDENTIALS.public TokenCreateResponse setSubject(String subject)
subject - The subject of the user.this object.public String[] getScopes()
null.public TokenCreateResponse setScopes(String[] scopes)
scopes - Scopes.this object.public String getAccessToken()
public TokenCreateResponse setAccessToken(String accessToken)
accessToken - Access token.this object.public String getTokenType()
"Bearer".public TokenCreateResponse setTokenType(String tokenType)
"Bearer".tokenType - Token type.this object.public long getExpiresIn()
public TokenCreateResponse setExpiresIn(long expiresIn)
expiresIn - The duration of the access token.this object.public long getExpiresAt()
public TokenCreateResponse setExpiresAt(long expiresAt)
expiresAt - The date at which the newly issued access token will expire.
The value is required to be expressed in milliseconds since
Unix epoch (1970-01-01).this object.public String getRefreshToken()
null when the grant type is
either IMPLICIT or CLIENT_CREDENTIALS.public TokenCreateResponse setRefreshToken(String refreshToken)
refreshToken - Refresh token.this object.public Property[] getProperties()
public TokenCreateResponse setProperties(Property[] properties)
properties - Properties.this object.public String summarize()
Copyright © 2017. All rights reserved.