/// <summary> /// Sets a flag indicating whether the specified <paramref name="user"/> has two factor authentication enabled or not, /// as an asynchronous operation. /// </summary> /// <param name="user">The user whose two factor authentication enabled status should be set.</param> /// <param name="enabled">A flag indicating whether the specified <paramref name="user"/> has two factor authentication enabled.</param> /// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns> public virtual async Task SetTwoFactorEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); if (user == null) { throw new ArgumentNullException(nameof(user)); } var request = new AdminSetUserSettingsRequest { Username = user.Username, UserPoolId = _pool.PoolID, MFAOptions = new List <MFAOptionType>() { new MFAOptionType() { AttributeName = CognitoAttributesConstants.PhoneNumber, DeliveryMedium = enabled ? DeliveryMediumType.SMS : null // Undocumented SDK behavior: sending null disables SMS 2FA } } }; try { await _cognitoClient.AdminSetUserSettingsAsync(request, cancellationToken).ConfigureAwait(false); } catch (AmazonCognitoIdentityProviderException e) { throw new CognitoServiceException("Failed to set 2FA settings for the Cognito User", e); } }
public void AdminSetUserSettingsAsync(AdminSetUserSettingsRequest request, AmazonServiceCallback <AdminSetUserSettingsRequest, AdminSetUserSettingsResponse> callback, AsyncOptions options = null) { throw new System.NotImplementedException(); }