Example usage for com.amazonaws.services.cognitoidp.model ConfirmDeviceResult setUserConfirmationNecessary

List of usage examples for com.amazonaws.services.cognitoidp.model ConfirmDeviceResult setUserConfirmationNecessary

Introduction

In this page you can find the example usage for com.amazonaws.services.cognitoidp.model ConfirmDeviceResult setUserConfirmationNecessary.

Prototype


public void setUserConfirmationNecessary(Boolean userConfirmationNecessary) 

Source Link

Document

Indicates whether the user confirmation is necessary to confirm the device response.

Usage

From source file:io.fineo.client.auth.cognito.CognitoUser.java

License:Open Source License

/**
 * The method confirms a device. If this device can be remembered and if this is a new device,
 * a new device key is generated at the end of a successful authentication. SRP verification is
 * performed by the service, during the next authentication attempts, to identify this device.
 * This method generates the necessary tokens to enable the device SRP verification.
 *
 * @param deviceMetadata        REQUIRED: Metadata for the new device.
 *///from  w w w  .  j  av  a2  s.  c o  m
private ConfirmDeviceResult confirmDevice(final NewDeviceMetadataType deviceMetadata) {
    Map<String, String> deviceSrpVerifiers = CognitoDeviceHelper.generateVerificationParameters(deviceKey,
            deviceMetadata.getDeviceGroupKey());

    ConfirmDeviceResult confirmDeviceResult = new ConfirmDeviceResult();
    confirmDeviceResult.setUserConfirmationNecessary(false);
    try {
        confirmDeviceResult = confirmDeviceInternal(getCachedSession(), deviceMetadata.getDeviceKey(),
                deviceSrpVerifiers.get("verifier"), deviceSrpVerifiers.get("salt"), "Fineo.JDBC");
    } catch (Exception e) {
        LOG.error(TAG, "Device confirmation failed: " + e.getMessage());
        return null;
    }
    this.devices.cacheDevice(usernameInternal, getUserPoolId(), deviceMetadata);
    return confirmDeviceResult;
}