예제 #1
0
    internal async Task <System.Net.HttpStatusCode> UpdateAttributes(UpdateUserAttributesRequest a)
    {
        AmazonCognitoIdentityProviderClient provider = new AmazonCognitoIdentityProviderClient(new Amazon.Runtime.AnonymousAWSCredentials());
        UpdateUserAttributesResponse        resp     = await provider.UpdateUserAttributesAsync(a);

        return(resp.HttpStatusCode);
    }
예제 #2
0
        private UpdateUserAttributesRequest CreateUpdateUserAttributesRequest(IDictionary <string, string> attributes)
        {
            EnsureUserAuthenticated();

            UpdateUserAttributesRequest updateUserAttributesRequest = new UpdateUserAttributesRequest()
            {
                AccessToken    = SessionTokens.AccessToken,
                UserAttributes = CognitoAuthHelper.CreateAttributeList(attributes)
            };

            return(updateUserAttributesRequest);
        }
예제 #3
0
        /// <summary>
        /// Updates the user's attributes defined in the attributes parameter (one at a time)
        /// using an asynchronous call
        /// </summary>
        /// <param name="attributes">The attributes to be updated</param>
        public virtual async Task UpdateAttributesAsync(IDictionary <string, string> attributes)
        {
            UpdateUserAttributesRequest updateUserAttributesRequest =
                CreateUpdateUserAttributesRequest(attributes);

            await Provider.UpdateUserAttributesAsync(updateUserAttributesRequest).ConfigureAwait(false);

            //Update the local Attributes property
            foreach (KeyValuePair <string, string> entry in attributes)
            {
                Attributes[entry.Key] = entry.Value;
            }
        }
        /// <summary>
        /// Updates the user's attributes defined in the attributes parameter (one at a time)
        /// using an asynchronous call
        /// </summary>
        /// <param name="attributes">The attributes to be updated</param>
        public async Task <List <CodeDeliveryDetailsType> > UpdateAttributesAsync(IDictionary <string, string> attributes)
        {
            UpdateUserAttributesRequest updateUserAttributesRequest =
                CreateUpdateUserAttributesRequest(attributes);

            UpdateUserAttributesResponse response = await Provider.UpdateUserAttributesAsync(updateUserAttributesRequest).ConfigureAwait(false);

            //Update the local Attributes property
            foreach (KeyValuePair <string, string> entry in attributes)
            {
                Attributes[entry.Key] = entry.Value;
            }

            return(response.CodeDeliveryDetailsList);
        }
예제 #5
0
        public async Task <RequestResult> UpdateUserDetails(User user)
        {
            RequestResult result = new RequestResult();

            try
            {
                GetUserResponse response = new GetUserResponse();

                if (cognitoUserSession != null && cognitoUserSession.IsValid())
                {
                    List <AttributeType> attributes = new List <AttributeType>();
                    attributes.Add(new AttributeType()
                    {
                        Name = "custom:firstname", Value = user.FirstName
                    });
                    attributes.Add(new AttributeType()
                    {
                        Name = "custom:lastname", Value = user.LastName
                    });

                    UpdateUserAttributesRequest rr = new UpdateUserAttributesRequest()
                    {
                        AccessToken    = cognitoUserSession.AccessToken,
                        UserAttributes = attributes
                    };

                    await provider.UpdateUserAttributesAsync(rr);

                    result.Data    = response;
                    result.Status  = true;
                    result.Message = "User Info updated successfully.";
                }
                else
                {
                    result.Status  = false;
                    result.Message = "Invalid Sesson";
                }
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = ex.Message;
            }

            return(result);
        }
예제 #6
0
        /// <summary>
        /// Updates the user's attributes defined in the attributes parameter (one at a time)
        /// using an asynchronous call
        /// </summary>
        /// <param name="attributes">The attributes to be updated</param>
        public void UpdateAttributesAsync(IDictionary <string, string> attributes, AsyncCallback callback = null)
        {
            UpdateUserAttributesRequest updateUserAttributesRequest =
                CreateUpdateUserAttributesRequest(attributes);

            Provider.UpdateUserAttributesAsync(updateUserAttributesRequest, r =>
            {
                if (r.Exception == null)
                {
                    //Update the local Attributes property
                    foreach (KeyValuePair <string, string> entry in attributes)
                    {
                        Attributes[entry.Key] = entry.Value;
                    }
                }

                callback?.Invoke(new AsyncResult(r.Exception));
            });
        }
 public void UpdateUserAttributesAsync(UpdateUserAttributesRequest request, AmazonServiceCallback <UpdateUserAttributesRequest, UpdateUserAttributesResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }