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.