Class BackchannelAuthenticationCompleteResponse
- java.lang.Object
-
- com.authlete.common.dto.ApiResponse
-
- com.authlete.common.dto.BackchannelAuthenticationCompleteResponse
-
- All Implemented Interfaces:
Serializable
public class BackchannelAuthenticationCompleteResponse extends ApiResponse
Response from Authlete's/api/backchannel/authentication/completeAPI.Authlete's
/api/backchannel/authentication/completeAPI returns JSON which can be mapped to this class. The authorization server implementation should retrieve the value ofactionfrom the response and take the following steps according to the value.NOTIFICATION-
When the value of
actionisNOTIFICATION, it means that the authorization server must send a notification to the client notification endpoint.According to the CIBA Core specification, the notification is an HTTP POST request whose request body is JSON and whose
Authorizationheader contains the client notification token, which was included in the backchannel authentication request as the value of theclient_notification_tokenrequest parameter, as a bearer token.When the backchannel token delivery mode is "ping", the request body of the notification is JSON which contains the
auth_req_idproperty only. When the backchannel token delivery mode is "push", the request body will additionally contain an access token, an ID token and other properties. Note that when the backchannel token delivery mode is "poll", a notification does not have to be sent to the client notification endpoint.In error cases, in the "ping" mode, however, the content of a notification is not different from the content in successful cases. That is, the notification contains the
auth_req_idproperty only. The client will know the error when it accesses the token endpoint. On the other hand, in the "push" mode, in error cases, the content of a notification will include theerrorproperty instead of an access token and an ID token. The client will know the error by detecting thaterroris included in the notification.In any case, the
getResponseContent()method returns JSON which can be used as the request body of the notification.The client notification endpoint that the notification should be sent to can be obtained by calling the
getClientNotificationEndpoint()method. Likewise, the client notification token that the notification should include as a bearer token can be obtained by calling thegetClientNotificationToken()method. With these methods, the notification can be built like the following.POST (The path of
getClientNotificationEndpoint()) HTTP/1.1 HOST: (The host ofgetClientNotificationEndpoint()) Authorization: Bearer (The value returned fromgetClientNotificationToken()) Content-Type: application/json (The value returned fromgetResponseContent())
NO_ACTION-
When the value of
actionisNO_ACTION, it means that the authorization server does not have to take any immediate action.NO_ACTIONis returned when the backchannel token delivery mode is "poll". In this case, the client will receive the final result at the token endpoint.
SERVER_ERROR-
When the value of
actionisSERVER_ERROR, it means either (1) that the request from the authorization server to Authlete was wrong, or (2) that an error occurred on Authlete side.When the backchannel token delivery mode is "ping" or "push",
SERVER_ERRORis used only when an error is detected before the record of the ticket (which is included in the API call to/api/backchannel/authentication/complete) is retrieved from the database successfully. If an error is detected after the record of the ticket is retrieved from the database,NOTIFICATIONis used instead ofSERVER_ERROR.When the backchannel token delivery mode is "poll",
SERVER_ERRORis used regardless of whether it is before or after the record of the ticket is retrieved from the database.
- Since:
- 2.32
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBackchannelAuthenticationCompleteResponse.ActionThe next action that the OpenID provider implementation should take.
-
Constructor Summary
Constructors Constructor Description BackchannelAuthenticationCompleteResponse()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccessToken()Get the issued access token.longgetAccessTokenDuration()Get the duration of the access token in seconds.BackchannelAuthenticationCompleteResponse.ActiongetAction()Get the next action that the OpenID provider should take.AuthzDetailsgetAuthorizationDetails()Get the authorization details.StringgetAuthReqId()Get the value of the"auth_req_id"which is associated with the ticket.Pair[]getClientAttributes()Get the attributes of the client.URIgetClientEntityId()Get the entity ID of the client.longgetClientId()Get the client ID of the client application that has made the backchannel authentication request.StringgetClientIdAlias()Get the client ID alias of the client application that has made the backchannel authentication request.StringgetClientIdentifier()Get the client identifier used in the backchannel authentication request.StringgetClientName()Get the name of the client application which has made the backchannel authentication request.URIgetClientNotificationEndpoint()Get the client notification endpoint to which a notification needs to be sent.StringgetClientNotificationToken()Get the client notification token which needs to be embedded as aBearertoken in theAuthorizationheader in the notification.DeliveryModegetDeliveryMode()Get the backchannel token delivery mode.StringgetGrantId()Get the value of thegrant_idparameter in the response.StringgetIdToken()Get the issued ID token.longgetIdTokenDuration()Get the duration of the ID token in seconds.StringgetJwtAccessToken()Get the newly issued access token in JWT format.StringgetRefreshToken()Get the issued refresh token.longgetRefreshTokenDuration()Get the duration of the refresh token in seconds.URI[]getResources()Get the resources specified by theresourcerequest parameters or by theresourceproperty in the request object in the preceding backchannel authentication request.StringgetResponseContent()Get the content of the notification.Pair[]getServiceAttributes()Get the attributes of the service that the client application belongs to.booleanisClientEntityIdUsed()Get the flag which indicates whether the entity ID of the client was used in the backchannel authentication request as a client ID.booleanisClientIdAliasUsed()Get the flag which indicates whether the client ID alias was used in the backchannel authentication request.BackchannelAuthenticationCompleteResponsesetAccessToken(String accessToken)Set the issued access token.BackchannelAuthenticationCompleteResponsesetAccessTokenDuration(long duration)Set the duration of the access token in seconds.BackchannelAuthenticationCompleteResponsesetAction(BackchannelAuthenticationCompleteResponse.Action action)Set the next action that the OpenID provider should take.BackchannelAuthenticationCompleteResponsesetAuthorizationDetails(AuthzDetails details)Set the authorization details.BackchannelAuthenticationCompleteResponsesetAuthReqId(String authReqId)Set the value of the"auth_req_id"which is associated with the ticket.BackchannelAuthenticationCompleteResponsesetClientAttributes(Pair[] attributes)Set the attributes of the client.BackchannelAuthenticationCompleteResponsesetClientEntityId(URI entityId)Set the entity ID of the client.BackchannelAuthenticationCompleteResponsesetClientEntityIdUsed(boolean used)Set the flag which indicates whether the entity ID of the client was used in the backchannel authentication request as a client ID.BackchannelAuthenticationCompleteResponsesetClientId(long clientId)Set the client ID of the client application that has made the backchannel authentication request.BackchannelAuthenticationCompleteResponsesetClientIdAlias(String alias)Set the client ID alias of the client application that has made the backchannel authentication request.BackchannelAuthenticationCompleteResponsesetClientIdAliasUsed(boolean used)Set the flag which indicates whether the client ID alias was used in the backchannel authentication request.BackchannelAuthenticationCompleteResponsesetClientName(String name)Set the name of the client application which has made the backchannel authentication request.BackchannelAuthenticationCompleteResponsesetClientNotificationEndpoint(URI endpoint)Set the client notification endpoint to which a notification needs to be sent.BackchannelAuthenticationCompleteResponsesetClientNotificationToken(String token)Set the client notification token which needs to be embedded as aBearertoken in theAuthorizationheader in the notification.BackchannelAuthenticationCompleteResponsesetDeliveryMode(DeliveryMode deliveryMode)Set the backchannel token delivery mode.BackchannelAuthenticationCompleteResponsesetGrantId(String grantId)Set the value of thegrant_idparameter in the response.BackchannelAuthenticationCompleteResponsesetIdToken(String idToken)Set the issued ID token.BackchannelAuthenticationCompleteResponsesetIdTokenDuration(long duration)Set the duration of the ID token in seconds.BackchannelAuthenticationCompleteResponsesetJwtAccessToken(String jwtAccessToken)Set the newly issued access token in JWT format.BackchannelAuthenticationCompleteResponsesetRefreshToken(String refreshToken)Set the issued refresh token.BackchannelAuthenticationCompleteResponsesetRefreshTokenDuration(long duration)Set the duration of the refresh token in seconds.BackchannelAuthenticationCompleteResponsesetResources(URI[] resources)Set the resources specified by theresourcerequest parameters or by theresourceproperty in the request object in the preceding backchannel authentication request.BackchannelAuthenticationCompleteResponsesetResponseContent(String responseContent)Set the content of the notification.BackchannelAuthenticationCompleteResponsesetServiceAttributes(Pair[] attributes)Set the attributes of the service that the client application belongs to.-
Methods inherited from class com.authlete.common.dto.ApiResponse
getResponseHeaders, getResultCode, getResultMessage, setResponseHeaders, setResultCode, setResultMessage
-
-
-
-
Method Detail
-
getAction
public BackchannelAuthenticationCompleteResponse.Action getAction()
Get the next action that the OpenID provider should take.- Returns:
- The next action.
-
setAction
public BackchannelAuthenticationCompleteResponse setAction(BackchannelAuthenticationCompleteResponse.Action action)
Set the next action that the OpenID provider should take.- Parameters:
action- The next action.- Returns:
thisobject.
-
getResponseContent
public String getResponseContent()
Get the content of the notification.When
getAction()returnsNOTIFICATION, this method returns JSON which should be used as the request body of the notification.In successful cases, when the backchannel token delivery mode is
"ping", the JSON contains"auth_req_id". On the other hand, when the backchannel token delivery mode is"push", the JSON contains an access token, an ID token, and optionally a refresh token (and some other properties).- Returns:
- The content of the notification.
-
setResponseContent
public BackchannelAuthenticationCompleteResponse setResponseContent(String responseContent)
Set the content of the notification.- Parameters:
responseContent- The content of the notification.- Returns:
thisobject.
-
getClientId
public long getClientId()
Get the client ID of the client application that has made the backchannel authentication request.- Returns:
- The client ID of the client application.
-
setClientId
public BackchannelAuthenticationCompleteResponse setClientId(long clientId)
Set the client ID of the client application that has made the backchannel authentication request.- Parameters:
clientId- The client ID of the client application.- Returns:
thisobject.
-
getClientIdAlias
public String getClientIdAlias()
Get the client ID alias of the client application that has made the backchannel authentication request.- Returns:
- The client ID alias of the client application.
-
setClientIdAlias
public BackchannelAuthenticationCompleteResponse setClientIdAlias(String alias)
Set the client ID alias of the client application that has made the backchannel authentication request.- Parameters:
alias- The client ID alias of the client application.- Returns:
thisobject.
-
isClientIdAliasUsed
public boolean isClientIdAliasUsed()
Get the flag which indicates whether the client ID alias was used in the backchannel authentication request.- Returns:
trueif the client ID alias was used in the request.
-
setClientIdAliasUsed
public BackchannelAuthenticationCompleteResponse setClientIdAliasUsed(boolean used)
Set the flag which indicates whether the client ID alias was used in the backchannel authentication request.- Parameters:
used-trueto indicate that the client ID alias was used in the request.- Returns:
thisobject.
-
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 BackchannelAuthenticationCompleteResponse 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.- Returns:
thisobject.- 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 in the backchannel authentication request as a client ID."Entity ID" is a technical term defined in OpenID Federation 1.0.
- Returns:
trueif the entity ID of the client was used in the request as a client ID.- Since:
- 3.37, Authlete 2.3
- See Also:
- OpenID Federation 1.0
-
setClientEntityIdUsed
public BackchannelAuthenticationCompleteResponse setClientEntityIdUsed(boolean used)
Set the flag which indicates whether the entity ID of the client was used in the backchannel authentication request as a client ID."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 in the request as a client ID.- Returns:
thisobject.- Since:
- 3.37, Authlete 2.3
- See Also:
- OpenID Federation 1.0
-
getClientIdentifier
public String getClientIdentifier()
Get the client identifier used in the backchannel authentication request.When
isClientIdAliasUsed()returnstrue, this method returns the same value asgetClientIdAlias()does. Otherwise, ifisClientEntityIdUsed()returnstrue, this method returns the same value asgetClientEntityId().toString()does. In other cases, this method returns the string representation of the value returned fromgetClientId().- Returns:
- The client identifier used in the backchannel authentication request.
-
getClientName
public String getClientName()
Get the name of the client application which has made the backchannel authentication request.- Returns:
- The name of the client application.
-
setClientName
public BackchannelAuthenticationCompleteResponse setClientName(String name)
Set the name of the client application which has made the backchannel authentication request.- Parameters:
name- The name of the client application.- Returns:
thisobject.
-
getDeliveryMode
public DeliveryMode getDeliveryMode()
Get the backchannel token delivery mode.- Returns:
- The backchannel token delivery mode.
-
setDeliveryMode
public BackchannelAuthenticationCompleteResponse setDeliveryMode(DeliveryMode deliveryMode)
Set the backchannel token delivery mode.- Parameters:
deliveryMode- The backchannel token delivery mode.- Returns:
thisobject.
-
getClientNotificationEndpoint
public URI getClientNotificationEndpoint()
Get the client notification endpoint to which a notification needs to be sent.This corresponds to the
"client_notification_endpoint"metadata of the client application.- Returns:
- The client notification endpoint.
-
setClientNotificationEndpoint
public BackchannelAuthenticationCompleteResponse setClientNotificationEndpoint(URI endpoint)
Set the client notification endpoint to which a notification needs to be sent.This corresponds to the
"client_notification_endpoint"metadata of the client application.- Parameters:
endpoint- The client notification endpoint.- Returns:
thisobject.
-
getClientNotificationToken
public String getClientNotificationToken()
Get the client notification token which needs to be embedded as aBearertoken in theAuthorizationheader in the notification.This is the value of the
"client_notification_token"request parameter included in the backchannel authentication request.- Returns:
- The client notification token.
-
setClientNotificationToken
public BackchannelAuthenticationCompleteResponse setClientNotificationToken(String token)
Set the client notification token which needs to be embedded as aBearertoken in theAuthorizationheader in the notification.- Parameters:
token- The client notification token.- Returns:
thisobject.
-
getAuthReqId
public String getAuthReqId()
Get the value of the"auth_req_id"which is associated with the ticket.- Returns:
- The value of the
"auth_req_id".
-
setAuthReqId
public BackchannelAuthenticationCompleteResponse setAuthReqId(String authReqId)
Set the value of the"auth_req_id"which is associated with the ticket.- Parameters:
authReqId- The value of the"auth_req_id".- Returns:
thisobject.
-
getAccessToken
public String getAccessToken()
Get the issued access token. This method returns a non-null value only when the backchannel token delivery mode is "push" and an access token has been issued successfully.- Returns:
- The issued access token.
-
setAccessToken
public BackchannelAuthenticationCompleteResponse setAccessToken(String accessToken)
Set the issued access token.- Parameters:
accessToken- The issued access token.- Returns:
thisobject.
-
getRefreshToken
public String getRefreshToken()
Get the issued refresh token. This method returns a non-null value only when the backchannel token delivery mode is "push" and a refresh token has been issued successfully.Note that refresh tokens are not issued if the service does not support the refresh token flow.
- Returns:
- The issued refresh token.
-
setRefreshToken
public BackchannelAuthenticationCompleteResponse setRefreshToken(String refreshToken)
Set the issued refresh token.- Parameters:
refreshToken- The issued refresh token.- Returns:
thisobject.
-
getIdToken
public String getIdToken()
Get the issued ID token. This method returns a non-null value only when the backchannel token delivery mode is "push" and an ID token has been issued successfully.- Returns:
- The issued ID token.
-
setIdToken
public BackchannelAuthenticationCompleteResponse setIdToken(String idToken)
Set the issued ID token.- Parameters:
idToken- The issued ID token.- Returns:
thisobject.
-
getAccessTokenDuration
public long getAccessTokenDuration()
Get the duration of the access token in seconds. If an access token has not been issued, this method returns 0.- Returns:
- The duration of the access token in seconds.
-
setAccessTokenDuration
public BackchannelAuthenticationCompleteResponse setAccessTokenDuration(long duration)
Set the duration of the access token in seconds.- Parameters:
duration- The duration of the access token in seconds.- Returns:
thisobject.
-
getRefreshTokenDuration
public long getRefreshTokenDuration()
Get the duration of the refresh token in seconds. If a refresh token has not been issued, this method returns 0.- Returns:
- The duration of the refresh token in seconds.
-
setRefreshTokenDuration
public BackchannelAuthenticationCompleteResponse setRefreshTokenDuration(long duration)
Set the duration of the refresh token in seconds.- Parameters:
duration- The duration of the refresh token in seconds.- Returns:
thisobject.
-
getIdTokenDuration
public long getIdTokenDuration()
Get the duration of the ID token in seconds. If an ID token has not been issued, this method returns 0.- Returns:
- The duration of the ID token in seconds.
-
setIdTokenDuration
public BackchannelAuthenticationCompleteResponse setIdTokenDuration(long duration)
Set the duration of the ID token in seconds.- Parameters:
duration- The duration of the ID token in seconds.- Returns:
thisobject.
-
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 BackchannelAuthenticationCompleteResponse setJwtAccessToken(String jwtAccessToken)
Set the newly issued access token in JWT format.- Parameters:
jwtAccessToken- The newly issued access token in JWT format.- Returns:
thisobject.- Since:
- 2.37
-
getResources
public URI[] getResources()
Get the resources specified by theresourcerequest parameters or by theresourceproperty in the request object in the preceding backchannel authentication request. If both are given, the values in the request object take precedence. See "Resource Indicators for OAuth 2.0" for details.- Returns:
- Target resources.
- Since:
- 2.62
-
setResources
public BackchannelAuthenticationCompleteResponse setResources(URI[] resources)
Set the resources specified by theresourcerequest parameters or by theresourceproperty in the request object in the preceding backchannel authentication request. If both are given, the values in the request object should be set. See "Resource Indicators for OAuth 2.0" for details.- Parameters:
resources- Target resources.- Returns:
thisobject.- 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".- Returns:
- Authorization details.
- Since:
- 2.56
-
setAuthorizationDetails
public BackchannelAuthenticationCompleteResponse 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.- Returns:
thisobject.- Since:
- 2.56
-
getGrantId
public String getGrantId()
Get the value of thegrant_idparameter in the response.This property may hold a non-null value only when the backchannel token delivery mode is "push".
- Returns:
- The value of the
grant_idresponse parameter. - Since:
- 3.1
- See Also:
- Grant Management for OAuth 2.0
-
setGrantId
public BackchannelAuthenticationCompleteResponse setGrantId(String grantId)
Set the value of thegrant_idparameter in the response.This property may hold a non-null value only when the backchannel token delivery mode is "push".
- Parameters:
grantId- The value of thegrant_idresponse parameter.- Returns:
thisobject.- 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 BackchannelAuthenticationCompleteResponse 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.- Returns:
thisobject.- 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 BackchannelAuthenticationCompleteResponse setClientAttributes(Pair[] attributes)
Set the attributes of the client.This property is available since Authlete 2.2.
- Parameters:
attributes- The attributes of the client.- Returns:
thisobject.- Since:
- 2.88
-
-