This topic provides an example of role-based SSO between OneLogin and Alibaba Cloud to help you understand the end-to-end configuration flow of role-based SSO between an enterprise IdP and Alibaba Cloud.
Background information
In this example, the enterprise has an Alibaba Cloud account, a OneLogin administrator user, and multiple OneLogin regular users. You want to configure OneLogin regular users to directly access Alibaba Cloud using their OneLogin accounts through role-based SSO, instead of creating new accounts on Alibaba Cloud.
For more information about OneLogin, see OneLogin Help Documentation.
Step 1: Create an application in OneLogin
-
Log on to OneLogin as an administrator user.
-
Click Administration to access the administrator page, which is located to the left of the account profile picture.
-
In the top menu bar, select .
-
In the upper-right corner of the Applications page, click Add App.
-
On the Find Applications page, search for SAML Test Connector (Advanced) .
-
On the Add SAML Test Connector (Advanced) page, you can configure the application's basic information and then click Save .
In this example, you can set the Display Name of the application to
LoginToAliyun
, while maintaining other parameters at their default values. -
On the Info page, hover over More Actions in the upper-right corner. From the drop-down menu, click SAML Metadata to download the identity provider (IdP) metadata file and save it to your local computer.
Step 2: Create an identity provider in Alibaba Cloud
Log in to the RAM console with your Alibaba Cloud account.
In the left-side navigation pane, select .
On the Role-based SSO tab, click the SAML tab, and then click Create Identity Provider .
On the Create Identity Provider page, enter the Identity Provider Name (OneLogin) and Description .
In the Metadata File area, click Upload File to upload the IdP metadata you obtained from Step 1: Create an application in OneLogin.
Click OK .
View the details of the created IdP and record the Alibaba Cloud Resource Name (ARN) of the IdP for subsequent use.
Step 3: Create a RAM role in Alibaba Cloud
-
In the left-side navigation pane of the RAM console, select .
-
On the Roles page, click Create Role.
-
In the upper-right corner of the Create Role page, click Switch Editor.
-
Specify the specific SAML identity provider in the editor.
The editor offers both visual and script editor modes, allowing you to choose the one that suits your needs. For instance, within the visual editor mode, it's necessary to designate the identity provider you established in Step 2: Create an identity provider in Alibaba Cloud in the Entity, and choose Identity Provider Type as SAML.
-
Set the
saml:recipient
condition in the editor, assigning it the value orhttps://signin.alibabacloud.com/saml-role/sso
. -
In the Create Role dialog box, enter the Role Name (for example, Reader-OneLogin), and then click OK .
View the details of the created RAM role and record the ARN of the RAM role for subsequent use.
Step 4: Configure the application in OneLogin
-
Log on to OneLogin as an administrator user.
-
Create custom user attributes.
-
In the top menu bar, select .
-
On the Users page, hover over More Actions in the upper-right corner, and from the drop-down list, click Custom user fields.
-
In the upper-right corner of the Custom User Fields page, click New User Field.
-
In the New User Field dialog box, configure the Name and Shortname , and then click Save .
In this example, you can set the Name to
AliyunRoles for SSO
and the Shortname toAliyunRoles
.
-
-
Configure the application.
-
In the top menu bar, select .
-
On the Applications page, you can click the application you created in Step 1: Create an application in OneLogin (LoginToAliyun).
-
In the left-side navigation pane, click Configuration.
-
On the Configuration page, configure the following information, and then click Save.
-
RelayState: Configures the Alibaba Cloud page that users are redirected to following a successful logon.
NoteFor security reasons, the URL entered as the RelayState value must be a domain name owned by Alibaba, such as *.aliyun.com, *.hichina.com, *.yunos.com, *.taobao.com, *.tmall.com, *.alibabacloud.com, or *.alipay.com. If the configuration is not valid, it will be rejected. Leaving this parameter blank will, by default, redirect you to the Alibaba Cloud Management Console homepage.
-
Audience (EntityID):
urn:alibaba:cloudcomputing:international
. -
Recipient: For China, use ; for international users, use
https://signin.alibabacloud.com/saml-role/sso
. -
ACS (Consumer) URL: For China, use ; for international access, use
https://signin.alibabacloud.com/saml-role/sso
.
-
-
In the left-side navigation pane, click Parameters.
-
On the Parameters page, click
and add the first custom application attribute.
-
In the New Field dialog box, you can set the Field name to
https://www.aliyun.com/SAML-Role/Attributes/Role
. Then, select Include in SAML assertion and Multi-value parameter. Finally, click Save. -
In the Edit Field https://www.aliyun.com/SAML-Role/Attributes/Role dialog box, select Aliyun Roles for SSO (Custom) and Semicolon Delimited input (Multi-value output) from the two drop-down lists in the Default if no value selected area, and then click Save.
-
-
On the Parameters page, click
and add the second custom application attribute.
-
In the New Field dialog box, you can set the Field name to
https://www.aliyun.com/SAML-Role/Attributes/RoleSessionName
, select Include in SAML assertion, and click Save. -
In the Edit Field https://www.aliyun.com/SAML-Role/Attributes/RoleSessionName dialog box, you can select Email from the drop-down list in the Value area, and then click Save.
NoteYou can also set the Value to other values based on your actual needs, such as Username or userPrincipalName.
-
-
In the upper-right corner of the Parameters page, click Save.
-
Step 5: Create users and assign applications in OneLogin
-
Log on to OneLogin as an administrator user.
-
In the top menu bar, select .
-
Create a user.
NoteIf you have a OneLogin user, skip this step.
-
In the upper-right corner of the Users page, click New User.
-
On the New User page, enter the First name (such as Jack), Last name (such as Lee), Username (such as jacklee), and Email (such as jacklee@example.com). Then click Save User .
-
On the User Info page, hover over More Actions in the upper-right corner. From the drop-down list, select Change Password to set a new logon password for the user, and then click Update.
The user can log on to OneLogin by using the password.
-
-
On the User Info page, locate the Custom Fields section and set the value for the user-defined property Aliyun Roles for SSO.
The Aliyun Roles for SSO value comprises the RAM role ARN and the identity provider ARN, separated by a comma. The format is
acs:ram::<account_id>:role/RoleName,acs:ram::<account_id>:saml-provider/ProviderName
. You can retrieve the RAM role ARN from Step 3: Create a RAM role in Alibaba Cloud, the identity provider ARN from Step 2: Create an identity provider in Alibaba Cloud, and replace <account_id> with your Alibaba Cloud account ID.NoteIf a user is associated with multiple RAM roles, you can configure multiple sets of values accordingly. Each set comprises a RAM role ARN paired with its corresponding identity provider ARN, with different sets separated by commas. For example:
acs:ram::125022144354****:role/reader-onelogin,acs:ram::125022144354****:saml-provider/OneLogin,acs:ram::125022144354****:role/administrator-onelogin,acs:ram::125022144354****:saml-provider/OneLogin,acs:ram::158622887609****:role/finance,acs:ram::158622887609****:saml-provider/OneLogin2
. -
Assign the application to the user.
-
On the Applications page, click
.
-
Select the application you created in Step 1: Create an application in OneLogin (LoginToAliyun), and then click Continue.
-
In the pop-up dialog box, click Save .
-
-
In the upper-right corner of the Users page, click the Save User button.
-
Repeat steps 4 to 6 to set the Aliyun Roles for SSO attribute values and assign applications to other OneLogin regular users.
Verify results
-
Log on to Step 5: Create Users and Assign Applications in OneLogin using the created user (jacklee) andlog on to OneLogin.
-
Click the application (LoginToAliyun).
If you are successfully redirected to the page corresponding to the RelayState you set, or the default homepage of the Alibaba Cloud Management Console, this indicates a successful logon.
NoteIf you have set multiple roles for the user in Step 5: Create Users and Assign Applications in OneLogin, you need to select a logon role before accessing Alibaba Cloud.