2016-08-18 7 views

Odpowiedz

1

Można spróbować IUserClaimsPrincipalFactory

ClaimsPrincipal claimsPrincipal = await _claimsPrincipalFactory.CreateAsync(user); 
((ClaimsIdentity) claimsPrincipal.Identity).AddClaim(new Claim("user_id", user.Id.ToString())); 
-1

używam ClaimsIdentityFactory(). Oto mój kod:

public async Task<ClaimsIdentity> 
GenerateUserIdentityAsync(UserManager<ApplicationUser> manager, 
          string AuthenticationType) 
    { 
     var factory = new ClaimsIdentityFactory<ApplicationUser>(); 
     return await factory.CreateAsync(manager, this, AuthenticationType); 
    } 
+0

Nie ma ClaimsIdentityFactory w Core. Tylko UserClaimsPrincipalFactory. Podobnie nie ma ClaimsIdentityAsync, tylko CreateUserPrincipalAsync. – dapug

Powiązane problemy