我使用asp.net身份作为我的安全框架,我知道regenerateIdentity
中的app.UseCookieAuthentication
。
我正在向我的用户添加一些声明,例如fullname,可能通过个人资料页面更新的电子邮件,如何在更新用户个人资料时更新当前用户声明?
答案 0 :(得分:2)
这是我用的, 使用以下方法再次使用此用户注销并重新登录
private async Task SignInAsync(User user, bool isPersistent)
{
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
var identity = await user.GenerateUserIdentityAsync(UserManager);
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
}