コード例 #1
0
        /// <summary>
        /// todo add comment
        /// </summary>
        /// <param name="sessionToken"></param>
        /// <returns></returns>
        public async Task <AssociateSoftwareTokenResponse> AssociateSoftwareTokenAsync(string sessionToken)
        {
            EnsureUserAuthenticated();

            AssociateSoftwareTokenRequest request = new AssociateSoftwareTokenRequest
            {
                AccessToken = SessionTokens.AccessToken,
                Session     = sessionToken
            };

            return(await Provider.AssociateSoftwareTokenAsync(request).ConfigureAwait(false));
        }
        public async Task <string> GetAuthenticatorKeyAsync(TUser user, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();
            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            var request = new AssociateSoftwareTokenRequest
            {
                AccessToken = user.SessionTokens.AccessToken
            };

            try
            {
                var response = await _cognitoClient.AssociateSoftwareTokenAsync(request, cancellationToken).ConfigureAwait(false);

                return(response.SecretCode);
            }
            catch (AmazonCognitoIdentityProviderException e)
            {
                throw new CognitoServiceException("Failed to retrieve Software Token key for the Cognito User", e);
            }
        }
 public void AssociateSoftwareTokenAsync(AssociateSoftwareTokenRequest request, AmazonServiceCallback <AssociateSoftwareTokenRequest, AssociateSoftwareTokenResponse> callback, AsyncOptions options = null)
 {
     throw new System.NotImplementedException();
 }