Getting Started in 5 minutes
We are using Azure AD because it is the most popular IdP used but the steps are similar to all IdPs. This guide assumes you've installed the plugin and are using Craft CMS Pro, which is required.
# Configure "My Provider", Craft as an SP
First configure Craft as an SP. Open the plugin admin and goto "My Provider" in the side menu.
- Label the SP as needed. Adding environment here is helpful.
- Click the "Generate key pair"
# Configure the IdP - Azure AD Application
Configuring the IdP varies. Here's how to configure Azure AD
- Sign-in to Azure AD and navigate to the Active Directory area.
- On the Side menu, goto "Enterprise Applications", then "+ Create your own application", at the top left, name the application and click next.
- Then click "Single Sign-on", then "SAML", where you'll land on "Set up Single Sign-on with SAML".
- Under "Basic SAML Configuration"
- set the Entity ID to Craft's "My Provider" Entity ID.
- Reply URL can be found in the "My Provider" page under the "Metadata" tab (under "Bindings") and labeled "Assertion Consumer Service".
- Set SLO there as well if desired
- Save
- Under "SAML Signing Certificate" download "Federation Metadata XML"
# Configure the IdP in Craft
- Back in the Craft control panel, goto "Provider List" in the SAML SP Plugin side menu
- Click "+ Add Identity Provider" to create the IdP
- Configure require fields
- Add a human readable label
- On the "Metadata" tab, paste the Federation Metadata XML downloaded from Azure AD
- On the "Configure" tab, click "+ Add a new mapping" and set all mapping
- Set "Attribute Name" to "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" and "Craft User Property" to "First Name"
- Set "Attribute Name" to "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" and "Craft User Property" to "Last Name"
- Set "Attribute Name" to "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" and "Craft User Property" to "Email". NOTE: Email is required.
# Configure Login Path
Within the config/general.php
, you can set the loginPath
to the value ("Login Path") set in the IdP (within the Craft SAML SP Plugin control panel),
under the "Configure" tab.
# Other Plugin Configurations and Recommendations
Create a config/saml-sp.php
to add some of the following configurations:
requireResponseToBeSigned
- By default, Azure AD doesn't sign the response. Set this value tofalse
. This will error on login if the config isn't set to false and the signature isn't found.entityId
- We recommend setting this to an environmental variable which matches the Entity ID of "My Provider" you created.