MobilePairingCollector

A DaVinci Collector for the MOBILE_PAIRING node type.

When a DaVinci flow presents a MOBILE_PAIRING collector, the server supplies a pairingKey in the node JSON. This class reads that key, calls PingOneMFA.pair, and posts the outcome back to the server as a JSON object via payload.

Resume envelope

Implementing Submittable with eventType() = "action" causes the DaVinci core to emit parameters.eventType: "action" on the resume POST when payload is non-null. The core then places payload under formData[[id]]; id returns key ("mobilePairing" per the connector spec), so the final envelope shape is:

  • Success: formData.mobilePairing = { "status": "CLAIMED" }

  • Failure: formData.mobilePairing = { "error": { "code": "<nativeCode>", "message": "<message>" } } — where <nativeCode> is the numeric native SDK error code as a string (e.g. "10005"), or "INTERNAL_ERROR" for unexpected failures.

  • Cancel: formData.mobilePairing = { "error": { "code": "USER_CANCELLED", "message": "…" } }

Lifecycle

  1. CollectorInitializer registers this class with com.pingidentity.davinci.plugin.CollectorFactory at app startup under the key "MOBILE_PAIRING".

  2. When the DaVinci engine receives a node containing a MOBILE_PAIRING collector, the factory instantiates this class and calls init with the server-provided JSON object.

  3. The UI calls collect to perform pairing, or cancel if the user abandons the flow. A spinner or loading indicator should be shown while collect is in progress.

  4. The DaVinci engine reads payload when node.next() is called and includes the outcome in the resume POST body.

Cancellation semantics

The native PingOne MFA SDK does not expose an API to abort an in-flight pairing. Calling cancel only changes what payload will report to DaVinci — any native pairing operation already in flight will run to completion in the background, and its result is discarded so the user-canceled payload is preserved.

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
var key: String

The field key sent by the DaVinci server, used as this collector's id. Populated during init; defaults to an empty string if the server omits the field.

Link copied to clipboard

The pairing key supplied by the DaVinci server. Populated during init and passed to PingOneMFA.pair in collect.

Functions

Link copied to clipboard
fun cancel(message: String = "User canceled the pairing flow")

Records a user-initiated cancellation and stores the corresponding error envelope so it can be posted back to DaVinci via payload.

Link copied to clipboard
open override fun close()
Link copied to clipboard
suspend fun collect(): Result<Unit>

Pairs the device with a PingOne MFA account using the pairingKey received from the DaVinci server, then stores the outcome for submission via payload.

Link copied to clipboard
open override fun eventType(): String

Returns "action" as the DaVinci event type.

Link copied to clipboard
open override fun id(): String

Returns key as the unique identifier for this collector. The DaVinci core uses this value as the field name under formData in the resume POST.

Link copied to clipboard
open override fun init(input: JsonObject): Collector<JsonObject>

Initializes this collector from the server-provided JSON object.

Link copied to clipboard
open override fun payload(): JsonObject?

Returns the pairing outcome to be posted back to DaVinci under formData[[id]], or null if neither collect nor cancel has been called yet.