The SAP XSUAA Connector enables the use of an external identity provider (IDP) on a Mendix application so that a user can have a single sign-on (SSO) experience on their application.
This how-to will teach you how to do the following:
- Add the XSUAA Connector to your project
- Configure the XSUAA connector
Before starting this how-to, make sure you have completed the following prerequisites:
- Create the app in the Mendix Desktop Modeler 7.5.1 or higher
- Get the SAP OData Connector module
2.1 Getting the SAP XSUAA Connector Module
To be able to use the SAP XSUAA Connector, after creating your project, navigate to the Mendix App Store to download the SAP Cloud Platform XSUAA Connector module. You will then find this module in your app project’s App Store modules.
For more information, see How to Use App Store Content in the Modeler.
3 Using the Connector
In this section, you will learn how to implement the data connector in your Mendix app.
SAP Authentication will not work if the Project Security is off.
Set the security level for the project to at least Prototype/demo to use SAP Authentication. For more information see Project Security. For instructions on setting security levels, see How To Create a Secure App
3.1 Adding the OnStartup Microflow to the Application Settings
To add the OnStartup microflow to your application settings, follow these steps:
- In the Project Explorer, select Project > Settings and open the Runtime tab.
- For the AfterStartup microflow, select the OnStartup microflow:
To add the SSO login button to the landing page, follow these steps:
- In the top menu of the Desktop Modeler, select Project > Show Project Directory in Explorer.
- Open the theme folder.
- Open login.html:
Locate this line:
Below the line above, add this line:
<a id="ssoButton" href="/xsauaalogin/" class="login-sso-button btn btn-primary">Sign in with your XSUAA account</a>
The XSUAA login button will look like this:
3.3 Redirecting Your Application to XSUAA Without Showing the Login Page (Alternative Method)
An alternative to adding the SSO login button to the landing page of your app is to redirect your app to XSUAA automatically without showing the login page.
Note that this will only work if you are running your app on the SAP Cloud.
To accomplish this, follow these steps:
- Open the project directory of your project and then open the theme folder.
Change the contents of login.html to the following:
<!doctype html> <html> <head> <script> window.location.assign("/xsauaalogin/") </script> </head> </html>