如果您正在进行完全自制的实现,是否值得使用 ASP.NET 的成员资格/角色提供程序模型?
我正在开发一个将使用 Facebook Connect 来验证用户身份的网站。我们还在后端有一些数据库结构,用于通过用户的 Facebook 用户 ID 将用户与不同的组和角色关联起来。
简而言之,该项目的需求与 ASP.NET 的成员资格和角色提供程序模型定义的功能实际上并没有太多交叉。
鉴于此,除了与“内置”内容一起使用并通过 Membership 静态类访问它之外,是否有任何理由为该内容实现自定义成员资格提供程序?
I'm working on a website that will be using Facebook Connect to authenticate users. We also have some database structure on the backend to associate users via their Facebook user id to various groups and roles.
In short, the requirements for the project don't really have a lot of crossover with the functionality defined by ASP.NET's membership and roles provider model.
Given that, is there any reason to implement a custom membership provider for this stuff other than it working with the "built-in" stuff and having access to it via the Membership static class?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的。实现
MembershipProvider
(您实际上只需要实现
ValidateUser
方法),并且您可以访问一些非常有用的 ASP.NET 功能,这些功能至少简化了很多代码(我在想诸如Page.User< 之类的帮助程序/代码>
)。
Yes. It's very easy to implement a
MembershipProvider
(you really only need to implement theValidateUser
method) and you get access to some very useful asp.net features which at least simplify a lot of your code (I'm thinking of helpers likePage.User
).仅当您想要使用基于 ASP.NET 成员资格模型的内置组件或第三方组件时。
如果没有 - 不要为此烦恼,因为这会限制您的应用程序。
Only if you want to use built-in or a third-party components based on ASP.NET's Membership model.
If not - don't bother with this, as this will limit your application.
会员 API 是一种外观模式,因此当 Facebook 走上 MySpace 的道路并被下一个社交网络时尚所取代时,您可以更换不同的提供商。
因此,您可以实现一个以 Facebook 作为后台的自定义提供程序,并将其与其他东西交换以进行测试和面向未来的验证。
就完全而言,您的解决方案有多完整?会员 API 有一些很酷的东西,比如密码生成器,可以跟踪谁在线(根据登录的新近程度)。
The membership APIs are a facade pattern, so you can swap in a different provider when Facebook goes the way of MySpace and is replaced with the next social networking fad.
So you'd implement a custom provider with Facebook as the back and swap it with other things for testing and future proofing.
By completely, how complete is your solution? The membership API's have cool stuff like a password generator, will keep track of who's online (by recency of login).