List of usage examples for com.amazonaws.services.cognitoidp.model DeviceSecretVerifierConfigType setPasswordVerifier
public void setPasswordVerifier(String passwordVerifier)
The password verifier.
From source file:io.fineo.client.auth.cognito.CognitoUser.java
License:Open Source License
/** * Internal method to confirm a device./*from w ww . ja v a2 s . c o m*/ * * @param session REQUIRED: A valid {@link CognitoUserSession}. * @param deviceKey REQUIRED: This is the device-key assigned the new device. * @param passwordVerifier REQUIRED: Random string generated by the SDK. * @param salt REQUIRED: Generated by the SDK to set the device verifier. * @param deviceName REQUIRED: A user identifiable string assigned to the device. * @return {@link ConfirmDeviceResult}, service response. */ private ConfirmDeviceResult confirmDeviceInternal(CognitoUserSession session, String deviceKey, String passwordVerifier, String salt, String deviceName) { if (session != null && session.isValid()) { if (deviceKey != null && deviceName != null) { DeviceSecretVerifierConfigType deviceConfig = new DeviceSecretVerifierConfigType(); deviceConfig.setPasswordVerifier(passwordVerifier); deviceConfig.setSalt(salt); ConfirmDeviceRequest confirmDeviceRequest = new ConfirmDeviceRequest(); confirmDeviceRequest.setAccessToken(session.getAccessToken().getJWTToken()); confirmDeviceRequest.setDeviceKey(deviceKey); confirmDeviceRequest.setDeviceName(deviceName); confirmDeviceRequest.setDeviceSecretVerifierConfig(deviceConfig); return cognitoIdentityProviderClient.confirmDevice(confirmDeviceRequest); } else { if (deviceKey == null) { throw new CognitoParameterInvalidException("Device key is null"); } else { throw new CognitoParameterInvalidException("Device name is null"); } } } else { throw new CognitoNotAuthorizedException("User is not authorized"); } }