<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
Utilizing Okta Expression Language to Prioritize Sending Group Attributes in SAML Assertions
Single Sign-On
Okta Classic Engine
Okta Identity Engine
Overview

This article explains how to employ the Okta Expression Language (OEL) to prioritize and pass a single group attribute in Secure Assertion Markup Language (SAML) assertions. The primary focus is on creating an efficient conditional expression that aids in selecting the highest-priority group for a user who may belong to more than one group.

Okta administrators who manage SAML assertions need to ensure the most pertinent group attribute is passed, especially in scenarios where a user is part of multiple groups.

Applies To
  • Secure Assertion Markup Language (SAML)
  • Okta Expression Language (OEL)
Solution

To address this requirement, the Okta Expression Language can be leveraged, particularly the concept of conditional expressions. Conditional expressions, formulated as IF...THEN...ELSE statements are instrumental in profile mappings and group rules.
 

Here is the step-by-step breakdown of the Okta Expression Language solution:
 

  1. Assign the attribute a name such as "group". 
  2. Chain together conditional expressions to establish a priority of groups. If there are three groups, the following expression might be utilized:
    isMemberOfGroupName("group1") ? "group1" : isMemberOfGroupName("group2") ? "group2" : isMemberOfGroupName("group3") ? "group3" : null

This chained expression works as follows:

    • isMemberOfGroupName("group1") ? "group1": The isMemberOfGroupName function checks if the user is a member of "group1". If the condition is true, the string "group1" is returned.
    • isMemberOfGroupName("group2") ? "group2": If the previous condition is false, the function then checks for membership in "group2". If true, "group2" is returned.
    • isMemberOfGroupName("group3") ? "group3": If both the previous conditions are false, it checks for membership in "group3". If true, "group3" is returned.
    • null: If none of the previous conditions are met, it returns null.

This expression ensures that only the highest-priority group is passed in the SAML assertion by appropriately ordering the conditions based on the groups' priorities.


Remember, expressions must be syntactically valid, evaluate to a Boolean (true or false) value, and cannot contain assignment operators like '='. Only existing User or AppUser attributes can be used in expressions. For further information on using conditional expressions, consult the Okta Expression Language Documentation.

 

Related References

 

Loading
Utilizing Okta Expression Language to Prioritize Sending Group Attributes in SAML Assertions