Using Audiences with Claims Auth Sites in SharePoint 2010

Something you may not have thought of around using SAML claims is the impact on the Audiences feature in SharePoint 2010.  By default we will only import users from directories like Active Directory and a few LDAP sources.  The problem is that the account name for most SAML claims users is something like i:05:t|adfs with roles|  So can you use audiences with these claims users?  The answer is yes, fortunately, but you need to do some work.

The first and most important thing is you’ll need to create profiles for these people.  You can do it manually or you can write some code to do it.  But you need to create these profiles and use the funky i:05:t|adfs with roles| string as the Account Name.  Then populate the other fields with data that you want to use in your audiences.

Next, go ahead and create new audiences.  You won’t be able to use a user-based for the audience, like member of a group (at least not without writing more code, which is beyond what I’m going to discuss in this posting).  Instead you’ll use the property-based audience.  In my scenario I used the Office field from the profile as the basis for my audience.  I created two profiles for two different claims users and gave one an Office of Clackamas and one Goodyear.  So in my new audience, I created a rule where Office = Clackamas and called it Clackamas Employees.  After I compiled my audience I could see that its membership included my claims user.

To further validate it, I then went into my claims site and targeted a web part at an audience.  The only thing that was a little unexpected is that the picker was not properly populated with a list of all the audiences.  However, when I searched for Clackamas Employees it did find the audience I had created.  I selected that audience for the web part targeting and saved my changes.  Finally I navigated to the site as my two different claims users.  The one that was part of the Clackamas Employees audience saw the part, while the other did not.

Leave a Reply

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

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

Google photo

You are commenting using your Google 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