You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(docs): DSPX-2959 use shorthand enum names in subject mapping docs
Replace verbose proto enum names and numeric codes with readable
shorthand aliases (IN, NOT_IN, IN_CONTAINS, AND, OR) throughout
subject mapping documentation. The platform now accepts these via
HTTP middleware (opentdf/platform#3401).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/components/policy/subject_mappings.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,10 @@ Subject Condition Sets can also optionally be associated with a namespace. See [
57
57
58
58
### Operators
59
59
60
+
:::tip Shorthand enum names
61
+
The API accepts readable shorthand names (e.g., `IN`, `AND`) in addition to full canonical proto names (e.g., `SUBJECT_MAPPING_OPERATOR_ENUM_IN`, `CONDITION_BOOLEAN_TYPE_ENUM_AND`). The examples below use shorthand names.
62
+
:::
63
+
60
64
#### Condition Operators
61
65
62
66
Each Condition uses an operator to compare the entity's claim (extracted by the selector) against the list of expected values.
| **`IN`** | Exact match: value is IN list | `.role` IN `["admin", "editor"]` |
163
+
| **`NOT_IN`** | Exclusion: value is NOT IN list | `.department` NOT_IN `["sales"]` |
164
+
| **`IN_CONTAINS`** | Substring match | `.email` IN_CONTAINS `["@example.com"]` |
165
165
166
166
### Boolean Operators
167
167
168
-
| Operator | Value | Behavior |
169
-
|----------|-------|----------|
170
-
| **AND** | `1` | All conditions must be TRUE |
171
-
| **OR** | `2` | At least one condition must be TRUE |
168
+
| Operator | Behavior |
169
+
|----------|----------|
170
+
| **`AND`** | All conditions must be TRUE |
171
+
| **`OR`** | At least one condition must be TRUE |
172
+
173
+
:::tip Shorthand enum names
174
+
The API accepts readable shorthand names (`IN`, `NOT_IN`, `IN_CONTAINS`, `AND`, `OR`) as well as the full canonical proto names (e.g., `SUBJECT_MAPPING_OPERATOR_ENUM_IN`, `CONDITION_BOOLEAN_TYPE_ENUM_AND`). Numeric values (`1`, `2`, `3`) also work. The examples in this guide use shorthand names for readability.
175
+
:::
172
176
173
177
### Example 1: Multiple Roles (OR)
174
178
@@ -178,16 +182,16 @@ The selector syntax depends on whether the token claim is a **string** or an **a
178
182
{
179
183
"subject_sets": [{
180
184
"condition_groups": [{
181
-
"boolean_operator": 2,
185
+
"boolean_operator": "OR",
182
186
"conditions": [
183
187
{
184
188
"subject_external_selector_value": ".role",
185
-
"operator": 1,
189
+
"operator": "IN",
186
190
"subject_external_values": ["admin"]
187
191
},
188
192
{
189
193
"subject_external_selector_value": ".role",
190
-
"operator": 1,
194
+
"operator": "IN",
191
195
"subject_external_values": ["editor"]
192
196
}
193
197
]
@@ -201,10 +205,10 @@ The selector syntax depends on whether the token claim is a **string** or an **a
201
205
{
202
206
"subject_sets": [{
203
207
"condition_groups": [{
204
-
"boolean_operator": 1,
208
+
"boolean_operator": "AND",
205
209
"conditions": [{
206
210
"subject_external_selector_value": ".role",
207
-
"operator": 1,
211
+
"operator": "IN",
208
212
"subject_external_values": ["admin", "editor"]
209
213
}]
210
214
}]
@@ -220,16 +224,16 @@ The selector syntax depends on whether the token claim is a **string** or an **a
@@ -580,7 +584,7 @@ This walkthrough assumes basic familiarity with OpenTDF. If you haven't set up O
580
584
581
585
### Step 1: Create Subject Condition Set
582
586
583
-
This example matches any user whose `.email` claim contains `@example.com`. The numeric values are enum codes — `boolean_operator: 1` = AND (all conditions must be true), `operator: 3` = IN_CONTAINS (substring match). See [Operators Explained](#operators-explained) for the full list.
587
+
This example matches any user whose `.email` claim contains `@example.com`. `boolean_operator: "AND"` means all conditions must be true, and `operator: "IN_CONTAINS"` performs a substring match. See [Operators Explained](#operators-explained) for the full list.
584
588
585
589
`subject_external_selector_value` is a path into the JWT your IdP issues — `.email` selects the top-level `email` claim. If your claim is named differently, use `otdfctl dev selectors generate --subject "<your-jwt>"` to see all available selectors. See [Selectors: String vs. Array Claims](#selectors-string-vs-array-claims) for the full syntax.
|`attributeId`|`string` (UUID) | Yes | The parent attribute ID. |
906
-
|`state`|`string`| No | Filter by state: `ACTIVE_STATE_ENUM_ACTIVE` (default), `ACTIVE_STATE_ENUM_INACTIVE`, or `ACTIVE_STATE_ENUM_ANY`. |
906
+
|`state`|`string`| No | Filter by state: `ACTIVE` (default), `INACTIVE`, or `ANY`. Full canonical names (e.g., `ACTIVE_STATE_ENUM_ACTIVE`) are also accepted. |
907
907
908
908
**Example**
909
909
@@ -1365,7 +1365,7 @@ Empty response. The value is soft-deleted and will no longer appear in listings
1365
1365
|`id`|`string` (UUID) | Unique identifier, generated by the platform. |
1366
1366
|`name`|`string`| The attribute name (e.g., `department`, `clearance`). |
|`rule`|`string`| Access rule: `ATTRIBUTE_RULE_TYPE_ENUM_ALL_OF`, `ATTRIBUTE_RULE_TYPE_ENUM_ANY_OF`, or `ATTRIBUTE_RULE_TYPE_ENUM_HIERARCHY`. |
1368
+
|`rule`|`string`| Access rule: `ALL_OF`, `ANY_OF`, or `HIERARCHY`. Full canonical names (e.g., `ATTRIBUTE_RULE_TYPE_ENUM_ALL_OF`) are also accepted. |
1369
1369
|`values`|`[]Value`| The [attribute values](#attribute-value-object) defined under this attribute. |
1370
1370
|`namespace`|`Namespace`| The parent [Namespace](#namespace-object). |
1371
1371
|`active`|`bool`|`true` until explicitly deactivated. |
@@ -1947,7 +1947,7 @@ SubjectConditionSet
1947
1947
1948
1948
| Field | Type | Description |
1949
1949
|-------|------|-------------|
1950
-
|`booleanOperator`|`string`| How to combine conditions: `CONDITION_BOOLEAN_TYPE_ENUM_AND` or `CONDITION_BOOLEAN_TYPE_ENUM_OR`. |
1950
+
|`booleanOperator`|`string`| How to combine conditions: `AND` or `OR`. Full canonical names (e.g., `CONDITION_BOOLEAN_TYPE_ENUM_AND`) are also accepted. |
1951
1951
|`conditions`|`[]Condition`| One or more [conditions](#condition) to evaluate. |
1952
1952
1953
1953
### Condition
@@ -1964,9 +1964,11 @@ A single claim match against an entity's token.
1964
1964
1965
1965
| Operator | Description |
1966
1966
|----------|-------------|
1967
-
|`SUBJECT_MAPPING_OPERATOR_ENUM_IN`| The claim value must exactly match one of the `subjectExternalValues`. |
1968
-
|`SUBJECT_MAPPING_OPERATOR_ENUM_NOT_IN`| The claim value must not match any of the `subjectExternalValues`. |
1969
-
|`SUBJECT_MAPPING_OPERATOR_ENUM_IN_CONTAINS`| The claim value must contain (substring match) one of the `subjectExternalValues`. |
1967
+
|`IN`| The claim value must exactly match one of the `subjectExternalValues`. |
1968
+
|`NOT_IN`| The claim value must not match any of the `subjectExternalValues`. |
1969
+
|`IN_CONTAINS`| The claim value must contain (substring match) one of the `subjectExternalValues`. |
1970
+
1971
+
Full canonical names (e.g., `SUBJECT_MAPPING_OPERATOR_ENUM_IN`) are also accepted.
1970
1972
1971
1973
**Example:** "Match entities whose `.clientId` is `my-service` AND whose `.realm_access.roles` contains `developer`":
1972
1974
@@ -1976,16 +1978,16 @@ A single claim match against an entity's token.
0 commit comments