Skip to main content
 
Go Search
Home
Categories
Bloggers
How To Add ADFS 2.0 as a Federated Identity Provider in SharePoint 2010
By: Travis Nielsen | Posted: December 29, 2009 at 11:30 PM

One of the most intriguing of the many new features that SharePoint 2010 brings to the table is a completely new mechanism handle user identity.  This mechanism is based on the Windows Identity Foundation (formerly known as “Geneva”) and it opens the door to many new possibilities for securely and seamlessly integrating SharePoint with partner organizations, Internet social networking applications (think Twitter and Facebook), 3rd party identity providers (Yahoo!, Windows Live, Google), other SharePoint farms, and line-of-business applications somewhere on the corporate network.  Many of these benefits are explained in Venky Veeraraghavan’s presentation on SharePoint and identity at PDC 2009.  If you haven’t seen it, I highly recommend you check it out before reading further.

This article is intended to help fill some gaps in the existing documentation to help you get your SharePoint 2010 environment working in “Claims Mode” in conjunction with an instance of Active Directory Federation Services (ADFS) 2.0. Its not a terribly difficult process, but it can be pretty intimidating for those not versed in all the jargon associated with it.

The Design

We’re actually going to closely follow the instructions already provided in this TechNet article: Configure the Security Token Service. These instructions basically help you create a custom Federated Identity Provider to work with SharePoint. In this case, that will be an ADFS 2.0 server. Instead of connecting to SharePoint and authenticating directly to Active Directory, unauthenticated users will instead get redirected by SharePoint to a page hosted by ADFS 2.0. Users will authenticate to ADFS 2.0 using Windows Authentication, have various attributes about them packaged up as claims, and get re-directed back to SharePoint as an authenticated security principal. There’s actually a bit more going on than that, but as an introduction (and description of the end-user experience), that’ll suffice for now. Implementing this with ADFS 2.0 will provide the foundation for some pretty cool stuff down the road, which I’ll be posting in the near future.

The steps outlined in the TechNet article use mostly PowerShell.  I’ll be using a combination of PowerShell and Central Admin here.

The Setup

You can accomplish this using a single server. It’s assumed here you have SharePoint 2010 running against a local instance of SQL 2008 or SQL 2008 R2 CTP. If this server happens to be a Domain Controller, that’s fine. In my case, I’m using Windows 2008 R2 (64-bit, of course!).

Step 1: Create a Claims-Enabled Web Application

All you have to do here is run through the standard process in Central Administrator. Simply click “Create new Web Application” and select the “Claims Based Authentication” radio-button in the Authentication section.

image

Once the web application is created, you’ll need to create a site collection as well.  In my case, I just created one at the root “/”. When all this is done, you won’t notice anything is different at all. Indeed, I believe Microsoft is looking at making Claims Based Authentication the default mode of authentication when SharePoint 2010 RTMs. Behind the scenes, the SPUser object accessing SharePoint is actually based on a series of claims.

image

NOTE: The above screenshot displays claims using a custom web part. Check out my earlier blog for instructions on how to create and deploy it. This is highly recommended since it provides full visibility into the claims that make up a user identity in a claims mode web application. Needless to say, seeing and understanding these claims is fundamental to understanding how this stuff works within SharePoint.

Its worth stopping here to point out a few things. For starters, SharePoint Foundation ships with a fully functional Security Token Service (STS). When you install SharePoint 2010, the STS is operational and configured to use the local Active Directory instance to authenticate users and provide SharePoint a formal description each identity as a series of claims. When used in this way, the STS acts as an Identity Provider (IP-STS).  You can see this in the above screenshot. Some claims like group membership are provided by Active Directory. Other claims like ‘name’ and ‘userid’ are manufactured by the SharePoint STS. In IIS, you’ll find the web services associated with the STS in the SecurityTokenService application under “SharePoint Web Services”. A very good description of all this can be found in this TechNet article: http://technet.microsoft.com/en-us/library/ee428302(office.14).aspx.

So you don’t need to do anything to leverage the built-in STS as an Identity Provider. Indeed, this is the default setting. However, you can configure the SharePoint STS to trust a different IP-STS and thus act as a relying party (RP-STS). This is how you can extend SharePoint to leverage other systems to provide user identity and will be the focus for the rest of this article.

Step 2: Install and Configure ADFS 2.0

