我已使用以下代码添加了声明:
我已使用以下代码添加了声明
var claims = new List<Claim>
{
new Claim(Constants.ClaimTypes.BUSINESS_ID, user.BusinessID.ToString()),
new Claim(Constants.ClaimTypes.NAME, user.FullName),
new Claim(Constants.ClaimTypes.IMAGE, user.ProfileUrl ?? user.LogoUrlEn ?? user.LogoUrlEn ?? ""),
new Claim(Constants.ClaimTypes.EMAIL, user.Email),
new Claim(Constants.ClaimTypes.USER_ID, user.UserID.ToString()),
new Claim(Constants.ClaimTypes.ROLE, user.RoleID.ToString()),
new Claim(Constants.ClaimTypes.RIGHTS, string.Join(',', user.RolesRights.Select(S => $"{S.EntityName}|{S.EntityID}|{S.RightID}")))
};
var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
var authProperties = new AuthenticationProperties
{
AllowRefresh = true,
IsPersistent = true,
RedirectUri = "/Authentication/Login"
};
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme,
new ClaimsPrincipal(claimsIdentity),
authProperties);
当有人更新个人资料照片时,我需要更新认领信息,我该如何做?
我尝试了几种解决方案,但都没有成功。
目前,当有人更新个人资料照片时,必须注销并重新登录才能看到效果。