Thi*_*lva 5 forms-authentication claims-based-identity session-cookies wif asp.net-mvc-4
我正在使用System.IdentityModel使用具有声明主体的表单身份验证来验证ASP.NET MVC4 Web应用程序中的用户.(基于这篇文章的代码:http://brockallen.com/2013/01/26/replacing-forms-authentication-with-wifs-session-authentication-module-sam-to-enable-claims-aware-identity/)
我的ClaimsBasedAuthenticationService类从SessionSecurityToken发出SAM cookie,一切都很好......除了我刚才注意到它没有创建会话cookie作为HTTPOnly或要求他们需要SSL.当我调试代码时,我可以看到在调试器中正确设置了CookieHandler对象上的那些属性,但是创建的最终会话cookie根本没有标记HTTPOnly和Secure标志.
我有web.config行将这些显式设置为true,如下所示:
<system.web>
<httpCookies httpOnlyCookies="true" requireSSL="true" />
<authentication mode="Forms">
<forms ... requireSSL="true" />
</authentication>
...
</system.web>
<system.identityModel.services>
<federationConfiguration>
<cookieHandler requireSsl="true" hideFromScript="true" />
</federationConfiguration>
</system.identityModel.services>
Run Code Online (Sandbox Code Playgroud)
有人可以告诉我,为了让我的FedAuth cookie从脚本(HTTPOnly)中隐藏并需要SSL,我还缺少其他东西吗?
小智 0
我使用相同的实现,但使用 Fiddler2 时没有看到您的问题。但是,也许问题与您的调试工具有关?在 IE10 调试工具中,仅在首次收到 cookie 时才会显示 secure 和 http only 标志。如果您使用 Chrome 调试工具进行检查,您应该会看到所有请求上都正确显示了标志。
| 归档时间: |
|
| 查看次数: |
2613 次 |
| 最近记录: |