aspnetcore/src/Microsoft.AspNet.Identity/IUserClaimsPrincipalFactory.cs

24 lines
1.1 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.Security.Claims;
using System.Threading.Tasks;
namespace Microsoft.AspNet.Identity
{
/// <summary>
/// Provides an abstraction for a factory to create a <see cref="ClaimsPrincipal"/> from a user.
/// </summary>
/// <typeparam name="TRole">The type encapsulating a user.</typeparam>
public interface IUserClaimsPrincipalFactory<TUser>
where TUser : class
{
/// <summary>
/// Creates a <see cref="ClaimsPrincipal"/> from an user asynchronously.
/// </summary>
/// <param name="user">The user to create a <see cref="ClaimsPrincipal"/> from.</param>
/// <param name="authenticationType">The name of the authentication method the <paramref name="user"/> was sourced from.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous creation operation, containing the created <see cref="ClaimsPrincipal"/>.</returns>
Task<ClaimsPrincipal> CreateAsync(TUser user);
}
}