Access Control Service: Programmatically Accessing Identity Provider Information and Redirect URLs
Posted
by Your DisplayName here!
on Least Privilege
See other posts from Least Privilege
or by Your DisplayName here!
Published on Thu, 23 Jun 2011 05:24:27 GMT
Indexed on
2011/06/23
8:28 UTC
Read the original article
Hit count: 235
Azure
|IdentityModel
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.
© Least Privilege or respective owner