class RestAuthConfirmationCallbackHandler extends AbstractRestAuthCallbackHandler<ConfirmationCallback> {

    public ConfirmationCallback convertFromJson(ConfirmationCallback callback, JsonValue jsonCallback) throws RestAuthException {

        validateCallbackType(CALLBACK_NAME, jsonCallback);

        JsonValue input = jsonCallback.get("input");

        if (input.size() != 1) {
            throw new JsonException("JSON Callback does not include a input field");
        }

        JsonValue inputFieldValue = input.get(0).get("value").required();
        int value;
        if (inputFieldValue.isString()) {
            value = Integer.parseInt(inputFieldValue.asString());
        } else {
            value = inputFieldValue.asInteger();
        }
        callback.setSelectedIndex(value);

        return callback;
    }

}