OnValidateIdentity 禁用 MVC OWIN 记住我选项 [英] OnValidateIdentity disables the MVC OWIN remember me option

查看:16
本文介绍了OnValidateIdentity 禁用 MVC OWIN 记住我选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过安全戳激活 OWIN 注销无处不在功能并使用 OnValidateIdentity-回调的 CookieAuthenticationProviderSecurityStampValidator-class, 用户每次关闭浏览器都会注销.

When I activate the OWIN logout-everywhere feature via security stamps and use the OnValidateIdentity-Callback of the CookieAuthenticationProvider with the SecurityStampValidator-class, the user is logged out every time he closes the browser.

provider.OnValidateIdentity =
    SecurityStampValidator.OnValidateIdentity<MyUserManager, MyUser>(
        System.TimeSpan.FromSeconds(10),(manager, user) => {
            return user.GenerateUserIdentityAsync(manager);                                                       
        });

但是,当我自己在 OnValidateIdentity 回调中进行管道检查(查找和比较安全标记、拒绝或更新身份)时,一切似乎都正常.

However, when I do the plumbing myself (lookup and comparison of the security stamps, rejecting or renewing the identity) in the OnValidateIdentity-callback, everything seems to work fine.

这是一个已知的错误,还是我错过了什么?或者是否有关于 CookieAuthenticationProviderOnValidateIdentity 使用的好文档?
用谷歌挖掘只向我展示了一些简单的示例,但没有提供进一步的见解.

Is this a known bug, or do I miss here something? Or is there a good documentation about the CookieAuthenticationProvider and the use of OnValidateIdentity?
Digging with google only shows me some simple samples, but gives no further insight.

其他信息

  • 我使用自己的 UserStorage 实现来保存所有数据库中的数据
  • 我注意到每个页面请求调用两次UserStorage 的 GetSecurityStampAsync,当我使用我的实现,只调用一次.
  • 安装的身份版本为 2.0.1

推荐答案

此问题已在 ASP.NET Identity 2.2 中解决.请参阅 https://aspnetidentity.codeplex.com/workitem/2319

This is resolved in ASP.NET Identity 2.2. See https://aspnetidentity.codeplex.com/workitem/2319

这篇关于OnValidateIdentity 禁用 MVC OWIN 记住我选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