我正在使用基于身份验证的OAuth令牌开发网络API。
当生成令牌时,我会注册身份。
Sheet1.Range("C:C").AdvancedFilter xlFilterCopy, , Sheet3.Range("C1"), True
在特定时刻,我需要更改身份声明值。 我可以访问并操纵,但更改不会生效。
var identity = new ClaimsIdentity(context.Options.AuthenticationType);
identity.AddClaim(new Claim(ClaimTypes.Name, context.UserName));
identity.AddClaim(new Claim("CustomerId", usuario.IdCustomer.ToString()));
var principal = new GenericPrincipal(identity, new string[] { role.Profile.ToString() });
Thread.CurrentPrincipal = principal;
context.Validated(identity);
它可能会改变Thered.Principal中的身份值吗?
答案 0 :(得分:1)
我认为要减少拥有" ChangeSessionCustomer"的复杂性,我只是重新授权用户并分配新令牌。