- 7 minutes to read

Understanding Claim Logic in Policies

A Policy grants access only when the user's access token holds its Claims. How several Claims, and several Policies on one Role, combine decides who gets in, and a wrong change can lock everyone out.

  • ✅ AND within a Policy: every Claim must match
  • ✅ OR between the Policies of a Role: one matching Policy is enough
  • ✅ Conflicting Claims: one Key with two values in one Policy, and the fix
  • ✅ Validation rules that stop an empty Policy

Important

CRITICAL: Modifying Policies Can Lock Out All Users (Including Admins)

  1. AND Logic: ALL Claims in a Policy must match. Adding one Claim makes access MORE restrictive
  2. IDP Dependency: Claims must exist in your Identity Provider (Microsoft Entra ID, Okta, etc.) with exact key/value match (Entra ID Token Claims Validation)
  3. Fast Effect: A Policy, Claim, or Role change in Nodinite reaches signed-in users within about 15 seconds, without signing in again
  4. Lockout Risk: The Web API refuses an edit or delete that would take the Administrators Role from the administrator making it (HTTP 409), but other administrators and users can still be locked out

Real-world disaster scenario:

You have Policy "Administrators" with:
 - Group=Admin

You add "MFAVerified=true" thinking it adds security:
 - Group=Admin (AND)
 - MFAVerified=true (AND)

Problem: Your IDP doesn't send "MFAVerified" claim
Result: NO other user matches (Group=Admin AND MFAVerified=true)
Impact: every other administrator loses the Role within 15 seconds ❌

When changes arrive: Nodinite reads the Claims from each request's token and caches only the Roles, Policies, and Claims structure, for 15 seconds per user. A change in the identity provider (for example a user's group) arrives with the user's next token: at sign-in, or at the next refresh (the Web Client refreshes the access token 2 minutes before it expires; Microsoft Entra ID tokens typically live 60–90 minutes). Signing out and in again fetches a new token at once. See Install Nodinite v7 - OpenID for the token settings.

Safe practices:

  • ✅ Create NEW Policies instead of modifying existing ones
  • ✅ Document all Claims your IDP provides before creating Policies
  • ✅ Test with non-admin test accounts first
  • ✅ Sign out and in again after an identity provider change, instead of waiting for the token to expire
  • ✅ Never modify the built-in "Administrators" Policy without a tested backup plan
  • ❌ Never add Claims "just to see what happens"
  • ❌ Never test Policy changes using your only admin account

AND Logic Within a Policy

Critical Rule: All Claims within a single Policy use AND logic. Users must match ALL Claims in the Policy to satisfy it. Key and Value are trimmed and compared without regard to case (Group = contoso-finance matches Contoso-Finance).

Animation: the Policy Contoso: Finance Users gets a second Claim, Group = Contoso-Managers; the user contoso.finance, whose token lacks it, signs in and gets the Forbidden page
One extra Claim is enough: contoso.finance has no Contoso-Managers group, so the Policy no longer matches and the user gets the Forbidden page.

graph TB subgraph Role["Nodinite Role: Admin"] direction LR R["Role receives access if user matches ANY Policy"] end subgraph OR_Logic[" "] direction TB P1["Policy: AdminInDenmark"] P2["Policy: AdminInSweden"] P3["Policy: AdminInNorway"] end subgraph P1_Claims["Policy: AdminInDenmark"] direction TB C1["Group: AdminInDenmark"] end subgraph P2_Claims["Policy: AdminInSweden"] direction TB C2A["Country: Sweden"] C2B["Group: Admin"] C2A -.->|"AND"| C2B end subgraph P3_Claims["Policy: AdminInNorway"] direction TB C3A["Country: Norway"] C3B["Group: Admin"] C3A -.->|"AND"| C3B end Role -->|"OR"| P1 Role -->|"OR"| P2 Role -->|"OR"| P3 P1 --> P1_Claims P2 --> P2_Claims P3 --> P3_Claims style Role fill:#FFD525,color:#000 style P1 fill:#2678BD,color:#fff style P2 fill:#2678BD,color:#fff style P3 fill:#2678BD,color:#fff style P1_Claims fill:#3F827B,color:#fff style P2_Claims fill:#3F827B,color:#fff style P3_Claims fill:#3F827B,color:#fff style C1 fill:#93d16d,color:#000 style C2A fill:#93d16d,color:#000 style C2B fill:#93d16d,color:#000 style C3A fill:#93d16d,color:#000 style C3B fill:#93d16d,color:#000

Yellow: the Role (OR between its Policies); blue: the Policies; teal boxes: the Claims of each Policy, in green, joined by AND.

Key Insights

  • OR between Policies - User needs to match ANY ONE of the Policies assigned to the Role
  • AND within Policies - User must match ALL Claims within a single Policy
  • If user satisfies AdminInSweden Policy (has Country=Sweden AND Group=Admin), they get Admin role ✅
  • If user satisfies AdminInNorway Policy (has Country=Norway AND Group=Admin), they get Admin role ✅
  • If user satisfies AdminInDenmark Policy (has Group=AdminInDenmark), they get Admin role ✅

