简体   繁体   English

Active Directory自定义用户配置文件/属性?

[英]Active Directory Custom User Profiles/Attributes?

I am currently using the ActiveDirectoryMembershipProvider just for authentication on an internal business app built in asp.net. 我目前正在使用ActiveDirectoryMembershipProvider仅用于在asp.net内置的内部业务应用程序进行身份验证。 This works like a charm. 这就像一个魅力。

I am now looking to add some functionality to handle custom profile information for a user, ideally also stored in Active Directory. 我现在希望添加一些功能来处理用户的自定义配置文件信息,理想情况下也存储在Active Directory中。

For a simple example let's just say the custom attribute is FavoriteColor. 举一个简单的例子,我们只说自定义属性是FavoriteColor。 Then the goal would be for my app to be able to read in this custom attribute for the authenticated user. 然后我的目标是让我的应用程序能够为经过身份验证的用户读取此自定义属性。

I have looked into ADAM a bit. 我已经看了一下ADAM。 That looks like it would be great for a Role Provider, but I haven't really found anything that indicates it would work well for a Profile Provider or if it would even let me store custom attributes like FavoriteColor. 对于角色提供者来说,这看起来很棒,但我还没有找到任何表明它适用于Profile Provider的东西,或者它甚至可以让我存储像FavoriteColor这样的自定义属性。 Maybe someone knows better? 也许有人知道更好?

I'm also pretty new to Active Directory so maybe there is even an option to store custom user attributes (like FavoriteColor) within it? 我也是Active Directory的新手,所以也许甚至可以选择在其中存储自定义用户属性(如FavoriteColor)?

In general I am just looking for ideas about the best way to implement this? 总的来说,我只是在寻找有关实施此方法的最佳方法的想法?

Thanks! 谢谢!

Yes, it is possible to add such an attribute to the AD user object, but you have to be very cautious. 是的,可以将这样的属性添加到AD用户对象,但您必须非常谨慎。 Changes made when modifying the schema cannot be undone. 修改架构时所做的更改无法撤消。 It is all too easy to severely damage your Active Directory tree. 严重损坏Active Directory树太容易了。

To make schema changes, you can use the Active Directory Schema Editor MMC snap-in. 若要进行架构更改,可以使用Active Directory架构编辑器MMC管理单元。 You must register the snap-in before you can use it. 您必须先注册该管理单元才能使用它。 To register the Active Directory Schema Editor, open a command prompt, type regsvr32 schmmgmt.dll 要注册Active Directory架构编辑器,请打开命令提示符,键入regsvr32 schmmgmt.dll

Then you can load the snap-in in MMC, add a new FavouriteColour attribute, and link it to the user class. 然后,您可以在MMC中加载管理单元,添加新的FavouriteColour属性,并将其链接到用户类。

Unless you really know what you are doing though, it's probably safer to use a DB table for such fields. 除非你真的知道自己在做什么,否则在这些字段中使用数据库表会更安全。 This site has some more information. 网站提供了更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM