Skip to content
Workforce IdentityMarkdown

Common access policies

Four workforce rules ready to adapt, a strong sign-in for administrators, access only from your network, step-up for one app, and no high-risk agents for finance.

APIOpenID AuthZEN Authorization API 1.0

Most organizations start with the same few access rules. This guide gives four of them, each as the policy you write and what it decides. Adapt the names and addresses, test each one before it decides real calls, then link it to the set your enforcement point reads.

Before you start:

  • Who can do it: a realm administrator, in a group that holds RealmOwner (Delegated administration).
  • Where: today this is done through the API, with your session in $CVYUH_SESSION (Call the API).
  • What you need: the gateway, or your own enforcement point, in front of the APIs, reading the set default (Policies). Recipes 1 and 3 need a stronger sign-in chain named in acrValues (Step up for sensitive actions); here it’s the chain mfaChain.

Each policy is written, then linked to its set and type, as on Policies. Write them with "active": false first if you want to test them in place.

Let the default set use sign-in and group conditions

Section titled “Let the default set use sign-in and group conditions”

A new set allows only conditions an enforcement point decides from the request and its token. Recipes 1 and 3 use the sign-in behind the token, so add AuthenticateToService to the default set’s conditionTypes. The list you send replaces the set’s, so send the whole list:

Terminal window
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/policySet/default \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "conditionTypes": ["OAuth2Scope", "OAuth2AuthorizationDetails", "IPv4", "IPv6", "SimpleTime",
"AuthenticateToService", "AND", "OR", "NOT"] }'

Your admin API at https://admin.example.com is open only to the group it-admins, and only after they signed in through mfaChain:

{ "active": true,
"resources": ["https://admin.example.com:443/*"],
"actionValues": { "GET": true, "POST": true, "PUT": true, "PATCH": true, "DELETE": true },
"subject": { "type": "Identity", "subjectValues": ["it-admins"] },
"condition": { "type": "AuthenticateToService", "authenticateToService": "mfaChain" } }

What it decides: a member of it-admins signed in through mfaChain is allowed. The same member signed in another way isn’t, and the answer carries advice naming mfaChain, so the app can send them to step up. Anyone else gets no_matching_policy. Group membership is read by the realm, so the gateway asks the realm about this policy; an enforcement point that holds only the token answers condition_pending.

Refuse every call from outside your offices’ address range, whatever else allows it. This is a deny with a NOT:

{ "active": true,
"resources": ["*://*:*/*"],
"actionValues": { "GET": false, "POST": false, "PUT": false, "PATCH": false, "DELETE": false, "HEAD": false, "OPTIONS": false },
"subject": { "type": "AuthenticatedUsers" },
"condition": { "type": "NOT", "conditions": [
{ "type": "IPv4", "startIp": "203.0.113.0", "endIp": "203.0.113.255" } ] } }

What it decides: a call from 203.0.113.7 passes this policy untouched, and the other policies decide. A call from anywhere else is refused with policy_denied, naming this policy. Narrow resources to cover only the APIs that should be office-only. If your offices also use IPv6, put an OR of an IPv4 and an IPv6 condition inside the NOT.

Payments at https://pay.example.com need mfaChain, while reading stays open to any signed-in user:

{ "active": true,
"resources": ["https://pay.example.com:443/*"],
"actionValues": { "GET": true },
"subject": { "type": "AuthenticatedUsers" } }
{ "active": true,
"resources": ["https://pay.example.com:443/*"],
"actionValues": { "POST": true },
"subject": { "type": "AuthenticatedUsers" },
"condition": { "type": "AuthenticateToService", "authenticateToService": "mfaChain" } }

What it decides: reads are allowed for anyone signed in. A POST is allowed only for a token from an mfaChain sign-in; otherwise it’s refused with advice naming mfaChain, and the app asks the user to sign in again through it. The user’s session is upgraded in place, so they don’t start over (Sessions).

Keep agents rated high or unacceptable from getting any token for the finance app, registered as the client finance-app. This is an issuance policy, asked before every token, so the agent never holds a token to try:

{ "active": true,
"resources": ["client://finance-app"],
"actionValues": { "authorize": false, "issue": false },
"subject": { "type": "OR", "subjects": [
{ "type": "JwtClaim", "claimName": "risk_class", "claimValue": "high" },
{ "type": "JwtClaim", "claimName": "risk_class", "claimValue": "unacceptable" } ] } }

Link it to the issuance set and the client type. The set needs an allow beside it, or it refuses every token: see Issuance policy.

What it decides: an agent whose riskClass is high or unacceptable asking for a token for finance-app is refused invalid_grant. Every other token is decided by the set’s other policies.

  • Before linking to the real set, ask the decision API for each case, as in Test a policy safely: an allowed caller answers "decision": true, a refused one false with the reason above.
  • After, a refused call at the gateway answers 403. Each deny, and each decision about an agent, is recorded as POLICY_DECIDED (Audit → Authentication), and a refused token as TOKEN_ISSUED with result FAILED.
  • Each policy written is recorded as CREATED in Audit → Config.
SymptomCauseFix
Linking a policy answers 400Its condition kind isn’t in the set’s conditionTypes, or an action isn’t the type’sAdd the kind to the set first; use the type’s actions
Recipe 1 answers condition_pendingThe enforcement point holds only the token, and groups aren’t in itHave the gateway ask the realm, or send the caller’s groups
Recipe 1 or 3 always asks for a step-upmfaChain isn’t in acrValues, so the token never names itMap a level to mfaChain in acrValues
Everyone is refused after recipe 2The enforcement point doesn’t pass the caller’s address, or your range is wrongCheck the address range, and what address the gateway sees behind your proxies
Every token is refused after recipe 4The issuance set holds no allowUnset issuancePolicySet, add the allow, then name it again

Set a policy’s active to false to take it out of every decision at once, or delete it:

Terminal window
curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/policy/<policy id> \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "active": false }'