多种身份验证方法,或实施基于角色的身份验证?
我有一个问题正在尝试尽可能顺利地解决,并尽可能保持安全和灵活!
我有一个网络应用程序,其中有两种用户;后端用户(受信任的用户;管理员!)和客户(前端用户;不以同样的方式受信任)!他们确实处理数据库中的一些相同数据,但客户只能执行后端用户可以执行的操作的子集(例如 Salesforce 用户和客户“自助服务门户”)!
我还想在数据库中为后端用户和客户创建 2 个单独的表(表名为 User 和 Customer,它们都有用户名和密码行)...
我应该使用 2 种不同的身份验证方法来实现这一点,或者我应该使用一种身份验证方法并使用角色(然后我会跳过数据库中包含用户名和密码的两个表,并让所有表都使用用户表)?
I have a problem I am trying to solve as smooth as possible, and also keep it as safe and flexible as possible!
I have a web app where I have 2 kinds of users; Back end users (trusted users; Admins!), and Customers (Front end users; not trusted in the same way)! They do work on some of the same data in the database, but the Customers can only do a subset of what the Back end users can do (like Salesforce users and customers "Self Service Portal")!
I also want to have 2 separate tables in the database for the back end users and the customers (tables are named User and Customer, and they both have a username and password row)...
Should I implement this with 2 different authentication methods, or should I use one authentication method and use roles instead (Then I would skip having 2 tables I the database with username and password, and let all use the User table)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您发现最终需要为用户维护多个角色(根据我的经验,这种情况经常发生),以下数据库结构将允许扩展。
The following database structure would allow for scaling if you find that you need to eventually maintain multiple roles for users (which happens alot from my experience).
我建议您使用一张表并仅设置角色。如果做得正确,这将更容易维护。当然,如果它们有共同的字段(例如姓名),情况也是如此。
I would suggest you use one table and just setup roles. If properly done this will be easier to maintain. Of course this is the case if they have common fields such as name, surname.