Interface DispatcherResponse
Dispatcher.
This object contains the information that must be returned in the HTTP response to the client that triggered the dispatching, the information about dispatching that must be exposed in the status service, and the information about the operation that is exposed by the Device Out-of-Band Operations service of nevisFIDO.
To build a DispatcherResponse you have the following options:
- If your dispatcher generates out-of-band payloads that must be consumed by the
Nevis Mobile Authentication SDK, we recommend
using the
DispatchContext.MobileSdkDispatcherResponseBuilder. - Use the
DispatcherResponse.Builder(seebuilder()) if you have a custom out-of-band payload that is not compatible with the Nevis Mobile Authentication SDK. - Create your own implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn object that can be used to build aDispatcherResponse. -
Method Summary
Modifier and TypeMethodDescriptionAdditional information that is not included in theoutOfBandPayload(), but that is sent by the dispatcher and can be useful to the client receiving the dispatched token.static DispatcherResponse.Builderbuilder()An object that can be used to build aDispatcherResponseThe value of theresponseattribute included in the HTTP response returned to the HTTP client that invoked the dispatch token service.The out-of-band payload that will be sent through the dispatch channel.The value of thetokenInformation.dispatcherInformation.responseattribute returned by the status service.
-
Method Details
-
httpResponse
String httpResponse()The value of theresponseattribute included in the HTTP response returned to the HTTP client that invoked the dispatch token service.Its structure is defined by the dispatcher. For example, in the case of the link dispatcher provided by nevisFIDO, this will contain the HTTP URL with the out-of-band payload. In the case of the QR code dispatcher, it will contain the QR code.
See the nevisFIDO documentation for examples like the one of the link dispatcher.
If the returned
Stringhas JSON format, nevisFIDO will handle theStringas JSON. For instance, ifhttpResponseis{"myattribute", "myvalue"}, then the following will be included in the HTTP response sent to the client that triggered the dispatching:{ [...] "response": { "myattribute": "myvalue" } }- Returns:
- the contents to be included in the HTTP response
-
statusResponse
String statusResponse()The value of thetokenInformation.dispatcherInformation.responseattribute returned by the status service. The status service informs about operations, and this attribute can be used to include information about the dispatching of the token.Note that it is recommended to keep this of a small size for two main reasons:
- The status service is queried periodically by clients. Keeping the contents of the response as small as possible, reduces the amount of traffic between the server and the client.
- The contents returned by the status service are kept into the session, which can be stored in a persistent store (like a database), keeping the contents to be stored as small as possible helps to improve the number of queries that can be made to the persistence layer and reduces the footprint of the stored data.
The nature of the contents of the status is defined by this dispatcher.
See the nevisFIDO documentation for examples of where this value is included in the response of the status service.
If the returned
Stringhas JSON format, nevisFIDO will handle theStringas JSON. For instance, ifstatusResponseis{"myattribute", "myvalue"}, then the following will be included in the HTTP response sent to the client that invoked the status service:{ "tokenInformation" : { "tokenResult" : "tokenRedeemed", "dispatcherInformation" : { "response" : { "myattribute": "myvalue" } [...] } } }- Returns:
- the contents of the
responseattribute returned by the status service
-
outOfBandPayload
The out-of-band payload that will be sent through the dispatch channel. It will only be present if the operation uses a dispatch target.This information is exposed by the Get Device Out-of-Band Operations service of nevisFIDO in the
outOfBandPayloadattribute. This service allows to retrieve the out-of-band operations, whose token has not been redeemed.In the case of dispatchers to be used with the Nevis Mobile SDK and its pending operations API, the format of the out-of-band payload, must conform to the structure defined by Nevis and must be non-encrypted. In this case it is recommended to use the convenience methods offered by
DispatchContext.MobileSdkDispatcherResponseBuilderto createDispatchResponses with out-of-band payloads that are compatible with the Nevis Mobile SDK.- Returns:
- the non-encrypted out-of-band payload
-
additionalInformation
Additional information that is not included in theoutOfBandPayload(), but that is sent by the dispatcher and can be useful to the client receiving the dispatched token.This information is exposed by the Get Device Out-of-Band Operations service of nevisFIDO in the
additionalInformationattribute. This service allows to retrieve the out-of-band operations, whose token has not been redeemed.If you have an application using the SDK, this information is returned by the
PendingOutOfBandOperation.additionalInformationmethod of the pending operations APIFor instance, in the case of the FCM dispatch target, this includes the message used to generate the push notification. This information is not part of the out-of-band payload, but can be useful to the client to give context to the end user.
If this is present, then it is guaranteed that
outOfBandPayload()is also present.- Returns:
- the additional information to be exposed by the Get Device Out-of-Band Operations service.
-
builder
An object that can be used to build aDispatcherResponse- Returns:
- a builder of
DispatcherResponseobjects
-