{"@attributes":{"version":"2.0"},"channel":{"title":"Tutorial on CPEX Documentation","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/","description":"Recent content in Tutorial on CPEX Documentation","generator":"Hugo","language":"en-us","item":[{"title":"Setup & orientation","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/00-setup\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/00-setup\/","description":"<h1 id=\"module-0-setup--orientation\">Module 0: Setup &amp; orientation<a class=\"anchor\" href=\"#module-0-setup--orientation\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module gets you oriented and checks your setup. It changes nothing on your system.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> understand what CPEX is, confirm your toolchain, and know which modules need the IdP.<\/p>\n<h2 id=\"what-cpex-is\">What CPEX is<a class=\"anchor\" href=\"#what-cpex-is\">#<\/a><\/h2>\n<p>CPEX is a policy enforcement runtime for AI agents. It is a deterministic reference monitor between an agent and every capability it invokes: tools, prompts, resources, inference providers. Each capability defines its own enforcement pipeline (authorization, delegation, redaction, information-flow control, audit), written declaratively in <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/apl\/\">APL<\/a> and run at the boundary.<\/p>"},{"title":"Hello, enforcement","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/01-hello\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/01-hello\/","description":"<h1 id=\"module-1-hello-enforcement\">Module 1: Hello, enforcement<a class=\"anchor\" href=\"#module-1-hello-enforcement\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. No IdP needed for this module.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> stand up the smallest possible CPEX enforcement point and see a route allow one call and deny another, with no application logic making the decision.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>You have tools an agent can call. Some should be gated, some open. You do not want that decision scattered through handler code, where it drifts and is hard to audit. You want it in one place, declarative, at the boundary.<\/p>"},{"title":"Who's calling?","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/02-identity\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/02-identity\/","description":"<h1 id=\"module-2-whos-calling-identity\">Module 2: Who&rsquo;s calling? (Identity)<a class=\"anchor\" href=\"#module-2-whos-calling-identity\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP. Start it first:\n<code>docker compose -f examples\/tutorial\/idp\/docker-compose.yml up -d<\/code><\/p>\n<\/blockquote><p><strong>Goal:<\/strong> resolve a real bearer token into a subject (an id, roles, and permissions) so authorization predicates have something to read.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>In module 1, <code>require(role.hr)<\/code> denied everyone because nobody had a role. Roles and permissions come from identity: a verified token the caller presents. CPEX turns that token into attributes policy can gate on, and it must do so without trusting anything the caller could forge.<\/p>"},{"title":"Shaping data","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/03-shaping\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/03-shaping\/","description":"<h1 id=\"module-3-shaping-data\">Module 3: Shaping data<a class=\"anchor\" href=\"#module-3-shaping-data\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. Runs without the IdP (redaction fires for anonymous callers). The full contrast needs it.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> return a different view of the same backend record per caller, by transforming the result on the way out with redact and mask, gated by permission.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>An HR analyst with clearance should see an employee&rsquo;s SSN. One without should get the record with the SSN removed. Not a different endpoint, not a second query: the same call with a field stripped. The backend returns the full record, so policy must shape it before it leaves the boundary.<\/p>"},{"title":"Effects & sequencing","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/04-effects\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/04-effects\/","description":"<h1 id=\"module-4-effects--sequencing\">Module 4: Effects &amp; sequencing<a class=\"anchor\" href=\"#module-4-effects--sequencing\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. Runs without the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> compose several effects in an ordered pipeline that halts on the first denial, run a side-effecting plugin (audit), and emit your own machine-readable denial code.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Real routes do more than one thing. They audit the attempt, apply a business rule, then check authorization, in a specific order, where a denial stops everything after it but not the side effects before it. You need to see and control that ordering.<\/p>"},{"title":"Delegating decisions (PDP)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/05-pdp\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/05-pdp\/","description":"<h1 id=\"module-5-delegating-decisions-pdp\">Module 5: Delegating decisions (PDP)<a class=\"anchor\" href=\"#module-5-delegating-decisions-pdp\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> hand an authorization decision to a policy engine (a PDP) instead of writing it as a list of <code>require()<\/code> predicates, then let CPEX enforce the engine&rsquo;s verdict.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Some rules mix several inputs at once: &ldquo;engineers may search internal repos only; security may search anything.&rdquo; Expressing that as separate <code>require()<\/code> lines is awkward and easy to get wrong. A rule engine expression states it directly.<\/p>"},{"title":"Scoped credentials (Delegation)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/06-delegation\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/06-delegation\/","description":"<h1 id=\"module-6-scoped-credentials-delegation\">Module 6: Scoped credentials (Delegation)<a class=\"anchor\" href=\"#module-6-scoped-credentials-delegation\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<p><strong>Cookbook recipe:<\/strong> <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/identity-delegation\/#recipe-1-user-acting-through-an-agent-on-behalf-of\">Recipe 1: User acting through an agent (on-behalf-of)<\/a>.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> mint a narrow, downstream-scoped credential for a call with a real OAuth 2.0 token exchange (RFC 8693), instead of forwarding the caller&rsquo;s full token.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>When your agent calls a downstream API, handing it the caller&rsquo;s original token is over-broad: that token works everywhere, for everything the caller can do. You want a token minted for this one downstream call, scoped to a single audience, so a leak is contained. Token exchange does that, and CPEX makes it a policy step rather than integration code.<\/p>"},{"title":"Information flow (Tainting)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/07-tainting\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/07-tainting\/","description":"<h1 id=\"module-7-information-flow-tainting\">Module 7: Information flow (Tainting)<a class=\"anchor\" href=\"#module-7-information-flow-tainting\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> carry security state across a session so a later request can be denied because of what an earlier one did. This is how CPEX stops write-down.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Most authorization systems judge each request alone. That misses a whole class of leaks: a caller reads sensitive data, then sends it out through a channel that looks harmless on its own. You want the second call blocked because of the first, even though nothing about the second call is suspicious in isolation.<\/p>"},{"title":"Human in the loop","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/08-elicitation\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/08-elicitation\/","description":"<h1 id=\"module-8-human-in-the-loop-elicitation\">Module 8: Human in the loop (Elicitation)<a class=\"anchor\" href=\"#module-8-human-in-the-loop-elicitation\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> suspend a sensitive operation until a human approves it, then resume it. The agent cannot proceed on its own.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Some actions are too consequential to run on the agent&rsquo;s say-so: a large transfer, an irreversible change, an outbound message to a client. You want policy to pause the call, ask a human, and only continue once they approve. That means the operation must be able to suspend and resume, not just allow or deny.<\/p>"},{"title":"Write your own plugin","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/09-custom-plugin\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/09-custom-plugin\/","description":"<h1 id=\"module-9-write-your-own-plugin\">Module 9: Write your own plugin<a class=\"anchor\" href=\"#module-9-write-your-own-plugin\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. Runs without the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> write a plugin for a check the builtins do not ship, register it, and reference it from policy by name, exactly like a builtin.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>The bundled plugins cover common needs, but your domain has its own rules. You need a way to drop custom logic into the pipeline without forking CPEX, and to wire it from policy the same way you wire a builtin.<\/p>"},{"title":"Testing your policy","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/10-testing\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/10-testing\/","description":"<h1 id=\"module-10-testing-your-policy\">Module 10: Testing your policy<a class=\"anchor\" href=\"#module-10-testing-your-policy\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. Runs without the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> test policy the way you test code. Load a policy, drive routes with a fake backend, and assert the outcome, so a policy change that breaks a rule fails CI.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Policy decides who sees what. A careless edit can silently open a route or over-redact a field. You want the allow and deny matrix pinned by tests that run on every change, without standing up an IdP or a real backend for the cases that do not need one.<\/p>"},{"title":"Organizing policy (Groups)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/11-groups\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/11-groups\/","description":"<h1 id=\"module-11-organizing-policy-groups\">Module 11: Organizing policy (Groups)<a class=\"anchor\" href=\"#module-11-organizing-policy-groups\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> factor the setup every route shares, here the identity resolver, into one reusable group that routes join instead of repeating.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>By now you have written <code>authentication: [keycloak]<\/code> on route after route. The resolver is the same everywhere; only the per-route authorization differs. That repetition is a maintenance hazard: add a second issuer or a claim mapper later, and you have to change every route and hope you caught them all.<\/p>"},{"title":"Delegation subjects","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/12-subjects\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/12-subjects\/","description":"<h1 id=\"module-12-delegation-subjects-who-the-call-speaks-for\">Module 12: Delegation subjects (who the call speaks for)<a class=\"anchor\" href=\"#module-12-delegation-subjects-who-the-call-speaks-for\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<p><strong>Cookbook recipes:<\/strong> <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/identity-delegation\/#recipe-1-user-acting-through-an-agent-on-behalf-of\">Recipe 1: on-behalf-of a user<\/a> (<code>subject: user<\/code>) and <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/identity-delegation\/#recipe-3-a-service-acting-as-itself\">Recipe 3: a service acting as itself<\/a> (<code>subject: this_workload<\/code>).<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> choose <em>whose<\/em> authority a minted downstream token carries: the caller&rsquo;s, or the gateway&rsquo;s own.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Not every downstream call has a user behind it. A scheduled sync, a shared index lookup, an infrastructure call: there the <em>gateway<\/em> holds the downstream credential and calls as itself, with no caller in the picture. Module 6 minted on behalf of the caller, which is the right default when the agent acts for a signed-in human, and the wrong one here.<\/p>"},{"title":"Delegation as a client","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/13-client\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/13-client\/","description":"<h1 id=\"module-13-delegation-subject-client-the-agent-scopes-its-own-token\">Module 13: Delegation <code>subject: client<\/code> (the agent scopes its own token)<a class=\"anchor\" href=\"#module-13-delegation-subject-client-the-agent-scopes-its-own-token\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<p><strong>Cookbook recipe:<\/strong> <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/identity-delegation\/#recipe-5-scope-a-token-the-agent-already-holds-1-leg\">Recipe 5: Scope a token the agent already holds<\/a>.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> mint a downstream-scoped token when the caller is not a person but an agent acting as itself, an OAuth client that authenticated to the IdP on its own behalf.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Plenty of calls have no human behind them and are not the gateway either. An agent authenticates to the IdP as its own OAuth client (the <code>client_credentials<\/code> grant) and arrives holding a token that speaks for <em>itself<\/em>, where modules 6 and 12 assumed a signed-in human.<\/p>"},{"title":"Passthrough (forward, don't mint)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/14-passthrough\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/14-passthrough\/","description":"<h1 id=\"module-14-passthrough-forward-the-callers-token-mint-nothing\">Module 14: Passthrough (forward the caller&rsquo;s token, mint nothing)<a class=\"anchor\" href=\"#module-14-passthrough-forward-the-callers-token-mint-nothing\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<p><strong>Cookbook recipe:<\/strong> <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/identity-delegation\/#recipe-4-forward-a-token-the-caller-already-has-passthrough\">Recipe 4: Forward a token the caller already has<\/a>.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> recognize the case where the right move is to mint <em>nothing<\/em>, and instead validate the caller&rsquo;s token and forward it unchanged.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Sometimes the caller already holds a token that is correct for the downstream. In the <em>agent-brokered<\/em> case the agent authenticated to the IdP itself and handed CPEX a ready token, and the exchange modules 6, 12 and 13 perform would be pure overhead.<\/p>"},{"title":"Dual-principal (subject + actor)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/15-dual-principal\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/15-dual-principal\/","description":"<h1 id=\"module-15-dual-principal-delegation-who-authorized-vs-who-acted\">Module 15: Dual-principal delegation (who authorized vs. who acted)<a class=\"anchor\" href=\"#module-15-dual-principal-delegation-who-authorized-vs-who-acted\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<p><strong>Cookbook recipe:<\/strong> <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/identity-delegation\/#recipe-6-user-acting-through-an-agent-with-the-agent-named-dual-principal\">Recipe 6: User acting through an agent, with the agent named<\/a>.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> mint a token that speaks <em>for<\/em> the user and also <em>names the agent<\/em> that carried out the call: two principals on one exchange.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>The common agentic shape has two parties: a human decides, and an agent acts. Every delegation so far spoke for one principal, but here you want the audit trail, and the minted token, to record both: the user as the authority (<code>sub<\/code>), and the agent as the acting party (<code>act<\/code>). RFC 8693 calls this <em>delegation<\/em>; recording only the subject is <em>impersonation<\/em>.<\/p>"},{"title":"Workload identity (SVID)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/16-workload\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/16-workload\/","description":"<h1 id=\"module-16-workload-identity-the-agent-proves-itself-with-a-spiffe-svid\">Module 16: Workload identity (the agent proves itself with a SPIFFE SVID)<a class=\"anchor\" href=\"#module-16-workload-identity-the-agent-proves-itself-with-a-spiffe-svid\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP and the SPIRE overlay.<\/p>\n<p><strong>Cookbook recipe:<\/strong> <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/identity-delegation\/#recipe-2-agent-acting-as-itself-by-its-spiffe-svid\">Recipe 2: Agent acting as itself, by its SPIFFE SVID<\/a>.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> let a workload authenticate with a SPIFFE SVID, no user and no client secret, and have CPEX broker a scoped downstream token from it.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>A workload&rsquo;s native identity is a SPIFFE SVID: an ES256 JWT signed by SPIRE, not by your IdP. It proves <em>what the workload is<\/em> (<code>sub<\/code> = <code>spiffe:\/\/\u2026\/agent\/hr-copilot<\/code>), attested by the platform, with no secret to leak. Every caller so far held an OAuth credential instead, whether a user&rsquo;s JWT (module 6), a client&rsquo;s token (module 13), or nothing (passthrough).<\/p>"},{"title":"Multi-issuer (trust federation)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/17-federation\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/17-federation\/","description":"<h1 id=\"module-17-multi-issuer-identity-trust-more-than-one-idp\">Module 17: Multi-issuer identity (trust more than one IdP)<a class=\"anchor\" href=\"#module-17-multi-issuer-identity-trust-more-than-one-idp\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> accept callers from more than one identity provider with a single resolver, each token validated against its own issuer&rsquo;s keys.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>A single enforcement point often fronts several identity providers: your own workforce IdP and a partner org&rsquo;s, a legacy realm and its replacement during a migration, one IdP per business unit. You want to accept tokens from all of them, only those, and validate each on the correct keys.<\/p>"},{"title":"Static attributes (data.*)","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/18-attributes\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/18-attributes\/","description":"<h1 id=\"module-18-static-attributes-operator-maintained-facts\">Module 18: Static attributes (operator-maintained facts)<a class=\"anchor\" href=\"#module-18-static-attributes-operator-maintained-facts\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This module needs the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> feed policy the facts no token carries, operator decisions maintained in a data file, and read them per request as <code>data.*<\/code>.<\/p>\n<h2 id=\"the-problem\">The problem<a class=\"anchor\" href=\"#the-problem\">#<\/a><\/h2>\n<p>Some facts are carried by nothing. Which region a deployment&rsquo;s data must stay in. Which tools are switched on this week. The org&rsquo;s default tier. These are operator decisions, known at configuration time and belonging in neither the token nor the application code, unlike the attributes of modules 2 and 7, which arrive with the request.<\/p>"},{"title":"Capstone","link":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/capstone\/","pubDate":"Mon, 01 Jan 0001 00:00:00 +0000","guid":"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/capstone\/","description":"<h1 id=\"capstone-the-three-backend-agent\">Capstone: the three-backend agent<a class=\"anchor\" href=\"#capstone-the-three-backend-agent\">#<\/a><\/h1>\n<blockquote class='book-hint '>\n<p>You are in the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/tutorial\/\">CPEX tutorial<\/a>. This needs the IdP.<\/p>\n<\/blockquote><p><strong>Goal:<\/strong> assemble everything into the full scenario from the <a href=\"https:\/\/contextforge-org.github.io\/cpex\/docs\/overview\/\">Overview<\/a>: one agent, three backends, three callers, one policy. See identity, permission, delegation, redaction, information flow, and audit compose.<\/p>\n<h2 id=\"the-scenario\">The scenario<a class=\"anchor\" href=\"#the-scenario\">#<\/a><\/h2>\n<p>One policy (<a href=\"https:\/\/github.com\/contextforge-org\/cpex\/tree\/main\/examples\/tutorial\/policies\/capstone.yaml\"><code>policies\/capstone.yaml<\/code><\/a>) defines three routes:<\/p>\n<ul>\n<li><code>get_compensation<\/code> (HR): authorize by role, mint a scoped downstream token, taint the session as having read secret data, audit, and redact fields by permission on the way out.<\/li>\n<li><code>search_repos<\/code> (repos): hand the decision to CEL: engineers read internal only, security reads any.<\/li>\n<li><code>send_email<\/code> (email): refuse if the session already touched secret data, and audit every attempt.<\/li>\n<\/ul>\n<p><code>get_compensation<\/code> is the densest route, and it runs each control you built in order:<\/p>"}]}}