Configuring identity federation via Keycloak
You can connect your Identity Provider (IdP) to VK Cloud. This will allow your employees to log in to VK Cloud without entering a login and password, using corporate authentication credentials from the identity provider. This mode is called identity federation.
To work in federation mode, the identity provider must support the SAML 2.0 standard.
The following describes how to set up identity federation for logging in to VK Cloud with Keycloak as the identity provider.
-
Install and configure a Keycloak server if you do not already use this identity provider.
-
Get the Keycloak metadata:
Only users with the project owner role can create VK Cloud identity federations.
-
Go to your VK Cloud account.
-
Go to the Identity federation section, Federations tab.
-
Click Create.
-
Click Upload IdP metadata.
-
Add the XML file with the Keycloak metadata and click Upload.
-
Click Download metadata to save the XML file with the federation metadata. This file will later be used to create a relying party trust.
The Federations tab will display the federation data:
- URL for federated users to sign in to the VK Cloud management console, for example:
https://cloud.vk.ru/v1/federation/saml/54f0267b-31f6-XXXX-XXX-2a24c5f436fb/signin. - Federation ID, for example:
54f0267b-31f6-XXXX-XXX-2a24c5f436fb.
-
Log in to the Keycloak admin console.
-
Go to the Clients tab.
-
Click Import client and upload the metadata obtained when creating the federation. Leave the parameters unchanged:
- Type:
saml. - Encrypt assertions:
On. - Client signature required:
Off.
- Type:
-
Click Save.
-
Go to the Client scopes tab of the created client and click the scope created for the default client.
-
Click Configure a new mapper, select User Property, and fill in the parameters:
- Name:
email. - Property:
email. - SAML Attribute Name:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress. - SAML Attribute NameFormat:
URI Reference.
- Name:
-
Select Group list and add another mapper:
- Name:
groups. - Group attribute name:
http://schemas.xmlsoap.org/claims/Group. - SAML Attribute NameFormat:
URI Reference. - Single Group Attribute:
On. - Full group path:
Off.
- Name:
-
(Optional) Click Configure a new mapper, select User Property, and add two attributes to synchronize user information with the management console:
-
User first name:
- Name:
firstName. - Property:
firstName. - SAML Attribute Name:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name. - SAML Attribute NameFormat:
URI Reference.
- Name:
-
User last name:
- Name:
lastName. - User Attribute:
lastName. - SAML Attribute Name:
http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname. - SAML Attribute NameFormat:
URI Reference.
- Name:
-
-
Go to your VK Cloud account.
-
Go to the Identity Federation section.
-
Go to the Groups tab.
-
Click the name of the project for which identity federation is being configured.
-
Add the groups that you use in Keycloak:
-
Click Add. If groups have already been created on the page, click the Add group button.
-
Configure the group:
- Group name: specify the group name. The name of the group being created must match the name of the group in Keycloak, but it must be in lowercase.
- Permissions:
- Select Project to link the group and roles within a single project. In different projects, you can link the same group with different roles, which allows you to differentiate the federated user's level of access to projects.
- Select Domain to link the group and roles across all projects of one owner and provide the federated user with a unified level of access to them. The Domain permission is available only to the project owner.
- Group roles: select the VK Cloud roles or permissions that correspond to your access matrix for the group being created.
-
Click Add.
-
- Create a user in Keycloak and add them to the desired group.
- Enter the URL for federated user login in the browser address bar. You will be redirected to the Keycloak authentication page.
- Enter the user's authentication credentials. After successful authorization, you will be redirected to the main page of the VK Cloud management console.
- Check that the automatically assigned VK Cloud user role matches the one selected when adding the group.