WordPress OAuth & OpenID Connect Single Sign-On (SSO) plugin enables secure login into WordPress using ADFS as OAuth and OpenID Connect provider. You can also configure plugin using different custom providers and standard IDPs. It supports advanced Single Sign-On (SSO) features such as user profile Attribute mapping, Role mapping, etc. Here we will go through a guide to configure SSO between WordPress and ADFS . By the end of this guide, users should be able to login to WordPress from ADFS . To know more about other features we provide in WP OAuth Single Sign-On ( OAuth & OpenID Connect Client ) plugin, you can click here.
Pre-requisites : Download And Installation
- Log into your WordPress instance as an admin.
- Go to the WordPress Dashboard -> Plugins and click on Add New.
- Search for a WordPress OAuth Single Sign-On (SSO) plugin and click on <>Install Now.
- Once installed click on Activate.
Steps to configure ADFS Single Sign-On (SSO) Login into WordPress
1. Setup ADFS as OAuth Provider
- To perform SSO with ADFS as Provider, your application must be https enabled.
- Navigate to Server Manager Dashboard->Tools->ADFS Management.
- Navigate to ADFS->Application Groups. Right click on Application Groups & click on Add Application group then enter Application Name. Select Server Application & click on next.
- Copy Client Identifier. This is your Client ID. Add Callback URL in Redirect URL. You can get this callback URL from miniOrange OAuth Client Single Sign-On (SSO) plugin. Click on next.
- Click on Generate shared secret. Copy the Secret value. This is your Client Secret. Click on Next.
- On the Summary screen, click Next. On the Complete screen, click Close.
- Now, right-click on the newly added Application Group and select Properties.
- Click on Add application from App Properties.
- Click on the Add application. Then select Web API and click Next.
- On the Configure Web API screen, enter the domain name address into the Identifier section. Click Add. Click Next.
- On the Choose Access Control Policy screen, select Permit everyone and click Next.
- On the Configure Application Permission, by default openid is selected as a scope. You can select email and, profile as well, then click on next.
- On the Summary screen, click Next. On the Complete screen, click Close.
- On the Sample Application Properties click OK.
You have successfully configured ADFS as OAuth Provider for achieving ADFS login into your WordPress Site.
2. Setup WordPress as OAuth Client
You have successfully configured WordPress as OAuth Client for achieving user authentication with ADFS Single Sign-On (SSO) login into your WordPress Site.
You have successfully configured WordPress as OAuth Client for achieving user authentication with ADFS Single Sign-On (SSO) login into your WordPress Site.
3. User Attribute Mapping
- User Attribute Mapping is mandatory for enabling users to successfully login into WordPress. We will be setting up user profile attributes for WordPress using below settings.
Finding user attributes
- Go to Configure OAuth tab. Scroll down and click on Test Configuration.
- You will see all the values returned by your OAuth Provider to WordPress in a table. If you don't see value for First Name, Last Name, Email or Username, make the required settings in your OAuth Provider to return this information.
- Once you see all the values in Test Configuration, go to Attribute / Role Mapping tab, you will get the list of attributes in a Username dropdown.
4: Role Mapping [Premium]
- Click on “Test Configuration” and you will get the list of Attribute Names and Attribute Values that are sent by your OAuth provider.
- From the Test Configuration window, map the Attribute Names in the Attribute Mapping section of the plugin. Refer to the screenshot for more details.
- Enable Role Mapping: To enable Role Mapping, you need to map Group Name Attribute. Select the attribute name from the list of attributes which returns the roles from your provider application.
Eg: Role
- Assign WordPress role to the Provider role: Based on your provider application, you can allocate the WordPress role to your provider roles. It can be a student, teacher, administrator or any other depending on your application. Add the provider roles under Group Attribute Value and assign the required WordPress role in front of it under WordPress Role.
For example, in the below image. Teacher has been assigned the role of Administrator & Student is assigned the role of Subscriber.
- Once you save the mapping, the provider role will be assigned the WordPress administrator role after SSO.
Example: As per the given example, Users with role ‘teacher’ will be added as Administrator in WordPress and ‘student’ will be added as Subscriber.
5. Steps to fetch User Groups as Claims
- Open the ADFS Management tool located under the Tools menu at the top right of the Server Manager.
- Select the Application Groups folder item in the left sidebar.
- Double click on the group added earlier, then double click on the Web API application.
- Select the tab named Issuance Transform Rules. Click the Add Rule button at the bottom.
- Select Send LDAP Attributes as Claims and click next.
- Give the rule a name, for example Roles and select "Active Directory" as the "Attribute Store".
- In the table below, select Token-Groups Unqualified Names in the first column and type roles into the second column.
- Open the ADFS Management tool located under the Tools menu at the top right of the Server Manager.
- Select the Application Groups folder item in the left sidebar.
- Double click on the group added earlier, then double click on the Web API application.
- Select the tab named Issuance Transform Rules. Remove any rules you may have already added and click on the Add Rule button at the bottom.
- Select Send Claims Using a Custom Rule and click next.
- Give the rule the name StoreRoles and paste the following into the Custom rule field:
c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"] => add(store = "Active Directory", types = ("roles"), query = ";tokenGroups;{0}", param = c.Value);
- Click finish and add yet another rule.
- Again, select Send Claims Using a Custom Rule and click next.
- Give this rule the name IssueRoles and paste the following into the Custom rule field:
c:[Type == "roles", Value =~ "^Prefix.+"] => issue(claim = c);
- The part containing //"^Prefix.+"// is a regex expression used to filter the windows groups sent as part of the claims. In this case we only accept the windows groups starting with "Prefix". Adjust this to meet your needs.
- Click finish.
6. Sign In Settings
- The settings in Single Sign-On (SSO) Settings tab define the user experience for Single Sign-On (SSO). To add a Okta login widget on your WordPress page, you need to follow the below steps.
In this Guide, you have successfully configured ADFS Single Sign-On (SSO) by configuring ADFS as OAuth Provider and WordPress as OAuth Client using our WP OAuth Single Sign-On ( OAuth / OpenID Connect Client ) plugin.This solution ensures that you are ready to roll out secure access to your WordPress site using ADFS login credentials within minutes.
Additional Resources
Mail us on oauthsupport@xecurify.com for quick guidance(via email/meeting) on your requirement and our team will help you to select the best suitable solution/plan as per your requirement.