Creating both an Identity and Role Claim for a SharePoint 2010 Claims Auth Application

For various reasons getting a claims based authentication web application up and working correctly with both an identity claim and a role claim has been troublesome to say the least.  So I'm going to share here the steps just around creating the claims and the SPTrustedIdentityTokenIssuer.

1. Create the identity claim:

$map = New-SPClaimTypeMapping -IncomingClaimType "" -IncomingClaimTypeDisplayName "EmailAddress" -SameAsIncoming

2. Create the role claim:

$map2 = New-SPClaimTypeMapping -IncomingClaimType " " -IncomingClaimTypeDisplayName "Role" -SameAsIncoming

3. Include BOTH claims when creating your SPTrustedIdentityTokenIssuer:

$ap = New-SPTrustedIdentityTokenIssuer -Name "ADFS v2" -Description "ADFS v2" -Realm "yourRealmName" -ImportTrustCertificate $yourCert -ClaimsMappings $map,$map2 -SignInUrl "https://urlToYourAdfsServer/adfs/ls" -IdentifierClaim ""

One of the keys here is that you need to do this WHEN you create your token issuer, you can't add it after the fact.  This is one of the limitations of SPTrustedIdentityTokenIssuers that I will discuss in another post.

Comments (6)

  1. alexandrad9x says:

  2. Stephen says:

    What if I have multiple Roles?  When I try to add another role I get an error message stating " New-SPTrustedIdentityTokenIssuer : An item with the same key has already been added. "

    Using your example I would add [ $map3 = New-SPClaimTypeMapping -IncomingClaimType "…/role " -IncomingClaimTypeDisplayName "Role2" -SameAsIncoming ] and then add $map3 to the -ClaimsMappings section of the " New-SPTrustedIdentityTokenIssuer " command.

    Any thoughts?

  3. Dan says:

    @Stephen, It sounds like you need to remove your existing Id Issuer first. You can't update the mappings once it's created. Use Remove-SPTrustedIdentityTokenIssuer to remove it, then try adding it with all 3 mappings. Also, see the "Planning Considerations…" post at…/planning-considerations-for-claims-based-authentication-in-sharepoint-2010.aspx.

  4. Lee says:

    I got ADFS and SharePoint 2010 working with the Identity and Role claims you have mention above.  However I can't figure out one thing.  When I add a single user from the AD, I can log in with that user and everything works fine.  The problem is when I try to add an AD group such as Domain Users, none of my AD users are able to log in.  Any ideas?

  5. DSAF says:

  6. Anonymous says:

    I recently witnessed a problem that proved to be fairly difficult to track down so I thought I would