Class TokenUpdateRequest
- java.lang.Object
-
- com.authlete.common.dto.TokenUpdateRequest
-
- All Implemented Interfaces:
Serializable
public class TokenUpdateRequest extends Object implements Serializable
Request to Authlete's/auth/token/updateAPI.The API is used to update an existing access token.
accessToken-
An existing access token.
accessTokenExpiresAt-
A new date at which the access token will expire in milliseconds since the Unix epoch (1970-01-01). If the
accessTokenExpiresAtrequest parameter is not included in a request or its value is 0 (or negative), the expiration date of the access token is not changed. scopes-
A new set of scopes assigned to the access token. Scopes that are not supported by the service and those that the client application associated with the access token is not allowed to request are ignored on the server side. If the
scopesrequest parameter is not included in a request or its value isnull, the scopes of the access token are not changed. properties-
A new set of properties assigned to the access token. If the
propertiesrequest parameter is not included in a request or its value isnull, the properties of the access token are not changed. accessTokenExpiresAtUpdatedOnScopeUpdate-
A boolean request parameter which indicates whether the API attempts to update the expiration date of the access token when the scopes linked to the access token are changed by this request. The default value is
false. For more details, see the description ofsetAccessTokenExpiresAtUpdatedOnScopeUpdate(boolean). accessTokenHash-
The hash of the access token value. Used when the hash of the token is known (perhaps from lookup) but the value of the token itself is not.
The value of the
accessTokenparameter takes precedence. accessTokenValueUpdated-
A boolean request parameter which indicates whether to update the value of the access token in the data store. If this parameter is set to
truethen a new access token value is generated by the server and returned in the response. The default value isfalseand the access token's previous value is retained. certificateThumbprint(OPTIONAL)-
The thumbprint of the MTLS certificate bound to this token. If this field is set, a certificate with the corresponding value MUST be presented with the access token when it is used by a client.
dpopKeyThumbprint(OPTIONAL)-
The thumbprint of the public key used for DPoP presentation of this token. If this field is set, a DPoP proof signed with the corresponding private key MUST be presented with the access token when it is used by a client. Additionally, the token's
token_typewill be set to 'DPoP'. authorizationDetails(OPTIONAL)-
The value of the
authorization_detailsto associate with the token. If this value isnull, the authorization details will not be changed. If this value is set, it will completely replace the authorization details previously set on the token. forExternalAttachment(OPTIONAL)-
A boolean flag which indicates whether the access token is for an external attachment. See External Attachments of OpenID Connect for Identity Assurance 1.0 for details about external attachments.
- Since:
- 1.34
- See Also:
TokenUpdateResponse, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TokenUpdateRequest()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccessToken()Get the access token to update.longgetAccessTokenExpiresAt()Get the new date at which the access token will expire.StringgetAccessTokenHash()Get the hash of the access token value.AuthzDetailsgetAuthorizationDetails()Get the authorization details.StringgetCertificateThumbprint()Get the thumbprint of the MTLS certificate bound to this token.StringgetDpopKeyThumbprint()Get the thumbprint of the public key used for DPoP presentation of this token.Property[]getProperties()Get a new set of properties assigned to the access token.longgetRefreshTokenExpiresAt()Get the new date at which the refresh token will expire.String[]getScopes()Get the new set of scopes assigned to the access token.StringgetTokenId()Get the token identifier.booleanisAccessTokenExpiresAtUpdatedOnScopeUpdate()Get the flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the access token when the scopes linked to the access token are changed by this request.booleanisAccessTokenPersistent()Get whether the access token expires or not.booleanisAccessTokenValueUpdated()Get whether to update the value of the access token in the data store.booleanisForExternalAttachment()Get the flag which indicates whether the access token is for an external attachment.booleanisRefreshTokenExpiresAtUpdatedOnScopeUpdate()Get the flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the refresh token when the scopes linked to the refresh token are changed by this request.TokenUpdateRequestsetAccessToken(String accessToken)Set an existing access token to update.TokenUpdateRequestsetAccessTokenExpiresAt(long expiresAt)Set the new date at which the access token will expire.TokenUpdateRequestsetAccessTokenExpiresAtUpdatedOnScopeUpdate(boolean updated)Set the flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the access token when the scopes linked to the access token are changed by this request.TokenUpdateRequestsetAccessTokenHash(String accessTokenHash)Set the hash of the access token value.TokenUpdateRequestsetAccessTokenPersistent(boolean persistent)Set whether the access token expires or not.TokenUpdateRequestsetAccessTokenValueUpdated(boolean updated)Set whether to update the value of the access token in the data store.TokenUpdateRequestsetAuthorizationDetails(AuthzDetails authorizationDetails)Set the authorization details.TokenUpdateRequestsetCertificateThumbprint(String certificateThumbprint)Set the thumbprint of the MTLS certificate bound to this token.TokenUpdateRequestsetDpopKeyThumbprint(String dpopKeyThumbprint)Set the thumbprint of the public key used for DPoP presentation of this token.TokenUpdateRequestsetForExternalAttachment(boolean forExternalAttachment)Set the flag which indicates whether the access token is for an external attachment.TokenUpdateRequestsetProperties(Property[] properties)Set a new set of properties assigned to the access token.TokenUpdateRequestsetRefreshTokenExpiresAt(long expiresAt)Set the new date at which the refresh token will expire.TokenUpdateRequestsetRefreshTokenExpiresAtUpdatedOnScopeUpdate(boolean updated)Set the flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the refresh token when the scopes linked to the refresh token are changed by this request.TokenUpdateRequestsetScopes(String[] scopes)Set a new set of scopes assigned to the access token.TokenUpdateRequestsetTokenId(String tokenId)Set the token identifier.
-
-
-
Method Detail
-
getAccessToken
public String getAccessToken()
Get the access token to update.- Returns:
- The access token to update.
-
setAccessToken
public TokenUpdateRequest setAccessToken(String accessToken)
Set an existing access token to update.- Parameters:
accessToken- An existing access token to update.- Returns:
thisobject.
-
getAccessTokenExpiresAt
public long getAccessTokenExpiresAt()
Get the new date at which the access token will expire.- Returns:
- The new expiration date in milliseconds since the Unix epoch (1970-01-01).
-
setAccessTokenExpiresAt
public TokenUpdateRequest setAccessTokenExpiresAt(long expiresAt)
Set the new date at which the access token will expire.If 0 or a negative value is given, the expiration date of the access token is not changed.
- Parameters:
expiresAt- The new expiration date in milliseconds since the Unix epoch (1970-01-01).- Returns:
thisobject.
-
getRefreshTokenExpiresAt
public long getRefreshTokenExpiresAt()
Get the new date at which the refresh token will expire.- Returns:
- The new expiration date in milliseconds since the Unix epoch (1970-01-01).
- Since:
- 3.84
-
setRefreshTokenExpiresAt
public TokenUpdateRequest setRefreshTokenExpiresAt(long expiresAt)
Set the new date at which the refresh token will expire.If 0 or a negative value is given, the expiration date of the refresh token is not changed.
- Parameters:
expiresAt- The new expiration date in milliseconds since the Unix epoch (1970-01-01).- Returns:
thisobject.- Since:
- 3.84
-
getScopes
public String[] getScopes()
Get the new set of scopes assigned to the access token.- Returns:
- The new set of scopes.
-
setScopes
public TokenUpdateRequest setScopes(String[] scopes)
Set a new set of scopes assigned to the access token.If
nullis given, the scope set associated with the access token is not changed.- Parameters:
scopes- A new set of scopes.nullmeans that scopes are not changed.- Returns:
thisobject.
-
getProperties
public Property[] getProperties()
Get a new set of properties assigned to the access token.- Returns:
- A new set of properties.
-
setProperties
public TokenUpdateRequest setProperties(Property[] properties)
Set a new set of properties assigned to the access token.If
nullis given, the property set associated with the access token is not changed.- Parameters:
properties- A new set of properties.nullmeans that properties are not changed.- Returns:
thisobject.
-
isAccessTokenExpiresAtUpdatedOnScopeUpdate
public boolean isAccessTokenExpiresAtUpdatedOnScopeUpdate()
Get the flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the access token when the scopes linked to the access token are changed by this request.- Returns:
- The flag which indicates whether
/auth/token/updateAPI attempts to update the expiration date of the access token when the scopes linked to the access token are changed by this request. - Since:
- 2.29
-
setAccessTokenExpiresAtUpdatedOnScopeUpdate
public TokenUpdateRequest setAccessTokenExpiresAtUpdatedOnScopeUpdate(boolean updated)
Set the flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the access token when the scopes linked to the access token are changed by this request. This request parameter is optional and its default value isfalse. If this request parameter is set totrueand all of the following conditions are satisfied, the API performs an update on the expiration date of the access token even if theaccessTokenExpiresAtrequest parameter is not explicitly specified in the request.- The
accessTokenExpiresAtrequest parameter is not included in the request or its value is0(or negative). - The scopes linked to the access token are changed by the
scopesrequest parameter in the request. - Any of the new scopes to be linked to the access token has one or more attributes specifying access token duration.
When multiple access token duration values are found in the attributes of the specified scopes, the smallest value among them is used.
For more details, see the following examples.
Example 1.
Let's say we send the following request to
/auth/token/updateAPI{ "accessToken" : "JDGiiM9PuWT63FIwGjG9eYlGi-aZMq6CQ2IB475JUxs", "scopes" : ["read_profile"] }and
"read_profile"has the following attributes.{ "key" : "access_token.duration", "value" : "10000" }In this case, the API evaluates
Example 2."10000"as a new value of the duration of the access token (in seconds) and updates the expiration date of the access token using the duration.Let's say we send the following request to
/auth/token/updateAPI{ "accessToken" : "JDGiiM9PuWT63FIwGjG9eYlGi-aZMq6CQ2IB475JUxs", "scopes" : ["read_profile", "write_profile"] }and
"read_profile"has the following attributes{ "key" : "access_token.duration", "value" : "10000" }and
"write_profile"has the following attributes.{ "key" : "access_token.duration", "value" : "5000" }In this case, the API evaluates
"10000"and"5000"as candidate values for new duration of the access token (in seconds) and chooses the smallest value of them (i.e. "5000" is adopted) and updates the expiration date of the access token using the duration.- Parameters:
updated- The flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the access token when the scopes linked to the access token are changed by this request.- Returns:
thisobject.- Since:
- 2.29
- The
-
isRefreshTokenExpiresAtUpdatedOnScopeUpdate
public boolean isRefreshTokenExpiresAtUpdatedOnScopeUpdate()
Get the flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the refresh token when the scopes linked to the refresh token are changed by this request.- Returns:
- The flag which indicates whether
/auth/token/updateAPI attempts to update the expiration date of the refresh token when the scopes linked to the refresh token are changed by this request. - Since:
- 3.85
-
setRefreshTokenExpiresAtUpdatedOnScopeUpdate
public TokenUpdateRequest setRefreshTokenExpiresAtUpdatedOnScopeUpdate(boolean updated)
Set the flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the refresh token when the scopes linked to the refresh token are changed by this request. This request parameter is optional and its default value isfalse. If this request parameter is set totrueand all of the following conditions are satisfied, the API performs an update on the expiration date of the refresh token even if therefreshTokenExpiresAtrequest parameter is not explicitly specified in the request.- The
refreshTokenExpiresAtrequest parameter is not included in the request or its value is0(or negative). - The scopes linked to the refresh token are changed by the
scopesrequest parameter in the request. - Any of the new scopes to be linked to the refresh token has one or more attributes specifying refresh token duration.
When multiple refresh token duration values are found in the attributes of the specified scopes, the smallest value among them is used.
For more details, see the following examples.
Example 1.
Let's say we send the following request to
/auth/token/updateAPI{ "refreshToken" : "JDGiiM9PuWT63FIwGjG9eYlGi-aZMq6CQ2IB475JUxs", "scopes" : ["read_profile"] }and
"read_profile"has the following attributes.{ "key" : "refresh_token.duration", "value" : "10000" }In this case, the API evaluates
Example 2."10000"as a new value of the duration of the refresh token (in seconds) and updates the expiration date of the refresh token using the duration.Let's say we send the following request to
/auth/token/updateAPI{ "refreshToken" : "JDGiiM9PuWT63FIwGjG9eYlGi-aZMq6CQ2IB475JUxs", "scopes" : ["read_profile", "write_profile"] }and
"read_profile"has the following attributes{ "key" : "refresh_token.duration", "value" : "10000" }and
"write_profile"has the following attributes.{ "key" : "refresh_token.duration", "value" : "5000" }In this case, the API evaluates
"10000"and"5000"as candidate values for new duration of the refresh token (in seconds) and chooses the smallest value of them (i.e. "5000" is adopted) and updates the expiration date of the refresh token using the duration.- Parameters:
updated- The flag which indicates whether/auth/token/updateAPI attempts to update the expiration date of the refresh token when the scopes linked to the refresh token are changed by this request.- Returns:
thisobject.- Since:
- 3.85
- The
-
isAccessTokenPersistent
public boolean isAccessTokenPersistent()
Get whether the access token expires or not. By default, all access tokens expire after a period of time determined by their service. If this request parameter istruethen the access token will not automatically expire and must be revoked or deleted manually at the service.If this request parameter is
true, theaccessTokenExpiresAtrequest parameter is ignored. If this request parameter isfalse, theaccessTokenExpiresAtrequest parameter is processed normally.- Returns:
falseif the access token expires (default).trueif the access token does not expire.- Since:
- 2.30
-
setAccessTokenPersistent
public TokenUpdateRequest setAccessTokenPersistent(boolean persistent)
Set whether the access token expires or not. By default, all access tokens expire after a period of time determined by their service. If this request parameter istruethen the access token will not automatically expire and must be revoked or deleted manually at the service.If this request parameter is
true, theaccessTokenExpiresAtrequest parameter is ignored. If this request parameter isfalse, theaccessTokenExpiresAtrequest parameter is processed normally.- Parameters:
persistent-falseto make the access token expire (default).trueto make the access token be persistent.- Returns:
thisobject.- Since:
- 2.30
-
getAccessTokenHash
public String getAccessTokenHash()
Get the hash of the access token value. Used when the hash of the token is known (perhaps from lookup) but the value of the token itself is not.The value of the
accessTokenparameter takes precedence.- Returns:
- The hash of the access token value.
- Since:
- 2.31
-
setAccessTokenHash
public TokenUpdateRequest setAccessTokenHash(String accessTokenHash)
Set the hash of the access token value. Used when the hash of the token is known (perhaps from lookup) but the value of the token itself is not.The value of the
accessTokenparameter takes precedence.- Parameters:
accessTokenHash- The hash of the access token value.- Returns:
thisobject.- Since:
- 2.31
-
isAccessTokenValueUpdated
public boolean isAccessTokenValueUpdated()
Get whether to update the value of the access token in the data store. If this parameter is set totruethen a new access token value is generated by the server and returned in the response.- Returns:
falseto keep the access token's current value (default).trueto have the server update the access token's value.- Since:
- 2.31
-
setAccessTokenValueUpdated
public TokenUpdateRequest setAccessTokenValueUpdated(boolean updated)
Set whether to update the value of the access token in the data store. If this parameter is set totruethen a new access token value is generated by the server and returned in the response.- Parameters:
updated-falseto keep the access token's current value (default).trueto have the server update the access token's value.- Returns:
thisobject.- Since:
- 2.31
-
getCertificateThumbprint
public String getCertificateThumbprint()
Get the thumbprint of the MTLS certificate bound to this token. If this field is set, a certificate with the corresponding value MUST be presented with the access token when it is used by a client.- Returns:
- The SHA256 certificate thumbprint, base64url encoded.
- Since:
- 2.72
-
setCertificateThumbprint
public TokenUpdateRequest setCertificateThumbprint(String certificateThumbprint)
Set the thumbprint of the MTLS certificate bound to this token. If this field is set, a certificate with the corresponding value MUST be presented with the access token when it is used by a client.- Parameters:
certificateThumbprint- The SHA256 certificate thumbprint, base64url encoded.- Returns:
thisobject.- Since:
- 2.72
-
getDpopKeyThumbprint
public String getDpopKeyThumbprint()
Get the thumbprint of the public key used for DPoP presentation of this token. If this field is set, a DPoP proof signed with the corresponding private key MUST be presented with the access token when it is used by a client. Additionally, the token'stoken_typewill be set to 'DPoP'.- Returns:
- The JWK public key thumbprint.
- Since:
- 2.72
-
setDpopKeyThumbprint
public TokenUpdateRequest setDpopKeyThumbprint(String dpopKeyThumbprint)
Set the thumbprint of the public key used for DPoP presentation of this token. If this field is set, a DPoP proof signed with the corresponding private key MUST be presented with the access token when it is used by a client. Additionally, the token'stoken_typewill be set to 'DPoP'.- Parameters:
dpopKeyThumbprint- The JWK public key thumbprint.- Returns:
thisobject.- Since:
- 2.72
-
getAuthorizationDetails
public AuthzDetails getAuthorizationDetails()
Get the authorization details. This represents the value of the"authorization_details"request parameter which is defined in "OAuth 2.0 Rich Authorization Requests".- Returns:
- Authorization details.
- Since:
- 2.99
-
setAuthorizationDetails
public TokenUpdateRequest setAuthorizationDetails(AuthzDetails authorizationDetails)
Set the authorization details. This represents the value of the"authorization_details"request parameter which is defined in "OAuth 2.0 Rich Authorization Requests".- Parameters:
authorizationDetails- Authorization details.- Returns:
thisobject.- Since:
- 2.99
-
isForExternalAttachment
public boolean isForExternalAttachment()
Get the flag which indicates whether the access token is for an external attachment.- Returns:
trueif the access token is for an external attachment.- Since:
- 3.16
- See Also:
- OpenID Connect for Identity Assurance 1.0, External Attachments
-
setForExternalAttachment
public TokenUpdateRequest setForExternalAttachment(boolean forExternalAttachment)
Set the flag which indicates whether the access token is for an external attachment.- Parameters:
forExternalAttachment-trueto indicate that the access token is for an external attachment.- Returns:
thisobject.- Since:
- 3.16
- See Also:
- OpenID Connect for Identity Assurance 1.0, External Attachments
-
getTokenId
public String getTokenId()
Get the token identifier.- Returns:
- The token identifier string.
- Since:
- 3.23, Authlete API 3.0
-
setTokenId
public TokenUpdateRequest setTokenId(String tokenId)
Set the token identifier.- Parameters:
tokenId- The token identifier string.- Returns:
thisobject.- Since:
- 3.23, Authlete API 3.0
-
-