更新时间:2023-02-16 16:57:18
最简单的方法是使用.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).