ADFS 2.0, formerly known as “Geneva Server” is now in Release Candidate stage at the time this article is being written. It can be downloaded here. There are a couple of “gotchas” you should be aware of before installing it:

  1. By default, ADFS 2.0 installs into the Default Web Site. It also sets up a self-signed certificate for that site so be sure you understand the impact to anything else you may have running in Default Web Site before you move forward.
  2. After the installer completes, you must run a configuration wizard to set the ADFS instance up. The GUI version of the this wizard will create a new instance of SQL 2008 Express Edition to store all configuration data. I already had a full instance of SQL 2008 R2 CTP running, so I wanted to leverage that instead of adding more software to my test virtual machine. The only way to specify an existing SQL instance is to use the command line version of the configuration wizard: http://technet.microsoft.com/en-us/library/dd727952(WS.10).aspx 

After configuration is complete, launch the ADFS 2.0 Management console and validate the certificate being used for Service Communications. This should be the same certificate that is bound to the Default Web Site. In my case, I chose to use a fully qualified domain name (pbdev.com). Make any changes necessary to ensure the Service Communications certificate and SSL binding in IIS is fully operational.

image

As a test, you should now be able to browse to the FederationMetadata.xml file at the following URL: https://<<SERVERNAME>>/FederationMetadata/2007-06/federationmetadata.xml

image

Now, export your Token-Signing Certificate to the c:\ drive. The quickest way to do this is to right-click the certificate in the ADFS 2.0 Management Console and select “View Certificate…”

image

Then, navigate to the Details tab and click the button labeled Copy to File…  This will launch the Certificate Export Wizard. Follow the wizard to export the certificate as a DER encoded binary X.509 (.CER) file.  For simplicity, I recommend saving the certificate to the C:\ drive. You will need this file in the following PowerShell script.

Step 3: Add ADFS 2.0 as a Federated Identity Provider in SharePoint

This is the part where we whip out some PowerShell. As far as I know, the current SharePoint 2010 Beta does not provide a place in Central Administration to do this add a federated identity provider. Fortunately, the commands are quite straightforward.

$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("c:\[YOUR_STS_SIGNING_CERT].cer")
$map1 = New-SPClaimTypeMapping "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" -IncomingClaimTypeDisplayName "EmailAddress" -SameAsIncoming
$realm = "urn:" + $env:ComputerName + ":adfs"
$signinurl = "https://[YOUR_SERVER_NAME]/adfs/ls/"
$ap = New-SPTrustedIdentityTokenIssuer -Name "ADFS20Server" -Description "ADFS 2.0 Federated Server" -Realm $realm -ImportTrustCertificate $cert -ClaimsMappings $map1 -SignInUrl $signinurl -IdentifierClaim $map1.InputClaimType

HINT: You can copy and paste the above PowerShell commands into a text file. Save the text file with the .ps1 extension and you will be able to execute the file from within PowerShell. Be sure to launch “SharePoint 2010 Management Shell” as this will load all the SharePoint related extensions.

You should now be able add the Federated Identity Provider in Central Administration. Navigate to Web Applications Management, highlight the web application, and click the Authentication Providers button in the ribbon. You should now see your new provider in the Federated Identity Provider section of the Edit Authentication window.

image

SIDE NOTE: Its interesting to see in this screenshot how multiple identity providers can be added to the same zone. That’s a big change from MOSS 2007!

At this point, if you browse to your claims-enabled SharePoint site you’ll find a new screen where you need to specify what Identity Provider to use for access. This happens because we have both our Federated Identity Provider and Windows Authentication enabled for this zone. It should be noted that this screen can be customized with logic to automatically determine the correct provider based on the client IP address (for example). For now, we need to stick with Windows Authentication because ADFS 2.0 isn’t configured yet to work with SharePoint.

image

Step 4: Create a Second Web Application for Testing with ADFS 2.0

I’ve had issues getting claims-enabled web applications that have both a custom Federated Identity Provider and standard Windows Authentication provider enabled. When starting out, I recommend creating a new web application from scratch with only the custom identity provider selected in the Identity Providers section. These are the instructions provided in the aforementioned TechNet article. You can either delete and re-create the web application you created in Step 1 or create an entirely new web application.

image

