使用Active Directory在C#中进行身份验证
我正在尝试创建一个需要在活动目录上进行用户身份验证以返回令牌的应用程序,但是我不确定如何正确使用它。
I am trying to create an application that requires user authentication over active directory to return a token, but I am not sure how to use it correctly.
我一直在查看通过ADFS(Active Directory联合身份验证服务)对用户进行身份验证但我不确定如何创建请求安全性令牌或如何正确使用它。
I've been looking at Authenticate user by ADFS (Active Directory Federation Service) but I am not sure how to create a Request Security Token or how to use it correctly.
有没有可用的可行示例?感谢您的帮助。
Are there any working examples for this available? Any help is appreciated.
这取决于您使用的应用程序类型。使用WIF通过ADFS进行
身份验证有两种形式:
-使用Asp.net Web表单或MVC进行被动身份验证。您可以参考这篇文章:在.Net 4.5中使用WIF身份和访问工具声明Aware MVC4应用
It depends on which type of application you are using. Authentication over ADFS using WIF comes in two flavors: - Passive authentication using Asp.net web form or MVC. You can refer to this article: Claims Aware MVC4 App using WIF Identity and Access tool in .Net 4.5
- 当应用程序是Web服务(如WCF)时的主动身份验证。本文可以为您提供帮助:在.Net 4.5中使用WIF声明感知WCF
- Active authentication when the application is a Web Service like WCF. This article can help: Claims Aware WCF using WIF in .Net 4.5
也取决于.NET您正在使用的框架,则需要下载以下任一程序:
-用于.NET 4.0的WIF运行时和WIF SDK
-用于.NET 4.5的身份和访问工具
Also depending on the .NET framework you are using, you will need to download either one of the following: - WIF Runtime and WIF SDK for .NET 4.0 - Identity and Access Tool for .NET 4.5