Interface DispatcherResponse


public interface DispatcherResponse
The response returned by the 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:

interface
  • Method Details

    • httpResponse

      String httpResponse()
      The value of the response attribute 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 String has JSON format, nevisFIDO will handle the String as JSON. For instance, if httpResponse is {"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 the tokenInformation.dispatcherInformation.response attribute 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:

      1. 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.
      2. 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 String has JSON format, nevisFIDO will handle the String as JSON. For instance, if statusResponse is {"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 response attribute returned by the status service
    • outOfBandPayload

      Optional<String> 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 outOfBandPayload attribute. 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.MobileSdkDispatcherResponseBuilder to create DispatchResponses with out-of-band payloads that are compatible with the Nevis Mobile SDK.

      Returns:
      the non-encrypted out-of-band payload
    • additionalInformation

      Optional<String> additionalInformation()
      Additional information that is not included in the outOfBandPayload(), 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 additionalInformation attribute. 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.additionalInformation method of the pending operations API

      For 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

      static DispatcherResponse.Builder builder()
      An object that can be used to build a DispatcherResponse
      Returns:
      a builder of DispatcherResponse objects