Skip to content
Workforce IdentityMarkdown

Issuance policy

Ask one policy set before every token the realm issues, deciding on who it's for, their entitlements, their risk and the scopes about to go out.

AvailableAPIOpenID AuthZEN Authorization API 1.0

An issuance policy is a last check before any token leaves the realm. Name a policy set in the realm’s settings, and the realm asks it at every sign-in and every token request: may this user, agent or client be issued this token, with these scopes, for this app? Anything but an allow refuses.

Use it for rules that cut across every app: no high-risk agent gets a token for your finance app, or only holders of the contractor entitlement may use the contractor portal.

  • Who can do it: a realm administrator, in a group that holds RealmOwner (Delegated administration). RealmViewer can read the policies.
  • Where: today this is done through the API (Call the API shows how to get $CVYUH_SESSION).
  • First: decide what everyone else may have. Once a set is named, a token no policy allows is refused, so the set needs an allow before it needs any deny.

With authorizationSettings.issuancePolicySet set, the realm asks that set about:

  • the subject: the user, agent or client the token is for, with their groups, the codes of the entitlements they hold, and their risk class;
  • the resource client://<client_id>;
  • the action authorize at the authorization endpoint (before consent), or issue at introspection and at every token-endpoint grant that issues an access token;
  • the context: the scopes and the authorization details about to be issued.

The question carries these members, which a policy’s subject and conditions can name:

MemberWhat it holds
subject.typeuser, agent or client
subject.idThe user’s or agent’s id, or the client’s client_id
subject.properties.claims.entitlementsThe codes of the entitlements they hold
subject.properties.claims.risk_classTheir risk class, when they have one
subject.properties.groupsThe names of a user’s groups
resource.idclient://<client_id>
action.nameauthorize or issue
context.policySetThe set’s name
context.scopesThe scopes about to be issued
context.authorizationDetailsThe objects about to be issued

Risk. An agent’s riskClass, and a user’s, on the same scale (minimal, limited, high, unacceptable), reach the policy as the subject’s risk_class. A risk cohort, such as every agent whose riskClass is high, can also be a group that membership conditions keep in step, which a policy then names like any group.

Every realm is born with the resource type client (the pattern client://*, the actions authorize and issue) and an empty policy set for it, issuance. The realm asks nothing until you name the set. Each call sends your session as $CVYUH_SESSION (Call the API).

  1. Write the policies in the issuance set, linked to the client type, as on Policies. Write the allow first: once the set is named, an empty set refuses every token. This one allows every token, as the realm does with no set named:

    Terminal window
    curl -X POST "https://foobar.cvyuh.com/api/v0/am/objects/v1/policy?id=issue-by-default" \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "active": true,
    "resources": ["client://*"],
    "actionValues": { "authorize": true, "issue": true },
    "subject": { "type": "AuthenticatedUsers" } }'

    Then write the rule. This one keeps high-risk agents away from the app at https://app.example.com, registered as the client example-app; a deny wins over the allow:

    Terminal window
    curl -X POST "https://foobar.cvyuh.com/api/v0/am/objects/v1/policy?id=no-high-risk-agents" \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "active": true,
    "resources": ["client://example-app"],
    "actionValues": { "authorize": false, "issue": false },
    "subject": { "type": "JwtClaim", "claimName": "risk_class", "claimValue": "high" } }'
  2. Link both policies to the issuance set and the client type, then check the set before it decides anything: ask the decision API as on Test a policy safely, with "resource": { "type": "client", "id": "client://example-app" }, "action": { "name": "issue" } and "context": { "policySet": "issuance" }.

  3. Name the set in the realm’s settings:

    Terminal window
    curl -X PATCH https://foobar.cvyuh.com/api/v0/am/objects/v1/authorizationSettings/authorizationSettings \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "issuancePolicySet": "issuance" }'

A user refused at sign-in is sent back to the app with access_denied, and the app shows its own error. An app or agent refused at the token endpoint gets invalid_grant, or unauthorized_client for a client acting as itself, each with the description “the realm’s issuance policy refuses this token”. Tokens already issued keep working until they expire or are revoked.

Setting or limitDefaultRange
issuancePolicySetunset: nothing is askedany policy set
The issuance set in a new realmempty
Actionsauthorize, issue
SymptomCauseFix
Every sign-in and token is refused after naming the setThe set holds no allow, or the allow isn’t linked to the set and the client typeUnset issuancePolicySet at once, then add and link the allow
A rule about risk never matchesThe agent or user has no riskClassSet it on the agent or user
A rule about a group never matches an agentAn agent holds no groupsUse risk_class or an entitlement code instead

A refused token request is recorded as TOKEN_ISSUED with result FAILED, under the client that asked, with the reason “the realm’s issuance policy refuses this token” (Audit → Authentication). A refused sign-in at the authorization endpoint is recorded as the realm’s sign-in records it. Changes to the set and its policies are in Audit → Config.

  • Anything but an allow refuses, and so does a set that holds no policy: access_denied at the authorization endpoint, otherwise invalid_grant, or unauthorized_client for a client acting as itself.
  • Unset, nothing is asked. issuancePolicySet is unset by default.
  • Some grants have their own trust settings. Transaction tokens, identity assertions and cross-domain chaining grants are governed by their own trust settings (trusted partners, issuesTxnTokens), not by the issuance policy.