如何针对不同的用途不同UserTokenProvider寿命。身份2.0 [英] How to have different UserTokenProvider lifespans for different uses. Identity 2.0
问题描述
在IdentityConfig我们可以设置UserTokenProvider具有一个用于所产生的每个令牌过期寿命。 IdentityConfig在启动时运行。
In the IdentityConfig we can set the UserTokenProvider to have an expiration lifespan that is used for every token that is generated. IdentityConfig is run at startup..
manager.UserTokenProvider =
new DataProtectorTokenProvider<ApplicationUser>(dataProtectionProvider.Create("ASP.NET Identity"))
{ TokenLifespan = TimeSpan.FromMinutes(60) };
但有可能发生在你的控制器一个新的令牌时:
But is it possible when generating a new token in your controller:
var code = await UserManager.GeneratePasswordResetTokenAsync(user.Id);
那你可以使用不同的使用期限为用户/令牌?
感谢名单
That you can use a different lifespan for that user/token? Thanx
推荐答案
我知道这个问题是很老,但因为它在搜索中出现:现在没有了可能。还有为它工作项目上codePLEX( HTTPS://aspnetidentity.$c$cplex。 COM /工作项目/ 2228 )
I know the question is quite old but since it comes up in searches: it's not currently possible. There's a workitem for it on codeplex (https://aspnetidentity.codeplex.com/workitem/2228)
这篇关于如何针对不同的用途不同UserTokenProvider寿命。身份2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!