Class TokenResponse
- java.lang.Object
-
- com.authlete.common.dto.ApiResponse
-
- com.authlete.common.dto.TokenResponse
-
- All Implemented Interfaces:
Serializable
public class TokenResponse extends ApiResponse
Response from Authlete's/auth/tokenAPI.Authlete's
/auth/tokenAPI returns JSON which can be mapped to this class. The service implementation should retrieve the value of"action"from the response and take the following steps according to the value.
INVALID_CLIENTWhen the value of
"action"is"INVALID_CLIENT", it means that authentication of the client failed. In this case, the HTTP status of the response to the client application is either"400 Bad Request"or"401 Unauthorized". This requirement comes from RFC 6749, 5.2. Error Response. The description about"invalid_client"shown below is an excerpt from RFC 6749.invalid_client-
Client authentication failed (e.g., unknown client, no client authentication included, or unsupported authentication method). The authorization server MAY return an HTTP 401 (Unauthorized) status code to indicate which HTTP authentication schemes are supported. If the client attempted to authenticate via the "Authorization" request header field, the authorization server MUST respond with an HTTP 401 (Unauthorized) status code and include the "WWW-Authenticate" response header field matching the authentication scheme used by the client.
In either case, the JSON string returned by
getResponseContent()can be used as the entity body of the response to the client application.The following illustrate the response which the service implementation should generate and return to the client application.
HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache (The value returned from
getResponseContent())HTTP/1.1 401 Unauthorized WWW-Authenticate: (challenge) Content-Type: application/json Cache-Control: no-store Pragma: no-cache (The value returned from
getResponseContent())
INTERNAL_SERVER_ERRORWhen the value of
"action"is"INTERNAL_SERVER_ERROR", it means that the request from the service implementation (AuthorizationIssueRequest) was wrong or that an error occurred in Authlete.In either case, from the viewpoint of the client application, it is an error on the server side. Therefore, the service implementation should generate a response to the client application with the HTTP status of
"500 Internal Server Error".getResponseContent()returns a JSON string which describes the error, so it can be used as the entity body of the response.The following illustrates the response which the service implementation should generate and return to the client application.
HTTP/1.1 500 Internal Server Error Content-Type: application/json Cache-Control: no-store Pragma: no-cache (The value returned from
getResponseContent())
BAD_REQUESTWhen the value of
"action"is"BAD_REQUEST", it means that the request from the client application is invalid.The HTTP status of the response returned to the client application must be
"400 Bad Request"and the content type must be"application/json".getResponseContent()returns a JSON string which describes the error, so it can be used as the entity body of the response.The following illustrates the response which the service implementation should generate and return to the client application.
HTTP/1.1 400 Bad Request Content-Type: application/json Cache-Control: no-store Pragma: no-cache (The value returned from
getResponseContent())
PASSWORDWhen the value of
"action"is"PASSWORD", it means that the request from the client application is valid andgrant_typeis"password". That is, the flow is "Resource Owner Password Credentials".In this case,
getUsername()returns the value of"username"request parameter andgetPassword()returns the value of"password"request parameter which were contained in the token request from the client application. The service implementation must validate the credentials of the resource owner (= end-user) and take either of the actions below according to the validation result.-
When the credentials are valid, call Authlete's
/auth/token/issueAPI to generate an access token for the client application. The API requires"ticket"request parameter and"subject"request parameter. Use the value returned fromgetTicket()method as the value for"ticket"parameter.The response from
/auth/token/issueAPI (TokenIssueResponse) contains data (an access token and others) which should be returned to the client application. Use the data to generate a response to the client application. -
When the credentials are invalid, call Authlete's
/auth/token/failAPI withreason=INVALID_RESOURCE_OWNER_CREDENTIALSto generate an error response for the client application. The API requires"ticket"request parameter. Use the value returned fromgetTicket()method as the value for"ticket"parameter.The response from
/auth/token/failAPI (TokenFailResponse) contains error information which should be returned to the client application. Use it to generate a response to the client application.
OKWhen the value of
"action"is"OK", it means that the request from the client application is valid and an access token, and optionally an ID token, is ready to be issued.The HTTP status of the response returned to the client application must be
"200 OK"and the content type must be"application/json".getResponseContent()returns a JSON string which contains an access token (and optionally an ID token), so it can be used as the entity body of the response.The following illustrates the response which the service implementation should generate and return to the client application.
HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-store Pragma: no-cache (The value returned from
getResponseContent())
TOKEN_EXCHANGE(Authlete 2.3 onwards)When the value of
"action"is"TOKEN_EXCHANGE", it means that the request from the client application is a valid token exchange request (cf. RFC 8693 OAuth 2.0 Token Exchange) and that the request has already passed the following validation steps.-
Confirm that the value of the
requested_token_typerequest parameter is one of the registered token type identifiers if the request parameter is given and its value is not empty. -
Confirm that the
subject_tokenrequest parameter is given and its value is not empty. -
Confirm that the
subject_token_typerequest parameter is given and its value is one of the registered token type identifiers. -
Confirm that the
actor_token_typerequest parameter is given and its value is one of the registered token type identifiers if theactor_tokenrequest parameter is given and its value is not empty. -
Confirm that the
actor_token_typerequest parameter is not given or its value is empty when theactor_tokenrequest parameter is not given or its value is empty.
Furthermore, Authlete performs additional validation on the tokens specified by the
subject_tokenrequest parameter and theactor_tokenrequest parameter according to their respective token types as shown below.Token Validation Steps Token Type urn:ietf:params:oauth:token-type:jwt-
Confirm that the format conforms to the JWT specification (RFC 7519).
-
Check if the JWT is encrypted and if it is encrypted, then (a) reject the token exchange request when the
tokenExchangeEncryptedJwtRejectedflag of the service istrueor (b) skip remaining validation steps when the flag isfalse. Note that Authlete does not verify an encrypted JWT because there is no standard way to obtain the key to decrypt the JWT with. This means that you must verify an encrypted JWT by yourself when one is used as an input token with the token type"urn:ietf:params:oauth:token-type:jwt". -
Confirm that the current time has not reached the time indicated by the
expclaim if the JWT contains the claim. -
Confirm that the current time is equal to or after the time indicated by the
iatclaim if the JWT contains the claim. -
Confirm that the current time is equal to or after the time indicated by the
nbfclaim if the JWT contains the claim. -
Check if the JWT is signed and if it is not signed, then (a) reject the token exchange request when the
tokenExchangeUnsignedJwtRejectedflag of the service istrueor (b) finish validation on the input token. Note that Authlete does not verify the signature of the JWT because there is no standard way to obtain the key to verify the signature of a JWT with. This means that you must verify the signature by yourself when a signed JWT is used as an input token with the token type"urn:ietf:params:oauth:token-type:jwt".
Token Type urn:ietf:params:oauth:token-type:access_token-
Confirm that the token is an access token that has been issued by the Authlete server of your service. This implies that access tokens issued by other systems cannot be used as a subject token or an actor token with the token type
urn:ietf:params:oauth:token-type:access_token. -
Confirm that the access token has not expired.
-
Confirm that the access token belongs to the service.
Token Type urn:ietf:params:oauth:token-type:refresh_token-
Confirm that the token is a refresh token that has been issued by the Authlete server of your service. This implies that refresh tokens issued by other systems cannot be used as a subject token or an actor token with the token type
urn:ietf:params:oauth:token-type:refresh_token. -
Confirm that the refresh token has not expired.
-
Confirm that the refresh token belongs to the service.
Token Type urn:ietf:params:oauth:token-type:id_token-
Confirm that the format conforms to the JWT specification (RFC 7519).
-
Check if the ID Token is encrypted and if it is encrypted, then (a) reject the token exchange request when the
tokenExchangeEncryptedJwtRejectedflag of the service istrueor (b) skip remaining validation steps when the flag isfalse. Note that Authlete does not verify an encrypted ID Token because there is no standard way to obtain the key to decrypt the ID Token with in the context of token exchange where the client ID for the encrypted ID Token cannot be determined. This means that you must verify an encrypted ID Token by yourself when one is used as an input token with the token type"urn:ietf:params:oauth:token-type:id_token". -
Confirm that the ID Token contains the
expclaim and the current time has not reached the time indicated by the claim. -
Confirm that the ID Token contains the
iatclaim and the current time is equal to or after the time indicated by the claim. -
Confirm that the current time is equal to or after the time indicated by the
nbfclaim if the ID Token contains the claim. -
Confirm that the ID Token contains the
issclaim and the value is a valid URI. In addition, confirm that the URI has thehttpsscheme, no query component and no fragment component. -
Confirm that the ID Token contains the
audclaim and its value is a JSON string or an array of JSON strings. -
Confirm that the value of the
nonceclaim is a JSON string if the ID Token contains the claim. -
Check if the ID Token is signed and if it is not signed, then (a) reject the token exchange request when the
tokenExchangeUnsignedJwtRejectedflag of the service istrueor (b) finish validation on the input token. -
Confirm that the signature algorithm is asymmetric. This implies that ID Tokens whose signature algorithm is symmetric (
HS256,HS384orHS512) cannot be used as a subject token or an actor token with the token typeurn:ietf:params:oauth:token-type:id_token. -
Verify the signature of the ID Token. Signature verification is performed even in the case where the issuer of the ID Token is not your service. But in that case, the issuer must support the discovery endpoint defined in OpenID Connect Discovery 1.0. Otherwise, signature verification fails.
Token Type urn:ietf:params:oauth:token-type:saml1-
(Authlete does not perform any validation for this token type.)
Token Type urn:ietf:params:oauth:token-type:saml2-
(Authlete does not perform any validation for this token type.)
The specification of Token Exchange (RFC 8693) is very flexible. In other words, the specification has abandoned the task of determining details. Therefore, for secure token exchange, you have to complement the specification with your own rules. For that purpose, Authlete provides some configuration options as listed below. Authorization server implementers may utilize them and/or implement their own rules.
-
whether to reject token exchange requests that contain no client identifier.Service.tokenExchangeByIdentifiableClientsOnly- -
whether to reject token exchange requests by public clients.Service.tokenExchangeByConfidentialClientsOnly- -
whether to reject token exchange requests by clients that have no explicit permission.Service.tokenExchangeByPermittedClientsOnly- -
whether to reject token exchange requests which use encrypted JWTs as input tokens.Service.tokenExchangeEncryptedJwtRejected- -
whether to reject token exchange requests which use unsigned JWTs as input tokens.Service.tokenExchangeUnsignedJwtRejected-
In the case of
TOKEN_EXCHANGE, thegetResponseContent()method returnsnull. You have to construct the token response by yourself.For example, you may generate an access token by calling Authlete's
/api/auth/token/createAPI and construct a token response like below.HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-cache, no-store { "access_token": "TokenCreateResponse.getAccessToken()", "issued_token_type": "urn:ietf:params:oauth:token-type:access_token", "token_type": "Bearer", "expires_in":TokenCreateResponse.getExpiresIn(), "scope": "String.join(" ",TokenCreateResponse.getScopes())" }
JWT_BEARER(Authlete 2.3 onwards)When the value of
"action"is"JWT_BEARER", it means that the request from the client application is a valid token request with the grant type"urn:ietf:params:oauth:grant-type:jwt-bearer"(RFC 7523 JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants) and that the request has already passed the following validation steps.-
Confirm that the
assertionrequest parameter is given and its value is not empty. -
Confirm that the format of the assertion conforms to the JWT specification (RFC 7519).
-
Check if the JWT is encrypted and if it is encrypted, then (a) reject the token request when the
jwtGrantEncryptedJwtRejectedflag of the service istrueor (b) skip remaining validation steps when the flag isfalse. Note that Authlete does not verify an encrypted JWT because there is no standard way to obtain the key to decrypt the JWT with. This means that you must verify an encrypted JWT by yourself. -
Confirm that the JWT contains the
issclaim and its value is a JSON string. -
Confirm that the JWT contains the
subclaim and its value is a JSON string. -
Confirm that the JWT contains the
audclaim and its value is either a JSON string or an array of JSON strings. -
Confirm that the issuer identifier of the service (cf.
Service.getIssuer()) or the URL of the token endpoint (cf.Service.getTokenEndpoint()) is listed as audience in theaudclaim. -
Confirm that the JWT contains the
expclaim and the current time has not reached the time indicated by the claim. -
Confirm that the current time is equal to or after the time indicated by by the
iatclaim if the JWT contains the claim. -
Confirm that the current time is equal to or after the time indicated by by the
nbfclaim if the JWT contains the claim. -
Check if the JWT is signed and if it is not signed, then (a) reject the token request when the
jwtGrantUnsignedJwtRejectedflag of the service istrueor (b) finish validation on the JWT. Note that Authlete does not verify the signature of the JWT because there is no standard way to obtain the key to verify the signature of a JWT with. This means that you must verify the signature by yourself.
Authlete provides some configuration options for the grant type as listed below. Authorization server implementers may utilize them and/or implement their own rules.
-
whether to reject token requests that use the grant typeService.jwtGrantByIdentifiableClientsOnly-"urn:ietf:params:oauth:grant-type:jwt-bearer"but contain no client identifier. -
whether to reject token requests that use an encrypted JWT as an authorization grant with the grant typeService.jwtGrantEncryptedJwtRejected-"urn:ietf:params:oauth:grant-type:jwt-bearer". -
whether to reject token requests that use an unsigned JWT as an authorization grant with the grant typeService.jwtGrantUnsignedJwtRejected-"urn:ietf:params:oauth:grant-type:jwt-bearer".
In the case of
JWT_BEARER, thegetResponseContent()method returnsnull. You have to construct the token response by yourself.For example, you may generate an access token by calling Authlete's
/api/auth/token/createAPI and construct a token response like below.HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-cache, no-store { "access_token": "TokenCreateResponse.getAccessToken()", "token_type": "Bearer", "expires_in":TokenCreateResponse.getExpiresIn(), "scope": "String.join(" ",TokenCreateResponse.getScopes())" }Finally, note again that Authlete does not verify the signature of the JWT specified by the
assertionrequest parameter. You must verify the signature by yourself.
ID_TOKEN_REISSUABLE(Authlete 2.3.8 onwards)The "
action" value "ID_TOKEN_REISSUABLE" indicates that an ID token can be reissued by the token request. Thisactionvalue is returned when the following conditions are met.- The service's "
idTokenReissuable" property istrue(cf.Service.isIdTokenReissuable()). - The flow of the token request is the refresh token flow.
- The scope set after processing the token request still contains the
"
openid" scope. - The access token is associated with the subject of a user.
- The access token is associated with a client application.
When receiving this
actionvalue, the implementation of the token endpoint can take either of the following actions.- Execute the same steps as for the case of the "
OK" action. This will result in that the token endpoint behaves as before, and no ID token is reissued. - Call Authlete's
/idtoken/reissueAPI to reissue an ID token and let the API prepare a token response including a new ID token together with the new access token and a refresh token.
If you choose to reissue a new ID token, the following steps should be taken.
- Identify the user associated with the access token based on the
"
subject" parameter in the response from the/auth/tokenAPI (cf.getSubject()). - Get the list of requested claims for ID tokens by referring to the value
of the "
requestedIdTokenClaims" parameter in the response from the/auth/tokenAPI. Note that, however, the parameter always holds null when the Authlete server you are using is older than the version 3.0. See the description of thegetRequestedIdTokenClaims()method for details. - Get the values of the requested claims of the user from your user database.
- Construct a JSON object that includes the name-value pairs of the
requested claims. The JSON is used as the value of the "
claims" request parameter passed to the/idtoken/reissueAPI. - Select the representation of the access token based on the following
logic: if the value of the "
jwtAccessToken" parameter (cf.getJwtAccessToken()) is not null, use the value. Otherwise, use the value of the "accessToken" parameter (cf.getAccessToken()). The selected representation is used as the value of the "accessToken" parameter passed to the/idtoken/reissueAPI. - Get the value of the refresh token (cf.
getRefreshToken()). The value is used as the value of the "refreshToken" parameter passed to the/idtoken/reissueAPI. - Call the
/idtoken/reissueAPI and follow the instruction of the API. See the descriptions of theIDTokenReissueRequestclass and theIDTokenReissueResponseclass for details.
NATIVE_SSO(Authlete 3.0 onwards)The "
action" value "NATIVE_SSO" indicates that the token request complies with the Native SSO specification and that the service must perform additional steps to complete processing the token request. In particular, the service must call the/nativessoAPI.This
actionvalue is returned when one of the following condition sets is satisfied.- Authorization Code Flow
- The service's
nativeSsoSupportedproperty is set totrue. (seeService.isNativeSsoSupported()) - The service supports the
openidanddevice_ssoscopes. - The client is allowed to request the
openidanddevice_ssoscopes. - The grant type of the token request is
authorization_code. - The authorization request preceding the token request included the
openidanddevice_ssoscopes.
- The service's
- Refresh Token Flow
- The service's
nativeSsoSupportedproperty is set totrue. (seeService.isNativeSsoSupported()) - The service supports the
device_ssoscope. - The client is allowed to request the
device_ssoscope. - The grant type of the token request is
refresh_token. - The access token issued by the refresh token request still covers the
device_ssoscope, even if the scope coverage might have been narrowed. - The presented refresh token is associated with a user's authentication session. (In practice, only refresh tokens generated through the authorization code flow compliant with Native SSO can be used.)
- The service's
- Token Exchange Flow
- The service's
nativeSsoSupportedproperty is set totrue. (seeService.isNativeSsoSupported()) - The grant type of the token request is
urn:.ietf: params: oauth: grant-type: token-exchange - The value of the
actor_token_typerequest parameter isurn:.openid: params: token-type: device-secret
- The service's
Session ID
When the
actionvalue isNATIVE_SSO, the response from the/auth/tokenAPI contains asessionIdparameter (seegetSessionId()) . Its value represents a user's authentication session - that is, a session ID.The authorization server must check whether the session ID is still valid. Note that the session ID is not a value generated by Authlete but one that was passed from the authorization server to the
/auth/authorization/issueAPI. Therefore, Authlete does not and cannot determine whether the session ID is still valid.If the session ID is no longer valid, the authorization server should return an error response from the token endpoint with the error code
invalid_grant.Device Secret
Case 1: Device Secret in Authorization Code and Refresh Token Flows
When the grant type is
authorization_codeorrefresh_token, the response from the/auth/tokenAPI may contain adeviceSecretparameter (seegetDeviceSecret()). Its value represents a device secret passed from the client application as the value of thedevice_secretrequest parameter to the token endpoint. This request parameter is optional.When the
deviceSecretparameter in the response from the/auth/tokenAPI is not null, the authorization server must check whether the device secret is valid. If the device secret is valid, the value should be passed to the/nativessoAPI later without modification, unless the authorization server chooses to reissue a new device secret.On the other hand, if the
deviceSecretparameter is absent or its value is invalid, the authorization server must generate a new device secret. The new value should then be passed to the/nativessoAPI.Note that Authlete neither generates nor manages device secrets. It is the authorization server's responsibility to do so. Therefore, Authlete does not and cannot determine whether a device secret is valid.
Case 2: Device Secret in Token Exchange Flow
When the grant type is
urn:, the response from theietf: params: oauth: grant-type: token-exchange /auth/tokenAPI containsdeviceSecretanddeviceSecretHashparameters.The
deviceSecretparameter represents the device secret presented by the client application to the token endpoint as the value of theactor_tokenrequest parameter.The
deviceSecretHashparameter represents the device secret hash embedded as the value of theds_hashclaim in the ID token that the client application passed to the token endpoint as the value of thesubject_tokenrequest parameter.The authorization server must verify the binding between the device secret and device secret hash. If the binding fails verification, the authorization server should return an error response from the token endpoint with the error code
invalid_grant.Note that the Native SSO specification does not define how to compute a device secret hash value from a device secret. The specification states, "The exact binding between the
ds_hashanddevice_secretis not specified by this profile." Therefore, the authorization server must define a rule regarding for computing the device hash value and verify the binding based on that rule. A simple example of hash computation logic is to compute the SHA-256 hash of a device secret and base64url-encode the hash./nativessoAPI CallAfter validating the session ID, device secret, and device secret hash as necessary, the authorization server must call the
/nativessoAPI to generate a Native SSO-compliant ID token and token response. The API expects the following request parameters (seeNativeSsoRequest).Parameter Description accessTokenREQUIRED. If the response from the
/auth/tokenAPI contains thejwtAccessTokenparameter, its value must be used as the value of thisaccessTokenrequest parameter to the/nativessoAPI. If thejwtAccessTokenparameter is absent, the value of theaccessTokenparameter in the response from the/auth/tokenAPI should be used instead.The specified value is used as the value of the
access_tokenproperty in the token response.refreshTokenOPTIONAL. If the
refreshTokenparameter is present in the response from the/auth/tokenAPI, its value should be specified as the value of thisrefreshTokenrequest parameter to the/nativessoAPI. Note that whether a refresh token is issued depends on configuration.The specified value is used as the value of the
refresh_tokenproperty in the token response.deviceSecretREQUIRED. If the response from the
/auth/tokenAPI contains thedeviceSecretparameter, its value should be used as the value of thisdeviceSecretrequest parameter to the/nativessoAPI. The authorization server may choose to issue a new device secret; in that case, it is free to generate a new device secret and specify the new value.If the response from the
/auth/tokenAPI does not contain thedeviceSecretparameter, or if its value is invalid, the authorization server must generate a new device secret and specify it in thedeviceSecretparameter to the/nativessoAPI.The specified value is used as the value of the
device_secretproperty in the token response.deviceSecretHashRECOMMENDED. The authorization server should compute the hash value of the device secret based on its own logic and specify the computed hash as the value of this
deviceSecretHashrequest parameter to the/nativessoAPI.When the
deviceSecretHashparameter is omitted, the implementation of the/nativessoAPI generates the device secret hash by computing the SHA-256 hash of the device secret and encoding it with base64url. Note that this hash computation logic is not a rule defined in the Native SSO specification; rather, it is Authlete-specific fallback logic used when thedeviceSecretHashparameter is omitted.subOPTIONAL. The value of the
subclaim to be embedded in the ID token. If omitted, the subject associated with the access token is used as the value of thesubclaim.claimsOPTIONAL. Additional claims to be embedded in the ID token. The format of this parameter must be a JSON object.
idtHeaderParamsOPTIONAL. Additional parameters to be embedded in the JWS header of the ID token. The format of this parameter must be a JSON object.
idTokenAudTypeOPTIONAL. This parameter specifies the type of the
audclaim in the ID token. If"array"is specified, theaudclaim will be a JSON array. If"string"is specified, it will be a JSON string. If omitted, theaudclaim will default to a JSON array.On success, the
actionparameter in the response from the/nativessoAPI isOK. In this case, the value of theresponseContentparameter in the response can be used as the message body of the token response from the token endpoint. The token endpoint implementation can construct the token response as follows:HTTP/1.1 200 OK Content-Type: application/json Cache-Control: no-cache, no-store (Embed the value of the responseContent parameter in the response from the /nativesso API here)
The resulting message body will look like this:
{ "access_token": "(Access Token)", "token_type": "(Token Type)", "expires_in": (Lifetime in Seconds), "scope": "(Space-separated Scopes)", "refresh_token": "(Refresh Token)", "id_token": "(ID Token)", "device_secret": "(Device Secret)", "issued_token_type": "urn:ietf:params:oauth:token-type:access_token" }
DPoP Nonce (Authlete 3.0 onwards)
Since version 3.0, Authlete recognizes the
nonceclaim in DPoP proof JWTs. If thenonceclaim is required (= if the service'sdpopNonceRequiredproperty istrue, or the value of thedpopNonceRequiredrequest parameter passed to the Authlete API istrue), the Authlete API checks whether thenonceclaim in the presented DPoP proof JWT is identical to the expected value.If the
dpopNonceresponse parameter from the API is not null, its value is the expected nonce value for DPoP proof JWT. The expected value needs to be conveyed to the client application as the value of theDPoP-NonceHTTP header.DPoP-Nonce: (The value returned from
getDpopNonce())See RFC 9449 OAuth 2.0 Demonstrating Proof of Possession (DPoP) for details.
- See Also:
- RFC 6749 The OAuth 2.0 Authorization Framework, RFC 7521 Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants, RFC 7523 JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants, RFC 8693 OAuth 2.0 Token Exchange, RFC 9449 OAuth 2.0 Demonstrating Proof of Possession (DPoP), OpenID Connect Native SSO for Mobile Apps 1.0, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTokenResponse.ActionThe next action that the service implementation should take.
-
Constructor Summary
Constructors Constructor Description TokenResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccessToken()Get the newly issued access token.longgetAccessTokenDuration()Get the duration of the access token in seconds.longgetAccessTokenExpiresAt()Get the date in milliseconds since the Unix epoch (1970-01-01) at which the access token will expire.URI[]getAccessTokenResources()Get the target resources of the access token being issued.TokenResponse.ActiongetAction()Get the next action that the service implementation should take.StringgetActorToken()Get the value of theactor_tokenrequest parameter.TokenInfogetActorTokenInfo()Get the information about the token specified by theactor_tokenrequest parameter.TokenTypegetActorTokenType()Get the value of theactor_token_typerequest parameter.StringgetAssertion()Get the value of theassertionrequest parameter.String[]getAudiences()Get the values of theaudiencerequest parameters that are contained in the token exchange request (cf. RFC 8693).AuthzDetailsgetAuthorizationDetails()Get the authorization details.Pair[]getClientAttributes()Get the attributes of the client.ClientAuthMethodgetClientAuthMethod()Get the client authentication method that should be performed at the token endpoint.URIgetClientEntityId()Get the entity ID of the client.longgetClientId()Get the client ID.StringgetClientIdAlias()Get the client ID alias when the token request was made.StringgetCnonce()Get thec_nonce.longgetCnonceDuration()Get the duration of thec_noncein seconds.longgetCnonceExpiresAt()Get the time at which thec_nonceexpires in milliseconds since the Unix epoch (1970-01-01).StringgetDeviceSecret()Get the device secret presented in the token request.StringgetDeviceSecretHash()Get the device secret hash extracted from the subject token in the token request.StringgetDpopNonce()Get the expected nonce value for DPoP proof JWT, which should be used as the value of theDPoP-NonceHTTP header.StringgetGrantId()Get the value of thegrant_idparameter in the token response.GrantTypegetGrantType()Get the grant type of the token request.StringgetIdToken()Get the ID token.StringgetJwtAccessToken()Get the newly issued access token in JWT format.StringgetPassword()Get the value of"password"request parameter.Property[]getProperties()Get the extra properties associated with the access token.StringgetRefreshToken()Get the newly issued refresh token.longgetRefreshTokenDuration()Get the duration of the refresh token in seconds.longgetRefreshTokenExpiresAt()Get the date in milliseconds since the Unix epoch (1970-01-01) at which the refresh token will expire.String[]getRefreshTokenScopes()Get the scopes associated with the refresh token.String[]getRequestedIdTokenClaims()Get the names of the claims that the authorization request (which resulted in generation of the access token) requested to be embedded in ID tokens.TokenTypegetRequestedTokenType()Get the value of therequested_token_typerequest parameter.URI[]getResources()Get the resources specified by theresourcerequest parameters in the token request.StringgetResponseContent()Get the response content which can be used as the entity body of the response returned to the client application.String[]getScopes()Get the scopes covered by the access token.Pair[]getServiceAttributes()Get the attributes of the service that the client application belongs to.StringgetSessionId()Get the session ID of the user's authentication session associated with the token presented in the token request.StringgetSubject()Get the subject (= resource owner's ID) of the access token.StringgetSubjectToken()Get the value of thesubject_tokenrequest parameter.TokenInfogetSubjectTokenInfo()Get the information about the token specified by thesubject_tokenrequest parameter.TokenTypegetSubjectTokenType()Get the value of thesubject_token_typerequest parameter.StringgetTicket()Get the ticket issued from Authlete's/auth/tokenendpoint.StringgetUsername()Get the value of"username"request parameter.booleanisClientEntityIdUsed()Get the flag which indicates whether the entity ID of the client was used when the request for the access token was made.booleanisClientIdAliasUsed()Get the flag which indicates whether the client ID alias was used when the token request was made.booleanisPreviousRefreshTokenUsed()Get the flag indicating whether the previous refresh token that had been kept in the database for a short time was used.voidsetAccessToken(String accessToken)Set the newly issued access token.voidsetAccessTokenDuration(long duration)Set the duration of the access token in seconds.voidsetAccessTokenExpiresAt(long expiresAt)Set the date in milliseconds since the Unix epoch (1970-01-01) at which the access token will expire.voidsetAccessTokenResources(URI[] resources)Set the target resources of the access token being issued.voidsetAction(TokenResponse.Action action)Set the next action that the service implementation should take.voidsetActorToken(String token)Set the value of theactor_tokenrequest parameter.voidsetActorTokenInfo(TokenInfo tokenInfo)Set the information about the token specified by theactor_tokenrequest parameter.voidsetActorTokenType(TokenType tokenType)Set the value of theactor_token_typerequest parameter.voidsetAssertion(String assertion)Set the value of theassertionrequest parameter.voidsetAudiences(String[] audiences)Set the values of theaudiencerequest parameters that are contained in the token exchange request (cf. RFC 8693).voidsetAuthorizationDetails(AuthzDetails details)Set the authorization details.voidsetClientAttributes(Pair[] attributes)Set the attributes of the client.voidsetClientAuthMethod(ClientAuthMethod method)Set the client authentication method that should be performed at the token endpoint.voidsetClientEntityId(URI entityId)Set the entity ID of the client.voidsetClientEntityIdUsed(boolean used)Set the flag which indicates whether the entity ID of the client was used when the request for the access token was made.voidsetClientId(long clientId)Set the client ID.voidsetClientIdAlias(String alias)Set the client ID alias when the token request was made.voidsetClientIdAliasUsed(boolean used)Set the flag which indicates whether the client ID alias was used when the token request was made.voidsetCnonce(String nonce)Set thec_nonce.voidsetCnonceDuration(long duration)Set the duration of thec_noncein seconds.voidsetCnonceExpiresAt(long expiresAt)Set the time at which thec_nonceexpires in milliseconds since the Unix epoch (1970-01-01).voidsetDeviceSecret(String deviceSecret)Set the device secret presented in the token request.voidsetDeviceSecretHash(String deviceSecretHash)Set the device secret hash extracted from the subject token in the token request.voidsetDpopNonce(String dpopNonce)Set the expected nonce value for DPoP proof JWT, which should be used as the value of theDPoP-NonceHTTP header.voidsetGrantId(String grantId)Set the value of thegrant_idparameter in the token response.voidsetGrantType(GrantType grantType)Set the grant type of the token request.voidsetIdToken(String idToken)Set the ID token.voidsetJwtAccessToken(String jwtAccessToken)Set the newly issued access token in JWT format.voidsetPassword(String password)Set the value of"password"request parameter.voidsetPreviousRefreshTokenUsed(boolean used)Set the flag indicating whether the previous refresh token that had been kept in the database for a short time was used.voidsetProperties(Property[] properties)Set the extra properties associated with the access token.voidsetRefreshToken(String refreshToken)Set the newly issued refresh token.voidsetRefreshTokenDuration(long duration)Set the duration of the refresh token in seconds.voidsetRefreshTokenExpiresAt(long expiresAt)Set the date in milliseconds since the Unix epoch (1970-01-01) at which the refresh token will expire.voidsetRefreshTokenScopes(String[] refreshTokenScopes)Set the scopes associated with the refresh token.voidsetRequestedIdTokenClaims(String[] claims)Set the names of the claims that the authorization request (which resulted in generation of the access token) requested to be embedded in ID tokens.voidsetRequestedTokenType(TokenType tokenType)Set the value of therequested_token_typerequest parameter.voidsetResources(URI[] resources)Set the resources specified by theresourcerequest parameters in the token request.voidsetResponseContent(String responseContent)Set the response content which can be used as the entity body of the response returned to the client application.voidsetScopes(String[] scopes)Set the scopes covered by the access token.voidsetServiceAttributes(Pair[] attributes)Set the attributes of the service that the client application belongs to.voidsetSessionId(String sessionId)Set the session ID of the user's authentication session associated with the token presented in the token request.voidsetSubject(String subject)Set the subject (= resource owner's ID) of the access token.voidsetSubjectToken(String token)Set the value of thesubject_tokenrequest parameter.voidsetSubjectTokenInfo(TokenInfo tokenInfo)Set the information about the token specified by thesubject_tokenrequest parameter.voidsetSubjectTokenType(TokenType tokenType)Set the value of thesubject_token_typerequest parameter.voidsetTicket(String ticket)Set the ticket used for/auth/token/issueAPI or/auth/token/failAPI.voidsetUsername(String username)Set the value of"username"request parameter.Stringsummarize()Get the summary of this instance.-
Methods inherited from class com.authlete.common.dto.ApiResponse
getResponseHeaders, getResultCode, getResultMessage, setResponseHeaders, setResultCode, setResultMessage
-
-
-
-
Method Detail
-
getAction
public TokenResponse.Action getAction()
Get the next action that the service implementation should take.
-
setAction
public void setAction(TokenResponse.Action action)
Set the next action that the service implementation should take.
-
getResponseContent
public String getResponseContent()
Get the response content which can be used as the entity body of the response returned to the client application.
-
setResponseContent
public void setResponseContent(String responseContent)
Set the response content which can be used as the entity body of the response returned to the client application.
-
getUsername
public String getUsername()
Get the value of"username"request parameter.This method returns a non-null value only when the value of
"grant_type"request parameter in the token request is"password".getSubject()method was renamed togetUsername()on version 1.13.- Since:
- 1.13
- See Also:
- RFC 6749, 4.3.2. Access Token Request
-
setUsername
public void setUsername(String username)
Set the value of"username"request parameter.setSubject(String} was renamed tosetUsername(String)on version 1.13.- Since:
- 1.13
-
getPassword
public String getPassword()
Get the value of"password"request parameter.This method returns a non-null value only when the value of
"grant_type"request parameter in the token request is"password".- See Also:
- RFC 6749, 4.3.2. Access Token Request
-
setPassword
public void setPassword(String password)
Set the value of"password"request parameter.
-
getTicket
public String getTicket()
Get the ticket issued from Authlete's/auth/tokenendpoint. The value is to be used as the value of"ticket"request parameter for/auth/token/issueAPI or/auth/token/failAPI.This method returns a non-null value only when
"action"isPASSWORD.
-
setTicket
public void setTicket(String ticket)
Set the ticket used for/auth/token/issueAPI or/auth/token/failAPI.
-
summarize
public String summarize()
Get the summary of this instance.
-
getAccessToken
public String getAccessToken()
Get the newly issued access token. This method returns a non-null value only whengetAction()returnsTokenResponse.Action.OK.If the service is configured to issue JWT-based access tokens, a JWT-based access token is issued additionally. In the case,
getJwtAccessToken()returns the JWT-based access token.- Returns:
- The newly issued access token.
- Since:
- 1.34
- See Also:
getJwtAccessToken()
-
setAccessToken
public void setAccessToken(String accessToken)
Set the newly issued access token.- Parameters:
accessToken- The newly issued access token.- Since:
- 1.34
-
getAccessTokenExpiresAt
public long getAccessTokenExpiresAt()
Get the date in milliseconds since the Unix epoch (1970-01-01) at which the access token will expire.- Returns:
- The expiration date in milliseconds since the Unix epoch (1970-01-01) at which the access token will expire.
- Since:
- 1.34
-
setAccessTokenExpiresAt
public void setAccessTokenExpiresAt(long expiresAt)
Set the date in milliseconds since the Unix epoch (1970-01-01) at which the access token will expire.- Parameters:
expiresAt- The expiration date in milliseconds since the Unix epoch (1970-01-01) at which the access token will expire.- Since:
- 1.34
-
getAccessTokenDuration
public long getAccessTokenDuration()
Get the duration of the access token in seconds.- Returns:
- Duration in seconds.
- Since:
- 1.34
-
setAccessTokenDuration
public void setAccessTokenDuration(long duration)
Set the duration of the access token in seconds.- Parameters:
duration- Duration in seconds.- Since:
- 1.34
-
getRefreshToken
public String getRefreshToken()
Get the newly issued refresh token. This method returns a non-null value only whengetAction()returnsTokenResponse.Action.OKand the service supports the refresh token flow.- Returns:
- The newly issued refresh token.
- Since:
- 1.34
-
setRefreshToken
public void setRefreshToken(String refreshToken)
Set the newly issued refresh token.- Parameters:
refreshToken- The newly issued refresh token.- Since:
- 1.34
-
getRefreshTokenExpiresAt
public long getRefreshTokenExpiresAt()
Get the date in milliseconds since the Unix epoch (1970-01-01) at which the refresh token will expire.- Returns:
- The expiration date in milliseconds since the Unix epoch (1970-01-01) at which the refresh token will expire. If the refresh token is null, this method returns 0.
- Since:
- 1.34
-
setRefreshTokenExpiresAt
public void setRefreshTokenExpiresAt(long expiresAt)
Set the date in milliseconds since the Unix epoch (1970-01-01) at which the refresh token will expire.- Parameters:
expiresAt- The expiration date in milliseconds since the Unix epoch (1970-01-01) at which the refresh token will expire. If the refresh token is null, this method returns 0.- Since:
- 1.34
-
getRefreshTokenDuration
public long getRefreshTokenDuration()
Get the duration of the refresh token in seconds.- Returns:
- Duration in seconds.
- Since:
- 1.34
-
setRefreshTokenDuration
public void setRefreshTokenDuration(long duration)
Set the duration of the refresh token in seconds.- Parameters:
duration- Duration in seconds.- Since:
- 1.34
-
getIdToken
public String getIdToken()
Get the ID token.An ID token is issued from a token endpoint when the authorization code flow is used and
"openid"is included in the scope list.- Returns:
- ID token.
- Since:
- 1.34
- See Also:
- Authentication using the Authorization Code Flow
-
setIdToken
public void setIdToken(String idToken)
Set the ID token.- Parameters:
idToken- ID token.- Since:
- 1.34
-
getGrantType
public GrantType getGrantType()
Get the grant type of the token request.- Since:
- 2.8
-
setGrantType
public void setGrantType(GrantType grantType)
Set the grant type of the token request.- Parameters:
grantType- Grant type of the token request.- Since:
- 2.8
-
getClientId
public long getClientId()
Get the client ID.- Since:
- 2.8
-
setClientId
public void setClientId(long clientId)
Set the client ID.- Since:
- 2.8
-
getClientIdAlias
public String getClientIdAlias()
Get the client ID alias when the token request was made.If the client did not have an alias, this method returns
null. Also, if the token request was invalid and it failed to identify a client, this method returnsnull.- Returns:
- The client ID alias.
- Since:
- 2.8
-
setClientIdAlias
public void setClientIdAlias(String alias)
Set the client ID alias when the token request was made.- Parameters:
alias- The client ID alias.- Since:
- 2.8
-
isClientIdAliasUsed
public boolean isClientIdAliasUsed()
Get the flag which indicates whether the client ID alias was used when the token request was made.- Returns:
trueif the client ID alias was used when the token request was made.- Since:
- 2.8
-
setClientIdAliasUsed
public void setClientIdAliasUsed(boolean used)
Set the flag which indicates whether the client ID alias was used when the token request was made.- Parameters:
used-trueif the client ID alias was used when the token request was made.- Since:
- 2.8
-
getClientEntityId
public URI getClientEntityId()
Get the entity ID of the client."Entity ID" is a technical term defined in OpenID Federation 1.0.
- Returns:
- The entity ID of the client.
- Since:
- 3.37, Authlete 2.3
- See Also:
- OpenID Federation 1.0
-
setClientEntityId
public void setClientEntityId(URI entityId)
Set the entity ID of the client."Entity ID" is a technical term defined in OpenID Federation 1.0.
- Parameters:
entityId- The entity ID of the client.- Since:
- 3.37, Authlete 2.3
- See Also:
- OpenID Federation 1.0
-
isClientEntityIdUsed
public boolean isClientEntityIdUsed()
Get the flag which indicates whether the entity ID of the client was used when the request for the access token was made."Entity ID" is a technical term defined in OpenID Federation 1.0.
- Returns:
trueif the entity ID of the client was used when the request for the access token was made.- Since:
- 3.37, Authlete 2.3
- See Also:
- OpenID Federation 1.0
-
setClientEntityIdUsed
public void setClientEntityIdUsed(boolean used)
Set the flag which indicates whether the entity ID of the client was used when the request for the access token was made."Entity ID" is a technical term defined in OpenID Federation 1.0.
- Parameters:
used-trueto indicate that the entity ID of the client was used when the request for the access token was made.- Since:
- 3.37, Authlete 2.3
- See Also:
- OpenID Federation 1.0
-
getSubject
public String getSubject()
Get the subject (= resource owner's ID) of the access token.Even if an access token has been issued by the call of
/api/auth/tokenAPI, this method returnsnullif the flow of the token request was Client Credentials Flow (grant_type=client_credentials) because it means the access token is not associated with any specific end-user.- Since:
- 2.8
-
setSubject
public void setSubject(String subject)
Set the subject (= resource owner's ID) of the access token.- Since:
- 2.8
-
getScopes
public String[] getScopes()
Get the scopes covered by the access token.- Since:
- 2.8
-
setScopes
public void setScopes(String[] scopes)
Set the scopes covered by the access token.- Since:
- 2.8
-
getProperties
public Property[] getProperties()
Get the extra properties associated with the access token. This method returnsnullwhen no extra property is associated with the issued access token.- Returns:
- Extra properties associated with the issued access token.
- Since:
- 2.8
-
setProperties
public void setProperties(Property[] properties)
Set the extra properties associated with the access token.- Parameters:
properties- Extra properties.- Since:
- 2.8
-
getJwtAccessToken
public String getJwtAccessToken()
Get the newly issued access token in JWT format.If the authorization server is configured to issue JWT-based access tokens (= if
Service.getAccessTokenSignAlg()returns a non-null value), a JWT-based access token is issued along with the original random-string one.Regarding the detailed format of the JWT-based access token, see the description of the
Serviceclass.- Returns:
- The newly issued access token in JWT format. If the service is not configured to issue JWT-based access tokens, this method always returns null.
- Since:
- 2.37
- See Also:
getAccessToken()
-
setJwtAccessToken
public void setJwtAccessToken(String jwtAccessToken)
Set the newly issued access token in JWT format.- Parameters:
jwtAccessToken- The newly issued access token in JWT format.- Since:
- 2.37
-
getClientAuthMethod
public ClientAuthMethod getClientAuthMethod()
Get the client authentication method that should be performed at the token endpoint.If the client could not be identified by the information in the request, this method returns
null.- Returns:
- The client authentication method that should be performed at the token endpoint.
- Since:
- 2.50
-
setClientAuthMethod
public void setClientAuthMethod(ClientAuthMethod method)
Set the client authentication method that should be performed at the token endpoint.- Parameters:
method- The client authentication method that should be performed at the token endpoint.- Since:
- 2.50
-
getResources
public URI[] getResources()
Get the resources specified by theresourcerequest parameters in the token request.See "Resource Indicators for OAuth 2.0" for details.
- Returns:
- Resources specified by the
resourcerequest parameters in the token request. - Since:
- 2.62
-
setResources
public void setResources(URI[] resources)
Set the resources specified by theresourcerequest parameters in the token request.See "Resource Indicators for OAuth 2.0" for details.
- Parameters:
resources- Resources specified by theresourcerequest parameters in the token request.- Since:
- 2.62
-
getAccessTokenResources
public URI[] getAccessTokenResources()
Get the target resources of the access token being issued.See "Resource Indicators for OAuth 2.0" for details.
- Returns:
- The target resources of the access token.
- Since:
- 2.62
-
setAccessTokenResources
public void setAccessTokenResources(URI[] resources)
Set the target resources of the access token being issued.See "Resource Indicators for OAuth 2.0" for details.
- Parameters:
resources- The target resources of the access token.- Since:
- 2.62
-
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".When the
action(= the value returned fromgetAction()isPASSWORD, this method returns an array that represents theauthorization_detailsrequest parameter included in the token request. In other successful cases, this method returns the authorization details associated with the issued access token.- Returns:
- Authorization details.
- Since:
- 2.56
-
setAuthorizationDetails
public void setAuthorizationDetails(AuthzDetails details)
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:
details- Authorization details.- Since:
- 2.56
-
getGrantId
public String getGrantId()
Get the value of thegrant_idparameter in the token response.- Returns:
- The value of the
grant_idresponse parameter. - Since:
- 3.1
- See Also:
- Grant Management for OAuth 2.0
-
setGrantId
public void setGrantId(String grantId)
Set the value of thegrant_idparameter in the token response.- Parameters:
grantId- The value of thegrant_idresponse parameter.- Since:
- 3.1
- See Also:
- Grant Management for OAuth 2.0
-
getServiceAttributes
public Pair[] getServiceAttributes()
Get the attributes of the service that the client application belongs to.This property is available since Authlete 2.2.
- Returns:
- The attributes of the service.
- Since:
- 2.88
-
setServiceAttributes
public void setServiceAttributes(Pair[] attributes)
Set the attributes of the service that the client application belongs to.This property is available since Authlete 2.2.
- Parameters:
attributes- The attributes of the service.- Since:
- 2.88
-
getClientAttributes
public Pair[] getClientAttributes()
Get the attributes of the client.This property is available since Authlete 2.2.
- Returns:
- The attributes of the client.
- Since:
- 2.88
-
setClientAttributes
public void setClientAttributes(Pair[] attributes)
Set the attributes of the client.This property is available since Authlete 2.2.
- Parameters:
attributes- The attributes of the client.- Since:
- 2.88
-
getAudiences
public String[] getAudiences()
Get the values of theaudiencerequest parameters that are contained in the token exchange request (cf. RFC 8693).The
audiencerequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange. Although RFC 6749 The OAuth 2.0 Authorization Framework states "Request and response parameters MUST NOT be included more than once", RFC 8693 allows a token exchange request to include theaudiencerequest parameter multiple times.- Returns:
- The values of the
audiencerequest parameters. - Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
setAudiences
public void setAudiences(String[] audiences)
Set the values of theaudiencerequest parameters that are contained in the token exchange request (cf. RFC 8693).The
audiencerequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange. Although RFC 6749 The OAuth 2.0 Authorization Framework states "Request and response parameters MUST NOT be included more than once", RFC 8693 allows a token exchange request to include theaudiencerequest parameter multiple times.- Parameters:
audiences- The values of theaudiencerequest parameters.- Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
getRequestedTokenType
public TokenType getRequestedTokenType()
Get the value of therequested_token_typerequest parameter.The
requested_token_typerequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Returns:
- The value of the
requested_token_typerequest parameter. - Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
setRequestedTokenType
public void setRequestedTokenType(TokenType tokenType)
Set the value of therequested_token_typerequest parameter.The
requested_token_typerequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Parameters:
tokenType- The value of therequested_token_typerequest parameter.- Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
getSubjectToken
public String getSubjectToken()
Get the value of thesubject_tokenrequest parameter.The
subject_tokenrequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Returns:
- The value of the
subject_tokenrequest parameter. - Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
setSubjectToken
public void setSubjectToken(String token)
Set the value of thesubject_tokenrequest parameter.The
subject_tokenrequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Parameters:
token- The value of thesubject_tokenrequest parameter.- Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
getSubjectTokenType
public TokenType getSubjectTokenType()
Get the value of thesubject_token_typerequest parameter.The
subject_token_typerequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Returns:
- The value of the
subject_token_typerequest parameter. - Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
setSubjectTokenType
public void setSubjectTokenType(TokenType tokenType)
Set the value of thesubject_token_typerequest parameter.The
subject_token_typerequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Parameters:
tokenType- The value of thesubject_token_typerequest parameter.- Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
getSubjectTokenInfo
public TokenInfo getSubjectTokenInfo()
Get the information about the token specified by thesubject_tokenrequest parameter.This property holds a non-null value only when the value of the
subject_token_typerequest parameter is either"urn:ietf:params:oauth:token-type:access_token"or"urn:ietf:params:oauth:token-type:refresh_token"(= only when thesubjectTokenTypeproperty is either"orACCESS_TOKEN"").REFRESH_TOKEN"- Returns:
- The information about the token specified by the
subject_tokenrequest parameter. - Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
setSubjectTokenInfo
public void setSubjectTokenInfo(TokenInfo tokenInfo)
Set the information about the token specified by thesubject_tokenrequest parameter.This property holds a non-null value only when the value of the
subject_token_typerequest parameter is either"urn:ietf:params:oauth:token-type:access_token"or"urn:ietf:params:oauth:token-type:refresh_token"(= only when thesubjectTokenTypeproperty is either"orACCESS_TOKEN"").REFRESH_TOKEN"- Parameters:
tokenInfo- The information about the token specified by thesubject_tokenrequest parameter.- Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
getActorToken
public String getActorToken()
Get the value of theactor_tokenrequest parameter.The
actor_tokenrequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Returns:
- The value of the
actor_tokenrequest parameter. - Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
setActorToken
public void setActorToken(String token)
Set the value of theactor_tokenrequest parameter.The
actor_tokenrequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Parameters:
token- The value of theactor_tokenrequest parameter.- Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
getActorTokenType
public TokenType getActorTokenType()
Get the value of theactor_token_typerequest parameter.The
actor_token_typerequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Returns:
- The value of the
actor_token_typerequest parameter. - Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
setActorTokenType
public void setActorTokenType(TokenType tokenType)
Set the value of theactor_token_typerequest parameter.The
actor_token_typerequest parameter is defined in RFC 8693 OAuth 2.0 Token Exchange.- Parameters:
tokenType- The value of theactor_token_typerequest parameter.- Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
getActorTokenInfo
public TokenInfo getActorTokenInfo()
Get the information about the token specified by theactor_tokenrequest parameter.This property holds a non-null value only when the value of the
actor_token_typerequest parameter is either"urn:ietf:params:oauth:token-type:access_token"or"urn:ietf:params:oauth:token-type:refresh_token"(= only when theactorTokenTypeproperty is either"orACCESS_TOKEN"").REFRESH_TOKEN"- Returns:
- The information about the token specified by the
actor_tokenrequest parameter. - Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
setActorTokenInfo
public void setActorTokenInfo(TokenInfo tokenInfo)
Set the information about the token specified by theactor_tokenrequest parameter.This property holds a non-null value only when the value of the
actor_token_typerequest parameter is either"urn:ietf:params:oauth:token-type:access_token"or"urn:ietf:params:oauth:token-type:refresh_token"(= only when theactorTokenTypeproperty is either"orACCESS_TOKEN"").REFRESH_TOKEN"- Parameters:
tokenInfo- The information about the token specified by theactor_tokenrequest parameter.- Since:
- 3.26, Authlete 2.3
- See Also:
- RFC 8693 OAuth 2.0 Token Exchange
-
getAssertion
public String getAssertion()
Get the value of theassertionrequest parameter.The
assertionrequest parameter is defined in Section 4.1 of RFC 7521 Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants.- Returns:
- The value of the
assertionrequest parameter. - Since:
- 3.30, Authlete 2.3
- See Also:
- RFC 7521 Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants, RFC 7523 JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants
-
setAssertion
public void setAssertion(String assertion)
Set the value of theassertionrequest parameter.The
assertionrequest parameter is defined in Section 4.1 of RFC 7521 Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants.- Parameters:
assertion- The value of theassertionrequest parameter.- Since:
- 3.30, Authlete 2.3
- See Also:
- RFC 7521 Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants, RFC 7523 JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants
-
isPreviousRefreshTokenUsed
public boolean isPreviousRefreshTokenUsed()
Get the flag indicating whether the previous refresh token that had been kept in the database for a short time was used.If the
/auth/tokenAPI succeeds and includes a refresh token and if this flag is true, the refresh token is the same renewed refresh token that was issued on the previous refresh token request.If the
/auth/tokenAPI reports that the refresh token presented by the client application does not exist but if this flag is true, it implies that the previous refresh token was used but the short time had already passed.This flag will never become true if the feature of "Idempotent Refresh Token" is not enabled. See the description of
Service.isRefreshTokenIdempotent()about the feature.- Returns:
trueif the previous refresh token that had been kept in the database for a short time was used.- Since:
- 3.50, Authlete 2.3
- See Also:
Service.isRefreshTokenIdempotent()
-
setPreviousRefreshTokenUsed
public void setPreviousRefreshTokenUsed(boolean used)
Set the flag indicating whether the previous refresh token that had been kept in the database for a short time was used.If the
/auth/tokenAPI succeeds and includes a refresh token and if this flag is true, the refresh token is the same renewed refresh token that was issued on the previous refresh token request.If the
/auth/tokenAPI reports that the refresh token presented by the client application does not exist but if this flag is true, it implies that the previous refresh token was used but the short time had already passed.This flag will never become true if the feature of "Idempotent Refresh Token" is not enabled. See the description of
Service.isRefreshTokenIdempotent()about the feature.- Parameters:
used-trueto indicate that the previous refresh token that had been kept in the database for a short time was used.- Since:
- 3.50, Authlete 2.3
- See Also:
Service.isRefreshTokenIdempotent()
-
getCnonce
public String getCnonce()
Get thec_nonce.c_nonceis issued in the pre-authorized code flow. In addition, a newc_noncemay be issued in the refresh token flow. See OpenID for Verifiable Credentials Issuance for details.The
getCNonce()method added by the version 3.63 has been renamed togetCnonce()by the version 3.90.- Returns:
- The
c_nonce. - Since:
- 3.90, Authlete 3.0
- See Also:
- OpenID for Verifiable Credentials Issuance
-
setCnonce
public void setCnonce(String nonce)
Set thec_nonce.c_nonceis issued in the pre-authorized code flow. In addition, a newc_noncemay be issued in the refresh token flow. See OpenID for Verifiable Credentials Issuance for details.The
setCNonce(String)method added by the version 3.63 has been renamed tosetCnonce(String)by the version 3.90.- Parameters:
nonce- Thec_nonce.- Since:
- 3.90, Authlete 3.0
- See Also:
- OpenID for Verifiable Credentials Issuance
-
getCnonceExpiresAt
public long getCnonceExpiresAt()
Get the time at which thec_nonceexpires in milliseconds since the Unix epoch (1970-01-01).The
getCNonceExpiresAt()method added by the version 3.63 has been renamed togetCnonceExpiresAt()by the version 3.90.- Returns:
- The time at which the
c_nonceexpires. - Since:
- 3.90, Authlete 3.0
- See Also:
- OpenID for Verifiable Credentials Issuance
-
setCnonceExpiresAt
public void setCnonceExpiresAt(long expiresAt)
Set the time at which thec_nonceexpires in milliseconds since the Unix epoch (1970-01-01).The
setCNonceExpiresAt(long)method added by the version 3.63 has been renamed tosetCnonceExpiresAt(long)by the version 3.90.- Parameters:
expiresAt- The time at which thec_nonceexpires.- Since:
- 3.90, Authlete 3.0
- See Also:
- OpenID for Verifiable Credentials Issuance
-
getCnonceDuration
public long getCnonceDuration()
Get the duration of thec_noncein seconds.The
getCNonceDuration()method added by the version 3.63 has been renamed togetCnonceDuration()by the version 3.90.- Returns:
- The duration of the
c_noncein seconds. - Since:
- 3.90, Authlete 3.0
- See Also:
- OpenID for Verifiable Credentials Issuance
-
setCnonceDuration
public void setCnonceDuration(long duration)
Set the duration of thec_noncein seconds.The
setCNonceDuration(long)method added by the version 3.63 has been renamed tosetCnonceDuration(long)by the version 3.90.- Parameters:
duration- The duration of thec_noncein seconds.- Since:
- 3.90, Authlete 3.0
- See Also:
- OpenID for Verifiable Credentials Issuance
-
getRequestedIdTokenClaims
public String[] getRequestedIdTokenClaims()
Get the names of the claims that the authorization request (which resulted in generation of the access token) requested to be embedded in ID tokens.Basically the value of this parameter corresponds to the content of the
id_tokenobject in theclaimsrequest parameter (OpenID Connect Core 1.0, Section 5.5) of the authorization request.Note that, however, the value of this parameter is always null when the Authlete server you are using is older than the version 3.0. It's because database records for access tokens issued by old Authlete servers do not maintain information about "requested claims for ID tokens".
It is expected that this response parameter is referred to when the
actionparameter in the response from the/auth/tokenAPI isID_TOKEN_REISSUABLE.- Returns:
- The names of the claims that the authorization request requested to be embedded in ID tokens.
- Since:
- 3.68, Authlete 3.0
-
setRequestedIdTokenClaims
public void setRequestedIdTokenClaims(String[] claims)
Set the names of the claims that the authorization request (which resulted in generation of the access token) requested to be embedded in ID tokens.Basically the value of this parameter corresponds to the content of the
id_tokenobject in theclaimsrequest parameter (OpenID Connect Core 1.0, Section 5.5) of the authorization request.Note that, however, the value of this parameter is always null when the Authlete server you are using is older than the version 3.0. It's because database records for access tokens issued by old Authlete servers do not maintain information about "requested claims for ID tokens".
It is expected that this response parameter is referred to when the
actionparameter in the response from the/auth/tokenAPI isID_TOKEN_REISSUABLE.- Parameters:
claims- The names of the claims that the authorization request requested to be embedded in ID tokens.- Since:
- 3.68, Authlete 3.0
-
getDpopNonce
public String getDpopNonce()
Get the expected nonce value for DPoP proof JWT, which should be used as the value of theDPoP-NonceHTTP header.When this response parameter is not null, the implementation of the token endpoint should add the
DPoP-NonceHTTP header in the response from the endpoint to the client application, using the value of this response parameter as the value of the HTTP header.DPoP-Nonce: (The value of this
dpopNonceresponse parameter)- Returns:
- The expected nonce value for DPoP proof JWT.
- Since:
- 3.82, Authlete 3.0
- See Also:
- RFC 9449 OAuth 2.0 Demonstrating Proof of Possession (DPoP)
-
setDpopNonce
public void setDpopNonce(String dpopNonce)
Set the expected nonce value for DPoP proof JWT, which should be used as the value of theDPoP-NonceHTTP header.When this response parameter is not null, the implementation of the token endpoint should add the
DPoP-NonceHTTP header in the response from the endpoint to the client application, using the value of this response parameter as the value of the HTTP header.DPoP-Nonce: (The value of this
dpopNonceresponse parameter)- Parameters:
dpopNonce- The expected nonce value for DPoP proof JWT.- Since:
- 3.82, Authlete 3.0
- See Also:
- RFC 9449 OAuth 2.0 Demonstrating Proof of Possession (DPoP)
-
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 void setRefreshTokenScopes(String[] refreshTokenScopes)
Set the scopes associated with the refresh token.- Parameters:
refreshTokenScopes- The scopes associated with the refresh token.- Since:
- 3.89, Authlete API 3.0
-
getSessionId
public String getSessionId()
Get the session ID of the user's authentication session associated with the token presented in the token request. This is available only when the authorization server supports the Native SSO specification and the token request complies with it. (seeService.isNativeSsoSupported())In the case of the authorization code flow, the session ID is the one associated with the presented authorization code. The value is the one that was passed as the
sessionIdparameter from the authorization server to the/auth/authorization/issueAPI (seeAuthorizationIssueRequest.getSessionId()).In the case of the refresh token flow, the session ID is the one associated with the presented refresh token.
In the case of the token exchange flow, the session ID is the value of the
sidclaim in the ID token that was provided as the value of thesubject_tokenrequest parameter to the token endpoint.- Returns:
- The session ID.
- Since:
- 4.18, Authlete 3.0
- See Also:
- OpenID Connect Native SSO for Mobile Apps 1.0
-
setSessionId
public void setSessionId(String sessionId)
Set the session ID of the user's authentication session associated with the token presented in the token request. This is available only when the authorization server supports the Native SSO specification and the token request complies with it. (seeService.isNativeSsoSupported())In the case of the authorization code flow, the session ID is the one associated with the presented authorization code. The value is the one that was passed as the
sessionIdparameter from the authorization server to the/auth/authorization/issueAPI (seeAuthorizationIssueRequest.getSessionId()).In the case of the refresh token flow, the session ID is the one associated with the presented refresh token.
In the case of the token exchange flow, the session ID is the value of the
sidclaim in the ID token that was provided as the value of thesubject_tokenrequest parameter to the token endpoint.- Parameters:
sessionId- The session ID.- Since:
- 4.18, Authlete 3.0
- See Also:
- OpenID Connect Native SSO for Mobile Apps 1.0
-
getDeviceSecret
public String getDeviceSecret()
Get the device secret presented in the token request. This is available only when the authorization server supports the Native SSO specification and the token request complies with it. (seeService.isNativeSsoSupported())In the cases of the authorization code and refresh token flows, the device secret is the value of the
device_secretrequest parameter included in the token request. This parameter is optional.In the case of the token exchange request, the device secret is the value of the
actor_tokenrequest parameter included in the token request. This parameter is mandatory for token exchange requests that comply with the Native SSO specification.- Returns:
- The device secret.
- Since:
- 4.18, Authlete 3.0
- See Also:
- OpenID Connect Native SSO for Mobile Apps 1.0
-
setDeviceSecret
public void setDeviceSecret(String deviceSecret)
Set the device secret presented in the token request. This is available only when the authorization server supports the Native SSO specification and the token request complies with it. (seeService.isNativeSsoSupported())In the cases of the authorization code and refresh token flows, the device secret is the value of the
device_secretrequest parameter included in the token request. This parameter is optional.In the case of the token exchange request, the device secret is the value of the
actor_tokenrequest parameter included in the token request. This parameter is mandatory for token exchange requests that comply with the Native SSO specification.- Parameters:
deviceSecret- The device secret.- Since:
- 4.18, Authlete 3.0
- See Also:
- OpenID Connect Native SSO for Mobile Apps 1.0
-
getDeviceSecretHash
public String getDeviceSecretHash()
Get the device secret hash extracted from the subject token in the token request. This is available only when the authorization server supports the Native SSO specification and the token request complies with it. (seeService.isNativeSsoSupported())The device secret hash is the value of the
ds_hashclaim in the ID token, which was specified as the value of thesubject_tokenrequest parameter. This parameter is mandatory for token exchange requests that comply with the Native SSO specification.- Returns:
- The device secret hash.
- Since:
- 4.18, Authlete 3.0
- See Also:
- OpenID Connect Native SSO for Mobile Apps 1.0
-
setDeviceSecretHash
public void setDeviceSecretHash(String deviceSecretHash)
Set the device secret hash extracted from the subject token in the token request. This is available only when the authorization server supports the Native SSO specification and the token request complies with it. (seeService.isNativeSsoSupported())The device secret hash is the value of the
ds_hashclaim in the ID token, which was specified as the value of thesubject_tokenrequest parameter. This parameter is mandatory for token exchange requests that comply with the Native SSO specification.- Parameters:
deviceSecretHash- The device secret hash.- Since:
- 4.18, Authlete 3.0
- See Also:
- OpenID Connect Native SSO for Mobile Apps 1.0
-
-