Skip to main content
When SAML or OIDC authentication is enabled, Omni can automatically assign roles to users based on the attributes or claims sent by the identity provider. To configure this, use 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.
  • omnictl must 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, and SAMLLabelRule 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 the role 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:
Or via the Omni configuration file:
For the full list of configuration options, see the Omni Configuration reference.

Labels from OIDC logins

When an OIDC user logs in to Omni, the groups 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:
Or via the Omni configuration file:
By default, Omni does not create OIDC users on their first login. An administrator creates each OIDC user, and a user who does not exist is refused. To create OIDC users on their first login, as SAML users are, set the --auth-oidc-auto-create-users flag:
Or via the Omni configuration file:
A user created this way gets the role from the matching SAMLLabelRule resources, or None if no rule matches.
Enable autoCreateUsers only when every account of the identity provider belongs to your organization. Otherwise, any account of the identity provider can create a user in Omni.
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, a SAMLLabelRule 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 the Operator 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 the SAMLLabelRule resource:
The fields in the 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:
The output shows the role and labels of each user. The 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 updateoneachlogin set to false only 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 with updateoneachlogin set to true.
  • If no rule matches when an existing user logs in, the user keeps their current role, even with updateoneachlogin set to true. 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 SAMLLabelRule will not apply. The first user is always assigned the Admin role, regardless of any label rules.