Search in sources :

Example 6 with AttributeType

use of com.amazonaws.services.cognitoidentityprovider.model.AttributeType in project aws-sdk-android by aws-amplify.

the class AuthenticationDetails method setValidationData.

/**
 * Set the name of the authentication challenge.
 *
 * @param validationData
 */
private void setValidationData(Map<String, String> validationData) {
    if (validationData != null) {
        this.validationData = new ArrayList<AttributeType>();
        for (final Map.Entry<String, String> data : validationData.entrySet()) {
            final AttributeType validation = new AttributeType();
            validation.setName(data.getKey());
            validation.setValue(data.getValue());
            this.validationData.add(validation);
        }
    } else {
        this.validationData = null;
    }
}
Also used : AttributeType(com.amazonaws.services.cognitoidentityprovider.model.AttributeType) Map(java.util.Map) HashMap(java.util.HashMap)

Example 7 with AttributeType

use of com.amazonaws.services.cognitoidentityprovider.model.AttributeType in project aws-sdk-android by aws-amplify.

the class AWSMobileClientTest method checkDeviceAttribute.

/**
 * Utility function that calls admin API to check the certain device attribute values.
 *
 * @param deviceKey the device that holds the attributes to be checked
 * @param username the user that has the device
 * @param attributeName the name of the attribute that will be checked
 * @param attributeValue the value the named attribute should be set to when checked
 */
private void checkDeviceAttribute(final String deviceKey, final String username, final String attributeName, final String attributeValue) {
    final AdminGetDeviceRequest adminGetDeviceRequest = new AdminGetDeviceRequest().withDeviceKey(deviceKey).withUsername(username).withUserPoolId(userPoolId);
    final AdminGetDeviceResult adminGetDeviceResult = getUserpoolLL().adminGetDevice(adminGetDeviceRequest);
    final List<AttributeType> deviceAttributes = adminGetDeviceResult.getDevice().getDeviceAttributes();
    for (AttributeType attributeType : deviceAttributes) {
        if (attributeType.getName().equals(attributeName)) {
            assertEquals(attributeValue, attributeType.getValue());
            return;
        }
    }
}
Also used : AdminGetDeviceResult(com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceResult) AdminGetDeviceRequest(com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceRequest) AttributeType(com.amazonaws.services.cognitoidentityprovider.model.AttributeType)

Example 8 with AttributeType

use of com.amazonaws.services.cognitoidentityprovider.model.AttributeType in project aws-sdk-android by aws-amplify.

the class AWSMobileClientTest method createUserViaAdminAPI.

private static void createUserViaAdminAPI(final String userpoolId, final String username, final String email) {
    AdminCreateUserRequest request = new AdminCreateUserRequest().withUsername(username).withTemporaryPassword(TEMP_PASSWORD).withUserPoolId(userpoolId).withMessageAction(MessageActionType.SUPPRESS).withForceAliasCreation(true).withUserAttributes(new AttributeType().withName("email").withValue(email), new AttributeType().withName("email_verified").withValue("true"));
    getUserpoolLL().adminCreateUser(request);
}
Also used : AttributeType(com.amazonaws.services.cognitoidentityprovider.model.AttributeType) AdminCreateUserRequest(com.amazonaws.services.cognitoidentityprovider.model.AdminCreateUserRequest)

Aggregations

AttributeType (com.amazonaws.services.cognitoidentityprovider.model.AttributeType)8 HashMap (java.util.HashMap)5 InitiateAuthRequest (com.amazonaws.services.cognitoidentityprovider.model.InitiateAuthRequest)3 Map (java.util.Map)3 AnalyticsMetadataType (com.amazonaws.services.cognitoidentityprovider.model.AnalyticsMetadataType)2 CognitoNotAuthorizedException (com.amazonaws.mobileconnectors.cognitoidentityprovider.exceptions.CognitoNotAuthorizedException)1 AdminCreateUserRequest (com.amazonaws.services.cognitoidentityprovider.model.AdminCreateUserRequest)1 AdminGetDeviceRequest (com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceRequest)1 AdminGetDeviceResult (com.amazonaws.services.cognitoidentityprovider.model.AdminGetDeviceResult)1 SignUpRequest (com.amazonaws.services.cognitoidentityprovider.model.SignUpRequest)1 ArrayList (java.util.ArrayList)1