SAMLLabelRule resources to map the resulting labels to Omni roles. Despite its name, a SAMLLabelRule applies to labels from both SAML and OIDC logins. If no rules are configured, roles must be assigned manually by an administrator.
Prerequisites
Before creating label rules, make sure you have the following:- SAML or OIDC authentication must be configured on your Omni instance. See Authentication and Authorization for setup instructions.
omnictlmust be installed and configured with Admin access to your Omni instance.
How label rules work
Omni turns information from the identity provider into labels on each user, andSAMLLabelRule resources assign roles based on those labels. SAML and OIDC logins produce labels in different ways.
Labels from SAML logins
When a SAML user logs in to Omni, their SAML attributes are read and mapped to labels on the user resource. Omni recognises the following SAML attribute names by default and maps them to therole label key:
For example, a user with the SAML attribute
Role: engineers will be labeled saml.omni.sidero.dev/role/engineers in Omni automatically when using Google or a compatible provider.
If your SAML identity provider uses a different attribute name, you must configure Omni to map it to the role key. This can be done via the CLI flag when starting the Omni server:
Labels from OIDC logins
When an OIDC user logs in to Omni, thegroups and roles claims of the ID token become labels in the format oidc.omni.sidero.dev/<claim>/<value>. For example, an ID token with "groups": ["engineers"] labels the user oidc.omni.sidero.dev/groups/engineers. Other claims do not create labels. The labels are updated on every login, and labels whose values are no longer in the ID token are removed.
Some identity providers include the groups claim only when it is requested with a scope, usually named groups. Without it, OIDC users have no labels and no rule matches them. Add the scope with the --auth-oidc-scopes flag when starting Omni:
--auth-oidc-auto-create-users flag:
SAMLLabelRule resources, or None if no rule matches.
For the full list of OIDC options, see the Omni Configuration reference.
Assign roles with label rules
Once the correct labels are appearing on your users, aSAMLLabelRule resource can automatically assign an Omni role when a matching label is found. If multiple rules match the same user, the role with the highest access level is assigned.
Create and verify a SAML label rule
The following example creates a rule that assigns theOperator role to any SAML user whose SAML attributes include Role: engineers. To match OIDC users instead, use an OIDC label such as oidc.omni.sidero.dev/groups/engineers in matchlabels.
Step 1: Create the rule
Create and apply theSAMLLabelRule resource:
spec are:
Step 2: Verify the rule was applied
Log in to Omni as a user with the matching attribute or claim, then list the users of your instance:ROLE column shows the assigned role. The LABELS column lists the labels without their saml.omni.sidero.dev/ or oidc.omni.sidero.dev/ prefix, so oidc.omni.sidero.dev/groups/engineers appears as groups/engineers=.
Limitations
The following limitations apply when automatically assigning roles to SAML and OIDC users:- A rule with
updateoneachloginset tofalseonly assigns a role when the user is created. If the user already exists, their role is not changed by the rule and must be updated manually by an administrator, or by a rule withupdateoneachloginset totrue. - If no rule matches when an existing user logs in, the user keeps their current role, even with
updateoneachloginset totrue. For example, removing a user from a group in the identity provider does not change their role in Omni. - If the user is the first user to log in to an Omni instance, the
SAMLLabelRulewill not apply. The first user is always assigned theAdminrole, regardless of any label rules.