// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Threading; using System.Threading.Tasks; namespace Microsoft.AspNet.Identity { /// /// Provides an abstraction for the storage and management of user email addresses. /// /// The type encapsulating a user. public interface IUserEmailStore : IUserStore where TUser : class { /// /// Sets the address for a , as an asynchronous operation. /// /// The user whose email should be set. /// The email to set. /// The used to propagate notifications that the operation should be canceled. /// The task object representing the asynchronous operation. Task SetEmailAsync(TUser user, string email, CancellationToken cancellationToken); /// /// Gets the email address for the specified , as an asynchronous operation. /// /// The user whose email should be returned. /// The used to propagate notifications that the operation should be canceled. /// The task object containing the results of the asynchronous operation, the email address for the specified . Task GetEmailAsync(TUser user, CancellationToken cancellationToken); /// /// Gets a flag indicating whether the email address for the specified has been verified, true if the email address is verified otherwise /// false, as an asynchronous operation. /// /// The user whose email confirmation status should be returned. /// The used to propagate notifications that the operation should be canceled. /// /// The task object containing the results of the asynchronous operation, a flag indicating whether the email address for the specified /// has been confirmed or not. /// Task GetEmailConfirmedAsync(TUser user, CancellationToken cancellationToken); /// /// Sets the flag indicating whether the specified 's email address has been confirmed or not, as an asynchronous operation. /// /// The user whose email confirmation status should be set. /// A flag indicating if the email address has been confirmed, true if the address is confirmed otherwise false. /// The used to propagate notifications that the operation should be canceled. /// The task object representing the asynchronous operation. Task SetEmailConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken); /// /// Gets the user, if any, associated with the specified, normalized email address, as an asynchronous operation. /// /// The normalized email address to return the user for. /// The used to propagate notifications that the operation should be canceled. /// /// The task object containing the results of the asynchronous lookup operation, the user if any associated with the specified normalized email address. /// Task FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken); /// /// Returns the normalized email for the specified , as an asynchronous operation. /// /// The user whose email address to retrieve. /// The used to propagate notifications that the operation should be canceled. /// /// The task object containing the results of the asynchronous lookup operation, the normalized email address if any associated with the specified user. /// Task GetNormalizedEmailAsync(TUser user, CancellationToken cancellationToken); /// /// Sets the normalized email for the specified , as an asynchronous operation. /// /// The user whose email address to set. /// The normalized email to set for the specified . /// The used to propagate notifications that the operation should be canceled. /// The task object representing the asynchronous operation. Task SetNormalizedEmailAsync(TUser user, string normalizedEmail, CancellationToken cancellationToken); } }