OWIN饼干VS FormsAuthentication [英] OWIN Cookies vs FormsAuthentication

查看:224
本文介绍了OWIN饼干VS FormsAuthentication的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有使用OWIN基于cookie的身份验证在Forms身份验证基于Cookie的身份验证用于开发MVC Web应用程序的任何主要的优势是什么?

Are there any major advantages of using OWIN cookie-based authentication over Forms Authentication cookie-based authentication for developing MVC web applications?

我想问的原因是我不会使用任何基于实体框架挂钩OWIN认证。我已经建立了基于窗体身份验证的应用多年,并已经能够做的事情一样创建一个管理员(快超时),匿名用户不同的认证令牌和注册用户。使用车票,我能够实行全民登出,存储自定义属性等的的UserData部分。

The reason I ask is that I would not be using any of the Entity Framework based hooks for OWIN authentication. I've built apps based on Forms Authentication for years and have been able to do things like create different authentication tokens for admins (faster timeouts), anonymous users, and registered users. Using the UserData portion of the ticket I was able to implement universal sign out, store custom properties, etc.

其中的一个优点OWIN可能是可测性,但我不敢肯定。该ClaimsIdentity是种不错的,因为我可以很容易地存储和访问自定义字段,而无需序列化/属性反序列化为的UserData。其他的事情我应该考虑?

One of the advantages to OWIN might be testability, but I'm not sure. The ClaimsIdentity is kind of nice because I can easily store and access custom fields without having to serialize/deserialize the properties into UserData. Other things I should consider?

推荐答案

cookie认证的中间件可以在任何OWIN主机包括IIS中运行,而FormsAuthenticationModule可以在IIS只能运行+ ASP.NET。如果您有不同类型的主机托管现在或将来的需要,CAM是一个更好的选择。另一个特点中间件有但不是FAM是,该cookie分块。如果您的用户数据是饼干足够大,超过允许的大小限制,浏览器简单地停止发送身份验证cookie,而中间件块大饼干分成多个小饼干和重组他们的收据。

Cookie authentication middleware can run in any OWIN host including IIS, whereas FormsAuthenticationModule can run only in IIS+ASP.NET. If you have a present or future need for hosting in different types of hosts, CAM is a better option. Another feature middleware has but not FAM is, the cookie chunking. If your user data is big enough for the cookie to be over the allowed size limit, browsers simply stop sending the authentication cookie whereas the middleware chunks big cookies into multiple small cookies and reassembles them on receipt.

这篇关于OWIN饼干VS FormsAuthentication的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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