Connecting a SAML federation
SAML federation allows users to log in using an external identity provider's (IdP) accounts.
Note
You need cluster administrator rights to set up a SAML federation.
Getting started
Prepare the following information about your identity provider:
- Single Sign-On URL (SSO URL).
- Issuer ID.
- PEM certificate to verify the SAML response signature.
Creating a SAML federation
-
Create a file named
saml-federation.yamlcontaining a description of the SAML federation:apiVersion: iam.stackland.yandex.cloud/v1alpha1 kind: SAMLFederation metadata: name: my-federation spec: description: "SAML Federation for corporate users" cookieMaxAge: "43200s" # 12 hours issuer: "https://idp.example.com/realms/my-realm" ssoBinding: POST ssoUrl: "https://idp.example.com/realms/my-realm/protocol/saml" autoCreateAccountOnLogin: true caseInsensitiveNameIds: false securitySettings: encryptedAssertions: false forceAuthn: true certificates: - name: "idp-certificate" description: "IdP signing certificate" data: | -----BEGIN CERTIFICATE----- <certificate contents> -----END CERTIFICATE-----Where:
name: Federation name.description: Federation description.cookieMaxAge: Session cookie lifetime.issuer: Issuer ID from the IdP settings.ssoUrl: Single Sign-On URL from the IdP settings.autoCreateAccountOnLogin: Create the user automatically on first login.forceAuthn: Require re-authentication at each login.certificates: List of certificates for verification of SAML response signatures.
-
Apply the configuration:
kubectl apply -f saml-federation.yaml -
Check the federation status:
kubectl get samlfederation my-federation -o yaml
Setting up group mapping
Group mapping allows you to automatically add federation users to local groups based on their membership in IdP groups.
-
Create local groups in Identity and Access Management via the management console or wait for them to be created.
-
Add group mapping settings to the federation specification:
apiVersion: iam.stackland.yandex.cloud/v1alpha1 kind: SAMLFederation metadata: name: my-federation spec: # ... other settings ... groupMapping: enabled: true mapping: - externalId: idp-admins internalName: stackland-cluster-admins - externalId: idp-developers internalName: developersWhere:
externalId: Group name in the IdP.internalName: Local group name in Identity and Access Management.
-
Apply the changes:
kubectl apply -f saml-federation.yaml -
Check the group sync status:
kubectl get samlfederation my-federation -o jsonpath='{.status.groupMapping}'
Setting up IdP
After creating the federation in Stackland, configure your identity provider:
-
Get the SAML response URL (ACS URL):
kubectl get samlfederation my-federation -o jsonpath='{.status.federation.acsDomain}' -
In you IdP settings:
- Specify the ACS URL given to you.
- Set up the sending of the
preferred_usernameattribute in the SAML response. - If using group mapping, set up the sending of the user group information.
Test the federation
- Open the Stackland management console.
- On the login page, select login via federation.
- Log in using your IdP credentials.
- After a successful login, check if the user has appeared in the Identity and Access Management user list.
Renewing a certificate
For zero-downtime certificate renewal:
- Add the new certificate to the
certificateslist under a different name. - Apply the changes.
- After successful synchronization, remove the old certificate from the list.
- Reapply the changes.