活动目录身份验证和自定义角色
我之前没有研究过 ActiveDirectory 会员提供程序,我对使用 AD 会员提供程序创建应用程序有疑问。如果我需要外部引用不同表(假设是自定义角色表)中的用户,那么我应该使用什么主标识符(外键)来标识保存角色和用户关系的表中的用户。
另外,关于用户的附加信息(除了 AD 详细信息之外)存储在哪里,例如用户名、部门、当前项目等。
是频繁拍摄的 Active Directory 快照并存储在数据库的表中,然后在 sql 中使用加入?
I havent worked on ActiveDirectory Membership provider earlier, I have a doubt on creating an application using AD membership provider. If I need to foreign reference a user in a different table(lets say a custom role table ) then what primary identifier(Foreign key) should I use to identify the user in the the table which holds the relation of Role and the users.
Also , where is the additional information(other than AD details) about the user is stored like User Name, Department, Current project etc.
Is a snapshot of Active directory taken frequently and stored in a table in the database which is then used in sql joins?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基本成员资格提供程序(以及派生提供程序,例如 ActiveDirectoryMembershipProvider)使用 UserName 作为功能键(对成员的查询期望将 UserName 作为键查询参数并返回单个 MembershipUser 对象)。这些查询返回具有基本成员资格信息(包括角色、电子邮件、评论等)的 MemberShipUser 对象。如果您希望将 ADMembership 提供程序与额外信息结合起来,最好使用 UserName 作为键来执行此操作。如果使用数据库,则存储额外数据会更容易,因为 .UpdateUser 仅提交 Email、Comment 和 IsApproved 属性。
不,不会拍摄快照,但您可以根据需要启用缓存。提供者需要信息时直接查询AD。
The base membership provider (and derived providers such as the ActiveDirectoryMembershipProvider) uses UserName as a functional key (queries for members expect UserName as the key query parameter and return a single MembershipUser object). Those queries return MemberShipUser objects that have basic membership information—including roles, email, comments, etc. If you want to combine the ADMembership Provider with extra information, you're best off using the UserName as the key to do so. Storing extra data is easier if you use a database because .UpdateUser only commits Email, Comment, and IsApproved properties.
And no, snapshots are not taken, though you can enable caching if you wish. The provider queries AD directly when it needs the information.
创建后的 aspnet 会员数据库驻留在 App_Data 文件夹中,并且非常方便,因为它很好地支持所有登录控件。用户角色可以通过 aspnet 配置管理器很好地管理。配置文件属性全部由数据库本身管理。
这样创建的数据库可以在服务器连接中看到。如果您分析数据库,您会发现除了用户名之外,每个用户都有一个特定的 userId。他们俩都是独一无二的。您无需复制其他表中的所有用户数据。您可以使用联接指定相关数据。用户登录后,您可以在后面的代码中通过
User.Identity.Name
(c#) 引用他/她。请使用 Visual Studio 中的服务器资源管理器查看数据库表,您可以查看表结构 -
aspnet_Users、aspnet_Membership、aspnet_Profile
等...The aspnet membership database when created resides in App_Data folder and is quite handy as it supports all the Login controls very well. The user roles can be very well managed by the aspnet configuration manager. The profile properties are managed all by the the database itself.
The database thus created can be seen in the server connections. If you analyze the datatbase you will see that every user has a specific userId apart from the username. Both of them are unique. You need not copy all user data in other tables. You can specify the related data using joins. Once a user is logged in, you can refer him/her by
User.Identity.Name
(c#) in your code behind.Kindly view the database tables using the Server Explorer in Visual Studio and you can view the tables structures --
aspnet_Users, aspnet_Membership, aspnet_Profile
etc...