Authenticating against AD FS from a .Net 4.5 Console App

后端 未结 1 2078
长情又很酷
长情又很酷 2021-02-09 22:51

I\'m in the process of getting my head round using AD FS to authenticate a user in a .NET 4.5 app. I can\'t find any examples of requesting/receiving the token from a console ap

1条回答
  •  暖寄归人
    2021-02-09 23:09

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

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

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

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

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

    0 讨论(0)
提交回复
热议问题