Пример #1
0
        /// <summary>
        /// Gets the attribute verification code for the specified attribute using
        /// an asynchronous call
        /// </summary>
        /// <param name="medium">Name of the attribute the verification code is being sent to.
        /// Should be either email or phone_number.</param>
        /// <returns>Returns the delivery details for the attribute verification code request</returns>
        public virtual Task GetAttributeVerificationCodeAsync(string medium)
        {
            GetUserAttributeVerificationCodeRequest getAttributeCodeRequest =
                CreateGetUserAttributeVerificationCodeRequest(medium);

            return(Provider.GetUserAttributeVerificationCodeAsync(getAttributeCodeRequest));
        }
Пример #2
0
        public ApiIdentityResult VerifyToken(string token, String attributeName)
        {
            ApiIdentityResult ret = new ApiIdentityResult();

            try
            {
                var request = new GetUserAttributeVerificationCodeRequest()
                {
                    AccessToken   = token,
                    AttributeName = attributeName
                };

                using var provider = GetCognitoIdentityProvider();
                var response = provider.GetUserAttributeVerificationCodeAsync(request).GetAwaiter().GetResult();
                if (response.HttpStatusCode != System.Net.HttpStatusCode.OK)
                {
                    ret.SetFailed(-100, response.ResponseMetadata.ToString());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                ret.SetFailed(-101, ex.Message);
            }

            return(ret);
        }
Пример #3
0
        /// <summary>
        /// Gets the attribute verification code for the specified attribute using
        /// an asynchronous call
        /// </summary>
        /// <param name="medium">Name of the attribute the verification code is being sent to.
        /// Should be either email or phone_number.</param>
        /// <returns>Returns the delivery details for the attribute verification code request</returns>
        public void GetAttributeVerificationCodeAsync(string medium, AsyncCallback callback = null)
        {
            GetUserAttributeVerificationCodeRequest getAttributeCodeRequest =
                CreateGetUserAttributeVerificationCodeRequest(medium);

            Provider.GetUserAttributeVerificationCodeAsync(getAttributeCodeRequest, r => callback?.Invoke(new AsyncResult(r.Exception)));
        }
        /// <summary>
        /// Gets the attribute verification code for the specified attribute using
        /// an asynchronous call
        /// </summary>
        /// <param name="medium">Name of the attribute the verification code is being sent to.
        /// Should be either email or phone_number.</param>
        /// <returns>Returns the delivery details for the attribute verification code request</returns>
        public async Task <CodeDeliveryDetailsType> GetAttributeVerificationCodeAsync(string medium)
        {
            GetUserAttributeVerificationCodeRequest getAttributeCodeRequest =
                CreateGetUserAttributeVerificationCodeRequest(medium);

            GetUserAttributeVerificationCodeResponse response = await Provider
                                                                .GetUserAttributeVerificationCodeAsync(getAttributeCodeRequest).ConfigureAwait(false);

            return(response.CodeDeliveryDetails);
        }
Пример #5
0
        private GetUserAttributeVerificationCodeRequest CreateGetUserAttributeVerificationCodeRequest(string attributeName)
        {
            EnsureUserAuthenticated();

            GetUserAttributeVerificationCodeRequest getAttributeCodeRequest = new GetUserAttributeVerificationCodeRequest()
            {
                AccessToken   = SessionTokens.AccessToken,
                AttributeName = attributeName
            };

            return(getAttributeCodeRequest);
        }
 public void GetUserAttributeVerificationCodeAsync(GetUserAttributeVerificationCodeRequest request, AmazonServiceCallback <GetUserAttributeVerificationCodeRequest, GetUserAttributeVerificationCodeResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }