One of the cornerstones of ADFS is the concept of federation (one would hope anyway, given the name), which is defined as a user’s authentication process across applications, organizations, or companies. Or simply put, my company Contoso is a partner with Fabrikam. Fabrikam employees need access to one of my applications, so we create a federated trust between my application and their user store, so they can log into my application using their internal Active Directory. In this case, via ADFS.

Next we have the trust between our ADFS and our partner company’s STS. If the company had ADFS installed, we could just create a trust between the two, but lets go one step further and give anyone with a Live ID access to this application. Therefore we need to create a trust between the Live ID STS and our ADFS server.

This is easier than most people may think. We can just use Windows Azure Access Control Services (v2). ACS can be set up very easily to federate with Live ID (or Google, Yahoo, Facebook, etc), so we just need to federate with ACS, and ACS needs to federate with Live ID.

Creating a trust between ADFS and ACS requires two parts. First we need to tell ADFS about ACS, and second we need to tell ACS about ADFS.

To explain a bit further, we need to make ACS a Claims Provider to ADFS, so ADFS can call on ACS for authentication. Then we need to make ADFS a relying party to ACS, so ADFS can consume the token from ACS. Or rather, so ACS doesn’t freak out when it see’s a request for a token for ADFS.

This may seem a bit confusing at first, but it will become clearer when we walk through the process.

Next I need to create a relying party in ACS, telling it about ADFS. To do that browse to the Relying party applications section within the ACS management portal and create a new relying party:

Because ADFS natively supports trusts, I can just pass in the metadata for ADFS to ACS, and it will pull out the requisite pieces:

Once that is saved you can create a rule for the transform under the Rule Groups section:

For this I’m just going to generate a default set of rules.

This should take care of the ACS side of things. Next we move into ADFS.

Within ADFS we want to browse to the Claims Provider Trusts section:

And then we right-click > Add Claims Provider Trust

This should open a Wizard:

Follow through the wizard and fill in the metadata field:

Having Token Services that properly generate metadata is a godsend. Just sayin’.

Once the wizard has finished, it will open a Claims Transform wizard for incoming claims. This is just a set of claims rules that get applied to any tokens received by ADFS. In other words, what should happen to the claims within the token we receive from ACS?

In this case I’m just going to pass any claims through:

In practice, you should write a rule that filters out any extraneous claims that you don’t necessarily trust. For instance, if I were to receive a role claim with a value “Administrator” I may not want to let it through because that could give administrative access to the user, even though it wasn’t explicitly set by someone managing the application.

Once all is said and done, you can browse to the RP, redirect for authentication and will be presenting with this screen:

After you’ve made your first selection, a cookie will be generated and you won’t be redirected to this screen again. If you select ACS, you then get redirected to the ACS Home Realm selection page (or directly to Live ID if you only have Live ID).

Author Spotlight

Steve Syfuhs is a security software developer. He has spent the last few years building identity systems and is currently working at Kaseya as a Lead Member of the Technical Staff on the Identity and Access team after Scorpion Software was acquired. He has also been a Microsoft Developer Security MVP since 2011.