Example usage for com.amazonaws.services.cognitoidp.model NewDeviceMetadataType getDeviceGroupKey

List of usage examples for com.amazonaws.services.cognitoidp.model NewDeviceMetadataType getDeviceGroupKey

Introduction

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

Prototype


public String getDeviceGroupKey() 

Source Link

Document

The device group key.

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  ww  w .  ja va2s  .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;
}