简体   繁体   English

Asp.Net核心UserClaimsPrincipalFactory丢失索赔

[英]Asp.Net Core UserClaimsPrincipalFactory lost claims

I am extending UserClaimsPrincipalFactory class for generting custom claims and everything works OK. 我正在扩展UserClaimsPrincipalFactory类以生成自定义声明,并且一切正常。 The problem is that after some time, couple hours usually, all custom claims are lost. 问题是通常经过几个小时后,所有自定义声明都会丢失。 Only user name claim is available. 仅用户名声明可用。

What could be the reason? 可能是什么原因?

The problem was that I have override the wrong method. 问题是我已经覆盖了错误的方法。 I should override GenerateClaimsAsync instead of CreateAsync. 我应该重写GenerateClaimsAsync而不是CreateAsync。 Now it works. 现在可以了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM