SAML Single Sign-On into Joomla using Azure AD B2C
Overview
miniOrange Joomla SAML SP SSO plugin helps you to integrate your Joomla site to Azure AD B2C using SAML 2.0
protocol. The
miniOrange Joomla SAML SP Single Sign-on (SSO) plugin is simple to set up Azure AD B2C SSO into Joomla and enable
secure
login into Joomla. As a result, users can access multiple Joomla applications with one login after authenticating
with their Azure AD B2C IDP credentials.
Our plugin is compatible with Joomla 3 as well as Joomla 4 with all the SAML 2.0 compliant Identity Providers. Here
we will go through a step-by-step guide to configure SAML SSO login between the Joomla site and Azure AD B2C by
considering
Azure AD B2C as IDP (Identity Provider) & Joomla as SP (Service Provider).
Configuration Steps
In this setup, Azure AD B2C serves as the repository for storing users i.e. it will act as the IDP while Joomla is where users will log in using their credentials from Azure AD B2C where Joomla SAML SP SSO Plugin will be installed.
Step 1: Install Joomla SAML SP Plugin
- Login into your Joomla site’s Administrator console.
- From left toggle menu, click on System, then under Install section click on Extensions.
- Now click on Or Browse for file button to locate and install the plugin file downloaded earlier.
- Installation of plugin is successful. Now click on Get Started!
- Go to the Service Provider Metadata tab and scroll down to copy the SP-EntityID and the ACS URL.
Step 2: Configure Azure AD B2C as IDP (Identity Provider)
- Login to your Azure AD B2C administrator dashboard.
- From the Azure AD B2C tenant, select App registrations, and then select New registration.
- For Name, enter IdentityExperienceFramework.
- Under Supported account types, select Accounts in this organizational directory only.
- Under Redirect URI, select Web, and then enter https://your-tenant-name.b2clogin.com/your-tenant-name.onmicrosoft.com, where your-tenant-name is your Azure AD B2C tenant domain name.
NOTE: In the following step if the 'Permissions' section is not visible then it might be the reason that you don't have an active AzureAD B2C subscription for that tenant. You can find the details regarding the AzureAD B2C subscription and you can create a new tenant by following the steps here.
- Under Permissions, select the Grant admin consent to openid and offline_access permissions check box.
- Select Register.
- Record the Application (client) ID for use in a later step.
Register the Identity Experience Framework application:
- Under Manage, select Expose an API.
- Select Add a scope, then select Save and continue to accept the default application ID URI.
- Enter the following values to create a scope that allows custom policy execution in your Azure AD B2C tenant:
- Scope name: user_impersonation
- Admin consent display name: Access IdentityExperienceFramework
- Admin consent description: Allow the application to access IdentityExperienceFramework on behalf of the signed-in user.
- Select Add scope.
Register the ProxyIdentityExperienceFramework application:
- Select App registrations, and then select New registration.
- For Name, enter ProxyIdentityExperienceFramework.
- Under Supported account types, select Accounts in this organizational directory only.
- Under Redirect URI, use the drop-down to select Public client/native (mobile & desktop).
- For Redirect URI, enter myapp://auth.
- Under Permissions, select the Grant admin consent to openid and offline_access permissions check box.
- Select Register.
- Record the Application (client) ID for use in a later step.
Next, specify that the application should be treated as a public client:
- Under Manage, select Authentication.
- Under Advanced settings, enable Allow public client flows (select Yes).
- Select Save.
Now, grant permissions to the API scope you exposed earlier in the IdentityExperienceFramework registration:
- Under Manage, select API permissions.
- Under Configured permissions, select Add a permission.
- Select the My APIs tab, then select the IdentityExperienceFramework application.
- Under Permission, select the user_impersonation scope that you defined earlier.
- Select Add permissions. As directed, wait a few minutes before proceeding to the next step.
- Select Grant admin consent for (your tenant name).
- Select your currently signed-in administrator account, or sign in with an account in your Azure AD B2C tenant that's been assigned at least the Cloud application administrator role.
- Select Yes.
- Select Refresh, and then verify that "Granted for ..." appears under Status for the scopes - offline_access, openid and user_impersonation. It might take a few minutes for the permissions to propagate.
Register the Joomla Application:
- Select App registrations, and then select New registration.
- Enter a Name for the application such as: Joomla.
- Under Supported account types, select Accounts in any organizational directory or any identity provider, for authenticating users with Azure AD B2C.
- Under Redirect URI, select Web, and then enter the ACS URL from the Service Provider Metadata tab of the miniOrange SAML plugin.
- Select Register.
- Under Manage, click on Expose an API.
- Click on Set for the Application ID URI and then click on Save, accepting the default value.
- Once saved, copy the Application ID URI and navigate to the Service Provider Metadata tab of the plugin.
- Paste the copied value under the SP Entity ID / Issuer field provided in this tab.
- Click on Save.
Generate SSO Policies:
- From our Azure B2C portal, navigate to the Overview section of your B2C tenant and record your tenant name. NOTE: If your B2C domain is b2ctest.onmicrosoft.com, then your tenant name is b2ctest.
- Enter your Azure B2C tenant name here, along with the application ID for IdentityExperienceFramework and ProxyIdentityExperienceFramework apps as registered in the above steps.
- Then click on the Generate Azure B2C Policies button to download the SSO policies.
- Extract the downloaded zip file. It contains the policy files and certificate (.pfx), which you will require in the following steps.
Setup Certificates:
NOTE: In the following step if the 'Identity Experience Framework' is not clickable then it might be the reason that you don't have an active Azure AD B2C subscription for that tenant. You can find the details regarding the Azure AD B2C subscription here and you can create a new tenant by following the steps here.
- Sign in to the Azure portal and browse to your Azure AD B2C tenant.
- Under Policies, select Identity Experience Framework and then Policy keys.
- Select Add, and then select Options > Upload.
- Enter the Name as SamlIdpCert. The prefix B2C_1A_ is automatically added to the name of your key.
- Using the upload file control, upload your certificate that was generated in the above steps along with the SSO policies (tenantname-cert.pfx).
- Enter the certificate's password as your tenant name and click on Create. For example, if your tenant name is xyzb2c.onmicrosoft.com, enter the password as xyzb2c.
- You should be able to see a new policy key with the name B2C_1A_SamlIdpCert.
- On the overview page of your Azure AD B2C tenant, under Policies, select Identity Experience Framework.
- Select Policy Keys and then select Add.
- For Options, choose Generate.
- In Name, enter TokenSigningKeyContainer.
- For Key type, select RSA.
- For Key usage, select Signature.
- Select Create.
- On the overview page of your Azure AD B2C tenant, under Policies, select Identity Experience Framework.
- For Options, choose Generate.
- In Name, enter TokenEncryptionKeyContainer.
- For Key type, select RSA.
- For Key usage, select Encryption.
- Select Create.
Upload the Policies:
- Select the Identity Experience Framework menu item in your B2C tenant in the Azure portal.
- Select Upload custom policy.
- As per the following order, upload the policy files downloaded in the above steps:
- TrustFrameworkBase.xml
- TrustFrameworkExtensions.xml
- SignUpOrSignin.xml
- ProfileEdit.xml
- PasswordReset.xml
- SignUpOrSigninSAML.xml
- As you upload the files, Azure adds the prefix B2C_1A_ to each.
Step 3: Configure Joomla as SP (Service Provider)
In Joomla SAML plugin, go to Service Provider Setup tab. There are three ways to configure the plugin:
A. By uploading IDP metadata:
- In Joomla SAML plugin, go to Service Provider Setup tab, then click on Upload IdP Metadata.
B. By Metadata URL:
- Enter Metadata URL (Copy from IDP app) and click on Fetch button.
C. Manual Configuration:
- Copy SAML Entity ID, SAML Single-Sign-On Endpoint URL and X.509 certificate from Federation Metadata document and paste it in Idp Entity ID or Issuer, Single Sign-on URL, X.509 Certificate fields respectively in the plugin.
IdP Entity ID or Issuer | SAML Entity ID in the Federation Metadata document |
Single Sign-On URL | SAML Single-Sign-On Endpoint URL in the Federation Metadata document |
X.509 Certificate Value | X.509 Certificate in the Federation Metadata document |
Step 4: Attribute Mapping - Premium Feature
- Attributes are user details that are stored in your Identity Provider.
- Attribute Mapping helps you to get user attributes from your Identity Provider (IDP) and map them to Joomla user attributes like firstname, lastname, address, phone etc.
- While auto registering the users in your Joomla site these attributes will automatically get mapped to your Joomla user details.
- Go to Attribute Mapping tab and fill in all the fields.
Username: | Name of the username attribute from IdP (Keep NameID by default) |
Email: | Name of the email attribute from IdP (Keep NameID by default) |
Name: | Name of the name attribute from IdP |
- You can check the Test Configuration Results under Service Provider Setup tab to get a better idea of which values to map here.
Note: You can see how Attribute Mapping works here.
Step 5: Group Mapping - Premium Feature
- Group/Role mapping helps you to assign specific roles to users of a certain group in your Identity Provider (IdP).
- While auto registering, the users are assigned roles based on the group they are mapped to.
- Group/Role mapping helps you to assign specific roles to users of a certain group in your Identity Provider (IdP).
- While auto registering, the users are assigned roles based on the group they are mapped to.
Note: You can see how Group/Role Mapping works here.
Step 6: Redirection & SSO Links
- Go to Login Settings tab. You can add login Url to Perform SAML SSO in your Joomla site by following the steps below.
- There are multiple features available in this tab like Auto redirect the user to Identity Provider and Enable Backend Login for Super Users. To use these features, click on the respective checkboxes.
- Click on the Upgrade tab to check out our complete list of features and various licensing plans. OR you can click here to check features and licensing plans.
- In case, you are facing some issue or have any question in mind, you can reach out to us by sending us your query through the Support button in the plugin or by sending us a mail at joomlasupport@xecurify.com.