27 lines
850 B
C#
27 lines
850 B
C#
using Indotalent.Data.Entities;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.Extensions.Options;
|
|
using System.Security.Claims;
|
|
|
|
namespace Indotalent.Infrastructure.Authentication.Identity;
|
|
|
|
public class CustomClaimsPrincipalFactory : UserClaimsPrincipalFactory<ApplicationUser, IdentityRole>
|
|
{
|
|
public CustomClaimsPrincipalFactory(
|
|
UserManager<ApplicationUser> userManager,
|
|
RoleManager<IdentityRole> roleManager,
|
|
IOptions<IdentityOptions> optionsAccessor)
|
|
: base(userManager, roleManager, optionsAccessor)
|
|
{
|
|
}
|
|
|
|
protected override async Task<ClaimsIdentity> GenerateClaimsAsync(ApplicationUser user)
|
|
{
|
|
var identity = await base.GenerateClaimsAsync(user);
|
|
|
|
identity.AddClaim(new Claim(ClaimTypes.GivenName, user.FullName ?? string.Empty));
|
|
|
|
return identity;
|
|
}
|
|
}
|