且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 .Net 4.5 控制台应用程序对 AD FS 进行身份验证

更新时间:2023-02-16 17:18:45

最简单的方法是使用 .NET 4.5 中的 WSTrustChannelFactory.

The easiest way is to use the WSTrustChannelFactory from .NET 4.5.

在此处查看 RequestSecurityToken 方法:http://leastprivilege.com/2012/11/16/wcf-and-identity-in-net-4-5-external-authentication-with-ws-trust/

See the RequestSecurityToken method here: http://leastprivilege.com/2012/11/16/wcf-and-identity-in-net-4-5-external-authentication-with-ws-trust/

获得令牌后,通过相应的令牌处理程序运行它以将其转换为 ClaimsPrincipal.

After you have the token you run it through the corresponding token handler to turn it into a ClaimsPrincipal.

我在 github 上的库中有辅助方法和绑定:https://github.com/thinktecture/Thinktecture.IdentityModel.45

I have helper methods and bindings in my library on github: https://github.com/thinktecture/Thinktecture.IdentityModel.45

(查找 WCF 文件夹、WSTrustClient 和 Extensions 文件夹).

(look for the WCF folder, WSTrustClient and the Extensions folder).