43 lines
2.6 KiB
C#
43 lines
2.6 KiB
C#
// 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
|
|
{
|
|
/// <summary>
|
|
/// Provides an abstraction for a store containing users' password hashes..
|
|
/// </summary>
|
|
/// <typeparam name="TUser">The type encapsulating a user.</typeparam>
|
|
public interface IUserPasswordStore<TUser> : IUserStore<TUser> where TUser : class
|
|
{
|
|
/// <summary>
|
|
/// Sets the password hash for the specified <paramref name="user"/>, as an asynchronous operation.
|
|
/// </summary>
|
|
/// <param name="user">The user whose password hash to set.</param>
|
|
/// <param name="passwordHash">The password hash to set.</param>
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
|
|
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
|
|
Task SetPasswordHashAsync(TUser user, string passwordHash, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Gets the password hash for the specified <paramref name="user"/>, as an asynchronous operation.
|
|
/// </summary>
|
|
/// <param name="user">The user whose password hash to retrieve.</param>
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
|
|
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, returning the password hash for the specified <paramref name="user"/>.</returns>
|
|
Task<string> GetPasswordHashAsync(TUser user, CancellationToken cancellationToken);
|
|
|
|
/// <summary>
|
|
/// Gets a flag indicating whether the specified <paramref name="user"/> has a password, as an asynchronous operation.
|
|
/// </summary>
|
|
/// <param name="user">The user to return a flag for, indicating whether they have a password or not.</param>
|
|
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
|
|
/// <returns>
|
|
/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the specified <paramref name="user"/> has a password
|
|
/// otherwise false.
|
|
/// </returns>
|
|
Task<bool> HasPasswordAsync(TUser user, CancellationToken cancellationToken);
|
|
}
|
|
} |