In order to federate with ADFS 2.0, the web application will require an SSL certificate. Since you’ll likely be doing this for a full URL (domain.com), you should look at using SSL Diagnostics Version 1.1 to generate the certificate. A good blog that covers steps for creating a self-signed certificate can be found here. An alternate approach would be to add the Active Directory Certificate Services role to your server and request a web server certificate from within IIS. Either way works fine.

Also, assuming you’re working with a single server or virtual machine I strongly recommend disabling loopback authentication checking. Otherwise, you’re likely to experience authentication issues going forward.

When you create the site collection, you’ll have to grant an account rights to administer it. Otherwise, you will end up with Error: Access Denied….even when authenticated with an administrative account. Keep in mind, we’re no longer using Windows Integrated authentication here, so we need assign permissions to identities with certain claims.

image

In this example, I’m going to grant administrator rights to user identities where the EmailAddress claim equals: admin@pbdev.com. This is done via the user picker, but with a bit of a twist as you can see from the following screenshot.

image

As you can see from the above screenshot, claim mappings that were configured in Step 3 are available in the user picker.

image

You need to be sure your administrative account actually has this email address configured in the E-Mail field in Active Directory.

image

Once this is done, we are ready to set up ADFS to authenticate users and provide claims to our new SharePoint web application.

Step 5: Add SharePoint as a Relying Party in ADFS 2.0

Now we need to create the trust relationship with SharePoint 2010 in ADFS.  This involves launching the ADFS 2.0 Management console, right-clicking the Relying Party Trusts folder, and selecting Add Replying Party Trust…   As you can imagine, this invokes the “Add Relying Party Trust Wizard”.

At Select Data Source, be sure to specify the radio button for “Enter data about the relying party manually” and click Next

At Specify Display Name, enter the display name and any helpful notes about the Relying Party and click Next.

At Choose Profile, select AD FS 2.0 profile.

At Configure Certificate, click Next.  We will not be encrypting the SAML tokens in this example and this is not a requirement.

At Configure URL, select the checkbox for “Enable support for the WS-Federation Passive protocol” and specify the URL for your site collection with /_trust/ appended to the end.  NOTE: SSL is a requirement here.

image

At Configure Identifiers, remove the default value and enter in the value stored in the “ProviderRealm” attribute of the SPTrustedIdentityTokenIssuer object.  This was provided in Line 3 of the earlier PowerShell script. You can also get this by running Get-SPTrustedIdentityTokenIssuer in PowerShell.

image 

image

At Choose Issuance Authorization Rules, ensure the radio button for “Permit all users to access this relying party” and click Next.

At Ready to Add Trust, you can then review the configuration information and complete the Wizard.

We now have one final step to take.  Right-click the Relying Party Trust and select Edit Claim Rules.

At Choose Rule Type, select Send LDAP Attributes as Claims and click Next.

Create the new rule as follows:

image 

Step 6: Test Access to SharePoint

We should now be at a point where we can log into SharePoint via ADFS.  Browse to your site collection and with any luck, you should now get passed directly into SharePoint.  If you’re the curious type, I’d recommend tracing the redirects using Fiddler.  Assuming you have the claims viewer web part installed in your root site collection, you should see something similar to the following.

image

Its interesting to compare these claims with those listed in Step 1 of this article. And note the source for the Email Address claim type is TrustedProvider: ADFS20Server.

Step 7: Grant Read Access to ADFS Authenticated Users

Next, we’re going to add any user who has been authenticated by ADFS 2.0 to have read access to our site collection.  This is done in a similar fashion as the end of Step 4 above.  When signed into the site with an administrative account, go to Site Actions > Site Permissions. Select the Viewers group and click New > Add Users.  At the next pop-up window, simply click the magnifying glass at the top.  This will result in the following screen:

image

Double-click “All Users (ADFS20Server)” to add these users to the group.

image 

You should now be able to sign into the claims-enabled web application using a different, non-administrative account.

OK, I fully admit this isn’t the most exciting thing to see in the world. But as I mentioned earlier, this configuration is the foundation for doing some powerful things like plugging in various 3rd party identity providers. In an upcoming article, I’ll show you how to add a custom STS to ADFS 2.0 as a Claims Provider and use that STS to gain access to SharePoint. That Claims Provider will happen to be OpenID.


  Comments   Add Comment   Share It  
  Your Name:
  Your Email: **will not be displayed
  Comment Title:
* Comments:
  If you cannot read the code, please
