You can edit the Trust Policy file to change the name and the namespace of each claim in the token sent by the Federation Services account partner (FS-A) to the Federation Services resource partner (FS-R). This cannot be used to change the namespaces of claims in cookies.
For example, for an e-mail claim, you can configure the namespace to be "https://treyresearch" rather than the default value, "http://schemas.xmlsoap.org/claims". You can also change the name of the e-mail claim from "EmailAddress" to "EMAIL".
The Trust Policy files must have the same configuration on both the FS-A and the FS-R. If they do not match, the token sent by the FS-A will be rejected by the FS-R.
Note that ADFS ignores the values in <TrustNamespace>, <PolicyNamespace>, and <AddressingNamespace>. If these values are not matched in the Trust Policy files on both the FS-A and the FS-R, this will not cause the FS-R to reject the token sent by the FS-A.
The following code snippet shows how to configure these values:
using System;
using System.Web.Security.SingleSignOn;
// ...
TrustPolicy tp = TrustPolicy.Load(@"c:\windows\systemdata\adfs\trustpolicy.xml", false);
Namespaces configureNS = new Namespaces();
configureNS.AddressingNamespace = "treyresearch";
configureNS.CommonNameAttributeName = "test-commonclaim";
configureNS.CommonNameAttributeNamespace = "https://treyresearch";
configureNS.CommonNameNameIdentifierFormat = "http://testCNIDFormat";
configureNS.EmailAttributeName = "test-emailclaim";
configureNS.EmailAttributeNamespace = "https://treyresearch";
configureNS.EmailNameIdentifierFormat = "http://treyresearch";
configureNS.GroupAttributeName = "test-group";
configureNS.GroupAttributeNamespace = "https://treyresearch";
configureNS.NameValueAttributeNamespace = "http://treyresearch";
configureNS.PolicyNamespace = "https://treyresearch";
configureNS.TrustNamespace = "https://treyresearch";
configureNS.UpnAttributeName = "test-upn";
configureNS.UpnAttributeNamespace = "https://treyresearch";
configureNS.UpnNameIdentifierFormat = "http://treyresearch";
TrustRealm partner = null;
//Check if this is a account partner.
partner = (TrustRealm)tp.TrustedRealms[trustRealmURI];
/* If the URI is not found in the list of account partners, we look in the list of resource partners. */
if (null == partner)
{
partner = (TrustRealm)tp.TrustingRealms[trustRealmURI];
}
// If we still don't find this partner, throw an exception.
if (null == partner || String.Empty.Equals(partner))
{
throw new Exception(String.Format("Partner: {0} not found in Trust Policy file", trustRealmURI));
}
//Configure the new namespaces for this partner realm.
partner.Namespaces = newNS;