Example: AdminInSweden

Policy: "AdminInSweden"
Claims:
  * Country=Sweden (AND)
  * Group=Admin   (AND)

Result: Users must have BOTH Claims to match this Policy:

  • ✅ User has Country=Sweden AND Group=Admin → Access granted
  • ❌ User has only Country=Sweden → Access denied
  • ❌ User has only Group=Admin → Access denied

OR Logic Between Policies

To achieve OR logic, create separate Policies and assign both to the same Role. You assign a Policy to a Role in the Policy's Roles card; the Role's Policies card only lists them.

Animation: the Role Contoso: Operations has one Policy; a second Policy, Contoso: Logistics Users with Group = Contoso-Logistics, is added for the same Role, and the user contoso.logistics signs in and sees the Role's Log Views
Two Policies on one Role: a user who matches either one, here contoso.logistics, gets the Role.

Example: Nordic Administrator

Policy: "AdminInDenmark"
Claims:
  * AdminInDenmark=true

Policy: "AdminInSweden"
Claims:
  * AdminInSweden=true

Policy: "AdminInNorway"
Claims:
  * AdminInNorway=true

Role: "Nordic Administrator"
Policies:
  * AdminInDenmark (OR)
  * AdminInSweden (OR)
  * AdminInNorway (OR)

Result: Users with ANY of these Claims get the "Nordic Administrator" role:

  • ✅ User has AdminInDenmark=true → Access granted
  • ✅ User has AdminInSweden=true → Access granted
  • ✅ User has AdminInNorway=true → Access granted
  • ✅ User has all three Claims → Access granted

The Conflicting Claims Problem

Important

Avoid several Claims with the same Key but different Values in one Policy. Nodinite doesn't stop you, but the Policy then requires both values, which a single-valued claim can never satisfy.

Invalid Policy Configuration

Policy: "Nordic Admin" (INVALID!)
Claims:
  * Country=Denmark (AND)
  * Country=Sweden  (AND)
  * Country=Norway  (AND)

Why This Fails

  1. Policy requires ALL Claims (AND logic)
  2. A single-valued claim such as Country carries one value in the token
  3. User cannot have Country=Denmark AND Country=Sweden simultaneously
  4. ❌ No user can ever satisfy this Policy
  5. ❌ Everyone is blocked from access

A multi-valued claim is different: every value in the token counts, so a user in two groups satisfies Group=Finance AND Group=Managers. That is a valid way to require membership of both groups.

Visual Representation

User's Claims from IDP:
  AdminInDenmark: true
  Group: Admin

Policy "Conflicting Example" requires:
  AdminInDenmark: true  (AND)  ← User has this
  AdminInDenmark: false (AND)  ← User doesn't have this

Result: Policy NOT satisfied → Access DENIED

Correct Pattern: Separate Policies for OR Logic

Valid Configuration

Policy: "DenmarkAccess"
Claims:
  * Country=Denmark

Policy: "SwedenAccess"
Claims:
  * Country=Sweden

Policy: "NorwayAccess"
Claims:
  * Country=Norway

Role: "Nordic Administrator"
Policies:
  * DenmarkAccess
  * SwedenAccess
  * NorwayAccess

Result: Users from any Nordic country get access:

  • ✅ User with Country=Denmark → Matches "DenmarkAccess" Policy
  • ✅ User with Country=Sweden → Matches "SwedenAccess" Policy
  • ✅ User with Country=Norway → Matches "NorwayAccess" Policy

Validation Rules

Nodinite enforces these validation rules when managing Policies:

Empty Policy Detection

The Web Client keeps Save disabled and shows You must select at least one Claim and at least one Role to be able to save the Policy. until the Policy has both. New 7.12 The Web API applies the same rule: it refuses a Policy without a Claim or without a Role with HTTP 400, also when a script or an MCP tool sends it. An empty Policy grants nothing: Policies without Claims, and deleted Policies or Claims, are skipped when Nodinite works out a user's Roles.

The name must be unique, compared without regard to case and including deleted Policies; otherwise the Web API answers Policy Name '…' is already in use. Restore the deleted Policy instead of creating a new one.

There is no check for two Claims with the same Key: see The Conflicting Claims Problem for when that works and when it locks everyone out.

Complex Scenarios

Valid: Multiple Keys, Different Values
Policy: "Finance Manager Sweden"
Claims:
  * Department=Finance     ← Different key
  * Country=Sweden         ← Different key
  * AccessLevel=Admin      ← Different key
  * Environment=Production ← Different key

All different keys → ✅ Valid

Invalid: Same Key, Different Values
Policy: "Multi-Environment" (INVALID!)
Claims:
  * Environment=Production (AND)
  * Environment=Test       (AND)

Same single-valued key with different values → ❌ No user can match

Valid but Redundant: Same Key, Same Value
Policy: "Redundant Example"
Claims:
  * Country=Sweden
  * Country=Sweden  ← Duplicate, but same value

Same key with same value → ✅ Valid but redundant (system may deduplicate)

Next Steps