Overview
A Condition is a JSON object that evaluates totrue or false based on attributes of the entities being evaluated. When used in Access Policies, conditions are evaluated against identity attributes to determine if an identity qualifies for the policy. Conditions support:
- Comparison operators: equals, not equals, greater than, less than, etc.
- String operators: contains, starts with, ends with
- Collection operators: in, contains any
- Logical composition: AND, OR, NOT
- Existence checks: exists
- Custom expressions: Lumos expressions
Basic Structure
Every condition consists of:- An attribute - specifies which property of the entity to evaluate
- An operator - defines how to compare or evaluate the attribute
- A value (for most operators) - the value to compare against
Simple Condition Example
true if the identity’s email equals “engineer@example.com”.
Attributes
Theattribute field specifies which property of the entity to evaluate. Attributes can be specified in two ways:
String Attribute
A simple string path to the attribute:identity.email- The identity’s email addressidentity.given_name- The identity’s first nameidentity.family_name- The identity’s last nameidentity.full_name- The identity’s full nameidentity.team- The identity’s teamidentity.title- The identity’s titleidentity.manager.uuid- The identity’s manager’s UUIDidentity.manager.email- The identity’s manager’s email=identity.manager.full_name- The identity’s manager’s full nameidentity.start_date- The identity’s start dateidentity.end_date- The identity’s end dateidentity.status- The identity’s statusidentity.custom_attributes["Department"]- A custom attribute named “Department”identity.groups[*].external_id- The identity’s groups
Attribute Operand
For more complex attribute selection, you can use anAttributeOperand object with a label and value:
label is a human-readable name for the attribute, while value is the actual path used for evaluation.
Attribute Types
Attributes in Lumos Conditions can be of different types, each with specific behaviors and use cases.STRING
STRING attributes are simple text values. They work straightforwardly with string comparison operators likeequals, in, contains, etc.
IDENTITY
IDENTITY attributes represent references to other identities. When accessing IDENTITY attributes, you can reference specific properties of the identity object using dot notation. Direct identity relationships:GROUP
GROUP attributes represent references to groups. Groups are collections, so you typically use array notation with the[*] wildcard to access properties of groups in the collection.
Accessing group external IDs:
DATETIME
DATETIME attributes represent date and time values. When comparing DATETIME attributes, you must use ISO 8601 format strings with timezone information. Direct identity date fields:-
Use ISO 8601 format:
YYYY-MM-DDTHH:MM:SSZorYYYY-MM-DDTHH:MM:SS+HH:MM -
Always include timezone information (use
Zfor UTC or offset like+05:00for other timezones) -
Examples:
"2024-01-15T00:00:00Z"- January 15, 2024 at midnight UTC"2024-01-15T09:00:00-08:00"- January 15, 2024 at 9 AM PST"2024-12-31T23:59:59Z"- December 31, 2024 at 11:59:59 PM UTC
equals, greater_than, less_than, greater_than_or_equal, and less_than_or_equal.
Value Options
For better readability, you can useValueOption objects instead of raw values. A ValueOption has a label (human-readable) and a value (the actual value used in evaluation):
Supported Value Types
Condition values can be:- Strings:
"Engineering" - Numbers:
42or3.14 - Booleans:
trueorfalse - Dates/DateTimes:
"2024-01-01T00:00:00Z"(ISO 8601 format with timezone) - ValueOptions:
{"label": "Friendly Name", "value": "actual_value"}
Operators
Comparison Operators
equals
Checks if the attribute equals a specific value.
!= (Not Equal To)
Checks if the attribute does not equal a specific value.
> (Greater Than)
Checks if the attribute is greater than a value. Works with numbers and dates.
>= (Greater Than or Equal To)
< (Less Than)
<= (Less Than or Equal To)
String Operators
contains
Checks if the attribute contains a substring.
starts_with
Checks if the attribute starts with a specific string.
ends_with
Checks if the attribute ends with a specific string.
Collection Operators
in
Checks if the attribute value is in a list of values. When the right-hand side is a list, it performs exact equality matching against each item in the list.
contains_any
Checks if the attribute (which should be a collection) contains any of the specified values. This operator is typically used when comparing two collections.
Existence Operators
exists
Checks whether an attribute exists (is not null or undefined).
Composition Operators
Conditions can be combined using logical operators to create complex expressions.and (AND)
Returns true only when all conditions in the and array evaluate to true.
true only if the identity has a Department of “Engineering” AND has a Level of “Senior”.
or (OR)
Returns true when at least one condition in the or array evaluates to true.
true if the identity has a Department of either “Engineering” OR “Product”.
not (NOT)
Negates a condition. The nested condition must evaluate to false for the overall condition to be true.
true if the identity does NOT have a Department of “Sales”.
Complex Nested Conditions
You can combine all composition operators to create complex logic:true if:
- The identity has a Department of “Engineering” OR “Product”, AND
- The identity status is NOT “Inactive”, AND
- The identity’s Start Date is after January 1, 2020
Advanced Operators
lumos_expression
The lumos_expression operator allows you to use the Lumos Expression Language (LEL) to write complex conditional logic that goes beyond what standard condition operators can express. This is particularly useful for:
- Complex conditional logic with multiple conditions
- Data transformations and comparisons
- Fallback values and default handling
- String manipulations and transformations
lumos_expression, you reference identity attributes using the identity. prefix, which is consistent with standard condition attributes.
Standard Attributes in LEL:
identity.given_name- First nameidentity.family_name- Last nameidentity.email- Email address
identity.custom_attributes["Attribute Name"]- Access custom attributes
lumos_expression vs Standard Operators:
-
Use standard operators (
equals,in,and,or, etc.) for simple, straightforward conditions. They’re easier to read and maintain. -
Use
lumos_expressionwhen you need:- Complex conditional logic that’s difficult to express with nested
and/or/not - Data transformations (string manipulation, case conversion, etc.)
- Fallback values or default handling
- Calculations or comparisons that require expressions
- Complex conditional logic that’s difficult to express with nested
Common Use Cases
Access Policy: Department-Based Access
Grant access to all Engineering team members:Access Policy: Multiple Departments
Grant access to Engineering, Product, or Design:Access Policy: Senior Engineers Only
Grant access to senior engineers with start date after 2020:Access Policy: Active Employees in Specific Teams
Grant access to active employees in specific teams:Access Policy: Direct Reports of Specific Managers
Grant access to all direct reports of specific managers:Access Policy: Members of Specific Groups
Grant access to identities who are members of any of the specified groups:Using Conditions in Access Policies API
In the Lumos API, conditions are used in theaccess_condition field of Access Policies:
is_everyone_condition is true, the access_condition field is ignored and the policy applies to everyone.
Error Handling
If a condition references an attribute that doesn’t exist on an identity, the condition evaluation may fail or returnfalse depending on the context. Always ensure your attribute paths are correct and that the identities you’re evaluating have the expected structure.