配置文件提供程序和 Windows 身份验证

发布于 2024-08-05 06:56:22 字数 448 浏览 2 评论 0原文

我们所有的内部项目都使用 Active Directory 身份验证和模拟,因为这是公司公认的安全策略。

我目前有一个场景,我需要存储用户配置文件信息,并且我想使用 ASP.Net 标准的内置配置文件提供程序。我之前很高兴地将其与表单身份验证一起使用,但是我找不到任何有关如何在使用 Windows 身份验证时实现此功能的有用信息。

  • 有什么方法可以让配置文件提供程序与 Windows 身份验证一起使用?
  • 我是否会被迫创建自定义配置文件提供程序?

数据将存储在数据库中,而不是 Active Directory 中。然而,如果后者是可能的,一些指导将不胜感激。

注释

  • 我不需要使用角色提供程序,这是由 AD 处理的。
  • 我不确定是否需要实施 AD 会员资格提供程序才能使配置文件提供程序正常工作。

All our inhouse projects use Active Directory authentication and impersonation as this is the accepted security policy for the company.

I currently have a scenario where I need to store user profile information, and I would like to use the built-in Profile Providers which is standard in ASP.Net. I've previously used this happily with Forms Authentication, however I can't find any helpful information on how to implement this when using Windows Authentication.

  • Is there any way I can get just the Profile Provider working with Windows Authentication out of the box?
  • Will I be forced to create a custom profile provider?

The data will be stored in the database, not in Active Directory. However if the latter is possible some guidance would be appreciated.

Notes

  • I don't need to use the Role provider, this is handled by AD.
  • I am not sure if I need to implemented the AD Membership provider to get the Profile Provider to work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷血 2024-08-12 06:56:22

您可以只使用标准的 SqlProfileProvider。使用 Context.User.Identity.Name 属性作为用户名。 ASP.NET 将在其标准表中创建一个用户条目来对其进行跟踪。角色提供程序还可以与 Windows 身份验证结合使用。有关详细信息,请参阅此链接:http://weblogs.asp.net/scottgu/pages/Recipe_3A00_-Implementing-Role_2D00_Based-Security-with-ASP.NET-2.0-using-Windows-Authentication-and -SQL-Server.aspx

如果您在 web.config 中启用并配置配置文件提供程序,您可以像这样使用它:

ProfileBase profile = ProfileBase.Create(Context.User.Identity.Name, true);
profile.SetPropertyValue("MyProfileProperty", propertyValue);
profile.Save();

祝您好运!

you can just use the standard SqlProfileProvider. As username, use the Context.User.Identity.Name property. ASP.NET will create a user entry in it's standard tables himself to keep track of it. The role provider also works in combination with windows authentication. See this link for more information: http://weblogs.asp.net/scottgu/pages/Recipe_3A00_-Implementing-Role_2D00_Based-Security-with-ASP.NET-2.0-using-Windows-Authentication-and-SQL-Server.aspx

if you enable and configure the profile provider in the web.config, you can use it like this:

ProfileBase profile = ProfileBase.Create(Context.User.Identity.Name, true);
profile.SetPropertyValue("MyProfileProperty", propertyValue);
profile.Save();

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文