Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/31.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.Net Core 2中AuthenticationResponseGrant的替代方案_Asp.net_Asp.net Core_Asp.net Identity - Fatal编程技术网

Asp.Net Core 2中AuthenticationResponseGrant的替代方案

Asp.Net Core 2中AuthenticationResponseGrant的替代方案,asp.net,asp.net-core,asp.net-identity,Asp.net,Asp.net Core,Asp.net Identity,在AspNet Core 2中是否有以下代码的替代方案 var identity = HttpContext.User.Identity as ClaimsIdentity; identity.RemoveClaim(Identity.FindFirst("AnnounceCount")); identity.AddClaim(new Claim("AnnounceCount", "Updated Value")); var authenticationManager = System.Web.

在AspNet Core 2中是否有以下代码的替代方案

var identity = HttpContext.User.Identity as ClaimsIdentity;
identity.RemoveClaim(Identity.FindFirst("AnnounceCount"));
identity.AddClaim(new Claim("AnnounceCount", "Updated Value"));
var authenticationManager = System.Web.HttpContext.Current.GetOwinContext().Authentication;
authenticationManager.AuthenticationResponseGrant = new AuthenticationResponseGrant(new ClaimsPrincipal(identity), new AuthenticationProperties() { IsPersistent = true });
我想更改cookie中的一些用户主体值,我不打算将这些值持久化到数据库中。在Asp Net Core版本2中是否可以使用类似于上述代码的代码?我研究了
OnValidatePrincipal
IClaimsTransformation
实现,但这两种实现都不符合我的需要。我是不是遗漏了什么


谢谢

你有没有弄明白这一点?“我遇到了一个类似的问题。@TodBirdsall很抱歉反应太晚。我还是不知道该怎么做。但是,执行
wait_httpContext.SignInAsync(“AuthenticationSchemeThat You Areusing”,new ClaimsPrincipal(identity))为我工作。