How to call WCF Http service for SiteMinder

I am trying to call WCF 4 Http web services that are hosted in an ASP.NET application. The service is protected by SiteMinder.

I was wondering how I can programmatically call a web service, or rather, what information I need to pass for authorization in SiteMinder to access my resources.

I am making a request from an ASP.NET application running on the same server, so I have access to the authentication cookie.

+3
source share
1 answer

First get the SiteMinder authentication token as follows:

    private string ObtainSiteMinderSession()
    {
        var cookie = Request.Cookies["SMSESSION"];
        return cookie != null ? cookie.Value : string.Empty;
    }

Then pass this token just like the web service calls (using Microsoft.Http.dll):

using Microsoft.Http;
using Microsoft.Http.Headers;

...

var Client = new HttpClient(baseUri);

// Add SMSESSION
var smCookie = new Cookie();
smCookie.Add("SMSESSION", ObtainSiteMinderSession());
Client.DefaultHeaders.Cookie.Add(smCookie);

using (var httpRequest = new HttpRequestMessage(Verbs.GET, "/LoadData/"))
{ ... }
+6
source

All Articles