click here to get a new one. You won't
lose your comments by doing so.
* Security Code:
   
  
  
* Your Name:
* Your Email: **will not be displayed
* Recipient's Email:
* Subject:
  If you cannot read the code, please
click here to get a new one. You won't
lose your comments by doing so.
* Security Code:
  
  
  
Marcio , Any luck
By: Nandakumar | Posted: July 10, 2010 at 11:37 AM
Hi Marcio, I am facing same issue and even in firefox too. Even if I cleared the cache no luck.. Any inuts appreciated
The same client browser session has made '6' requests in the last '11' seconds
By: Marcio | Posted: June 15, 2010 at 11:46 AM
Hi all, Has anyone seen this error after the configuration ? An error occurred during processing of the request. MSIS7042: . Contact your administrator for details. Additional data: 1199ad22-a6ff-4491-80a7-f3a0bea3b73f I keep getting this error on IE only and the only workaround I found was to clean the cache and restart the IE session. The only other posts I found related to this suggest that is because the relying party server may have an underscore on its name which is not my case. Any ideas ? Thank you. --MD
Add Custom STS to ADFS 2.0 and gain access to Sharepoint 2010
By: Nandakumar Sivaraman | Posted: May 30, 2010 at 1:13 AM
Hello, First of all thank you very much for the above blog. I am looking forward for following scenrio We have a custom STS built using WIF and want to use as an generic entity across our domain. We are presently getting to portal strategy using Sharepoint 2010 and want to use this STS as claim provider and gain access to Sharepoint 2010. In you blog , I saw your last statment that you are planning to come with an article for same thing. Can you please give me the link if you already have this one.
working
By: eric | Posted: May 28, 2010 at 9:22 AM
Just to report back that I have got it working finally. A couple things to note: 1) the replying party identifier is case sensitive. (duh?) 2) the SP Powershell script missed a line to add the ADFS signing token to the list of SP STS trusted root certificates. $root = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("c:\ADFSRoot.cer") New-SPTrustedRootAuthority -Name "ADFS Token Signing Root Authority" -Certificate $root Source:http://blogs.technet.com/b/speschka/archive/2010/02/13/root-of-certificate-chain-not-trusted-error-with-claims-authentication.aspx thx!
Posted: May 26, 2010 at 3:19 PM
Hi Eric, I got my problem figured out... By default ADFS deploys is application pool/site on port 80 on the IIS. However there was another site on the same web server running on that port. As a result the ADFS site was not running because it was conflicting with the other site. Once I shutdown the other site and started the ADFS site, I was able to access the Sign On page. I hope this help. Marcio.
Webpage cannot be found
By: eric | Posted: May 25, 2010 at 12:41 AM
I am too having this page not found error. And I am using only 1 server. "Either way I am being able to browse the FederationMetadata.xml, however when I try to access my site I am getting an error (Page/resource not found), and I am seeing that the request is being redirected to my ADFS server."
Using sepparate servers for AD FS and SP/IIS
By: Marcio | Posted: May 24, 2010 at 10:48 AM
Hi Travis, In my configuration I am running the AD FS (and ADDS) in one server, and have SharePoint and IIS running on another server. All under the same domain. On Step 2 when a certificate is imported on AD FS, in my case does that certificate need to be from the server where AD FS run or the server where SharePoint/IIS is running ? Either way I am being able to browse the FederationMetadata.xml, however when I try to access my site I am getting an error (Page/resource not found), and I am seeing that the request is being redirected to my ADFS server. Thank you in advance for your help. Marcio.
By: Rahul | Posted: April 19, 2010 at 11:13 PM
Travis, This is a great article. Based on this article for using ADFS as identity provider with SharePoint 2010, I want to understand that if I have two set of users (Employees in AD and Client in ADAM) to be authenticating against SharePoint; can I use "NTLM Authentication" option to authenticate Employees, thus using SharePoint itself as Identity provider and use "ADFS 2.0" option for Clients only in the ADAM repository. Please suggest.
Two Server deployment
By: Mario | Posted: April 10, 2010 at 6:03 PM
Thanks a lot for the guide, I got the error "The root of the certificate chain is not a trusted root authority", but I'm sure I have all .cer imported on the Trusted Root Auth for the (Local Computer). Any Idea ?
No joy
By: Henry | Posted: March 16, 2010 at 12:32 AM
I have checked and checked and I am sure that the certificates are aligned. I have recreated everything from scratch and checked the certificate shown in Get-SPTrustedIdentityTokenIssuer against the signing certificate in ADFS 2.0 and they are the same. The certificate is in the trusted root CA's. I'll see if I can get another ADFS server and try on a different machine. Thank you again for your help.
Re: Issues with encryption
By: Travis | Posted: March 14, 2010 at 2:36 PM
Henry, When you created the trusted identity provider in SharePoint, are you sure you added the ADFS signing certificate? $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2("c:\adfs_20_signing.cer") $ap = << stuff here >> -ImportTrustCertificate $cert If so, is the signing certificate trusted by the server running SharePoint 2010? You can verify this by double clicking the .crt (or .cer) file and looking for warnings there. In my examples, everything is running on a single server and its possible I might have added the signing certificte to the server's certificate store and forgot to document it. If you are using multiple servers, its likely than manually adding the signing certificate to the SharePoint server's certificate store (Trusted Root Certificates) will be necessary.
Issue with encryption
By: Henry | Posted: March 14, 2010 at 4:16 AM
This has been very helpful however I have a problem with SharePoint processing the SAML token. As you indicate the example is not using encryption, however if I do not add an encryting certificate for the SharePoint RP in ADFS I get an error which I think is indicating that SharePoint expects the SAML token to be signed - see Error 1 below. If I then add a certificate for the RP in ADFS2.0 using the Encryption tab I get an error indicating that the key cannot be resolved - see Error 2 below. I cannot see how I can set the key in SharePoint so that it can resolve the token (Error 2). An alternative for now would be to allow the token without encryption (Error 1) but I cannot see how to do this either. Any help would be appreciated. Thank you Henry Errors: Error1 - no encryption: ID4220: The SAML assertion is either not signed or the signature's KeyIdentifier cannot be resolved to a SecurityToken. Ensure that the appropriate issuer tokens are present on the token resolver. To handle advanced token resolution requirements, extend Saml11TokenSerializer and override ReadToken Error 2 - key cannot be resolved ID4036: The key needed to decrypt the encrypted security token could not be resolved from the following security key identifier ...... Ensure that the SecurityTokenResolver is populated with the required key
Re: Thanks for step-by-step article
By: Travis | Posted: March 10, 2010 at 9:49 AM
@SPIdentity: Wow. Thanks for the feedback, guys! I'm a huge believer as well. And I agree, this is just the beginning! I'm now turning my attention to identity delegation.
Thanks for step-by-step article
By: SPIdentity | Posted: March 9, 2010 at 12:36 AM
We think this is one of the most exciting things to see in the world ;-) Seriously, we think the power of using Claims to address customer issues are quite amazing and we are just scratching the surface. Cannot wait to see the OpenID STS!
RE: Great Post! Have an issue in SignIn Url?
By: Travis | Posted: February 26, 2010 at 9:06 AM
You should use either "localhost" (if SP2010 and ADFS are installed on the same server), or the computer name (if on a different server). More accurately, you need to use the host name that the Default Web Site the ADFS 2.0 server answers to. If you have multiple IP addresses configured on the server, you may need to clarify the bindings in IIS. You do not have to create any sort of login page to accomplish any of this. Hope this helps....
Great Post! Have an issue in SignIn Url?
By: Naveen | Posted: February 26, 2010 at 5:55 AM
This is a great post and gave us consolidated steps to configure SharePoint STS to ADFS 2.0 STS; but we are facing an issue. Please help us in resolving the issue: My SharePoint web app is not able to redirect to any login page when I choose the ADFS 2.0 IP STS. I believe that SignInUrl does not exist. I have tried for the below two urls: (We assumed that [YOUR_SERVER_NAME] is ADFS 2.0 IP STS) $signinurl = "https://[YOUR_SERVER_NAME]/adfs/ls/" $signinurl = "https://[YOUR_SERVER_NAME]/FederationPassive" Please help me where I am going wrong? Does this mean that we have to build a SignIn page for my ADFS 2.0 and shows all the RP.
 

 About Travis Nielsen

ArchitectTravis Nielsen is an architect and founding member of PointBridge. He has over 12 years of experience in the IT industry designing and implementing solutions for the Windows Server platform throughout... [more]

 Tag Cloud

 External Links

 ‭(Hidden)‬ Admin Links