use of com.amazonaws.services.cognitoidentityprovider.model.UpdateUserAttributesRequest in project aws-sdk-android by aws-amplify.
the class CognitoUser method updateAttributesInternal.
/**
* Helper method to update user attributes.
*
* @param clientMetadata A map of custom key-value pairs that is passed to the lambda function for
* custom workflow.
* @param attributes REQUIRED: Attributes.
* @param session REQUIRED: A valid {@link CognitoUserSession}.
*/
private UpdateUserAttributesResult updateAttributesInternal(final Map<String, String> clientMetadata, final CognitoUserAttributes attributes, final CognitoUserSession session) {
if (session != null && session.isValid()) {
final UpdateUserAttributesRequest updateUserAttributesRequest = new UpdateUserAttributesRequest();
updateUserAttributesRequest.setAccessToken(session.getAccessToken().getJWTToken());
updateUserAttributesRequest.setUserAttributes(attributes.getAttributesList());
updateUserAttributesRequest.setClientMetadata(clientMetadata);
return cognitoIdentityProviderClient.updateUserAttributes(updateUserAttributesRequest);
} else {
throw new CognitoNotAuthorizedException("user is not authenticated");
}
}
Aggregations