asp.netweb-serviceswifsamlsaml-2.0

How to get SAML token using C#/ASP.NET


The basic requirement I have is to call a webservice that uses SAML token. As part of this the first step is to get the token from IdentityProvider.

This is what I have:

Now I am not sure where to begin developing a client in ASP.NET (4.5) to connect to STS and get the token.

Any pointers to get me started?

Note: I tried making an HttpWebRequest passing in the certificate but get some connection error. I am not even sure if that is the way. Also reading about WebClient and HttpClient classes.


Solution

  • I used the WSTrustChannelFactory for this. This article helped me implement that: http://leastprivilege.com/2012/11/16/wcf-and-identity-in-net-4-5-external-authentication-with-ws-trust/

    Also here's portion of my code: How to pass a certificate to WSTrust to get Saml Token