Access Control Service: Programmatically Accessing Identity Provider Information and Redirect URLs

In my last post I showed you that different redirect URLs trigger different response behaviors in ACS. Where did I actually get these URLs from?

The answer is simple – I asked ACS ;)

ACS publishes a JSON encoded feed that contains information about all registered identity providers, their display names, logos and URLs. With that information you can easily write a discovery client which, at the very heart, does this:

public void GetAsync(string protocol)
{
   
var url = string.Format(
"https://{0}.{1}/v2/metadata/IdentityProviders.js?protocol={2}&realm={3}&version=1.0"
,
        AcsNamespace,
       
"accesscontrol.windows.net"
,
        protocol,
        Realm);

    _client.DownloadStringAsync(
new Uri(url));
}

The protocol can be one of these two values: wsfederation or javascriptnotify. Based on that value, the returned JSON will contain the URLs for either the redirect or notify method.

Now with the help of some JSON serializer you can turn that information into CLR objects and display them in some sort of selection dialog.

The next post will have a demo and source code.

This entry was posted in Azure, IdentityModel. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s