Adding claim mapping to existing provider in SPS 2010

I’m playing a little bit with Sharepoint 2010 and the claims model (probably more posts on this topic will follow) where ADFS v2 (yes, it has shipped in case you missed it) acts as a trusted claims provider for SPS 2010. It is a great scenario which I think will find its use in many organizations, however re-thinking all access and role models for Sharepoint applications might be a tough work at start. More on this approach soon.  Right now, a quick configuration tip …


(cc) Tiger Pixel

… if you have defined trusted claim provider in Sharepoint, like ADFS 2 server for example, part of its configuration is a set of claims it can provide to SPS and mapping of these claims. In claim provider properties it looks like this:

PS C:\> (Get-SPTrustedIdentityTokenIssuer -Identity "ADFS20Server").ClaimTypes

What if you want to add another one for example “Role”. Nothing simpler – run Powershell and you will find the Add-SPClaimTypeMapping cmdlet which should allow you to do exactly what is requested. Problem is that when you take a look at an example provided in TechNet documentation or the cmdlet help you will get examples, which not necessary fits cmdlet syntax, like this one:

Get-SPTrustedIdentityProvider –Name "LiveIDSTS" | Add-SPClaimTypeMapping -IncomingClaimType "" -IncomingClaimTypeDisplayName "PUID" -LocalClaimType

What to do then? Simple example how to add new claim mapping to trust provider is presented below:

$map2 = New-SPClaimTypeMapping "" -IncomingClaimTypeDisplayName "Role" –SameAsIncoming
$ti = Get-SPTrustedIdentityTokenIssuer -Identity "ADFS20Server"
Add-SPClaimTypeMapping -Identity $map2 -TrustedIdentityTokenIssuer $ti

Quick check:

PS C:\> (Get-SPTrustedIdentityTokenIssuer -Identity "ADFS20Server").ClaimTypes

Done !