Authentication against AD FS from .Net 4.5 Console Application

I'm going to use AD FS to authenticate a user in a .NET 4.5 application. I can not find examples of requesting / receiving a token from a console application and converting this token to a ClaimsPrinciple. The only examples I can find are the WCF configuration, and I really would like to see the actual code that can do this in its simplest form.

I installed AD FS and I think I configured it to receive requests. I created a relying party, given its key and assigned a couple of claims to it.

Can someone point me in the right direction or what should I do now in my console application to send authentication requests to it?

thanks

+6
source share
1 answer

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

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

Once you have the token, you run it through the appropriate token handler to turn it into a ClaimsPrincipal.

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

(find the WCF folder, the WSTrustClient folder, and the Extensions folder).

+8
source

All Articles