mirror of
https://github.com/hanzoai/skills.git
synced 2026-11-19 00:47:36 +00:00
hanzoskills.com/llms.txt now opens with the install line, the API reference index and the company index, so an agent that lands on any one of the three can find the rest. robots.txt claimed 537 documents while llms.txt counts 920. The number is gone from robots.txt; llms.txt derives it. public/ is regenerated from scripts/site.py, which it had fallen behind: the copy-prompt menu and agent bar were in the generator and not in the committed pages. tests/site.mjs passes against the result. Co-authored-by: Hanzo Dev <[email protected]>
497 lines
49 KiB
HTML
497 lines
49 KiB
HTML
<!doctype html>
|
|
<html lang="en"><head>
|
|
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
<title>hip-0026</title>
|
|
<meta name="color-scheme" content="dark">
|
|
<style>
|
|
/* Committed to one visual world: a dark instrument panel. No light variant —
|
|
the dot field and the hairline rules only read on black, and a naive
|
|
inversion would wash both out. Every colour is painted explicitly so the page
|
|
never borrows a host background. */
|
|
@font-face{font-family:'Zen';src:url('/fonts/Zen-Variable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
|
|
@font-face{font-family:'Zen';src:url('/fonts/Zen-Italic-Variable.woff2') format('woff2');font-weight:100 900;font-style:italic;font-display:swap}
|
|
@font-face{font-family:'Zen Mono';src:url('/fonts/ZenMono-Variable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
|
|
@font-face{font-family:'Zen Mono';src:url('/fonts/ZenMono-Italic-Variable.woff2') format('woff2');font-weight:100 900;font-style:italic;font-display:swap}
|
|
@font-face{font-family:'Zen Pixel Square';src:url('/fonts/ZenPixel-Square.woff2') format('woff2');font-style:normal;font-display:swap}
|
|
|
|
:root{
|
|
--ink:#f4f4f2; --soft:#9c9c98; --faint:#6a6a66; --ground:#000; --panel:#0a0a0a;
|
|
--line:#232323; --line-hi:#3a3a3a; --accent:#f4f4f2;
|
|
--font-zen-sans:'Zen',-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
|
|
--font-zen-mono:'Zen Mono',ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
|
|
--font-zen-pixel-square:'Zen Pixel Square',monospace;
|
|
--mono:var(--font-zen-mono);
|
|
--sans:var(--font-zen-sans);
|
|
/* Controls are pills and surfaces are soft, as on hanzo.ai. */
|
|
--r:999px; --r-soft:14px;
|
|
}
|
|
*{box-sizing:border-box}
|
|
html{-webkit-text-size-adjust:100%}
|
|
body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--sans);
|
|
font-size:16px;line-height:1.65;-webkit-font-smoothing:antialiased}
|
|
.wrap{max-width:60rem;margin:0 auto;padding:0 1.75rem}
|
|
|
|
/* The dot field. A halftone made of one repeating radial-gradient, faded out
|
|
along the diagonal by a mask so it reads as a wave rather than wallpaper. */
|
|
/* No overflow clip here: the dot field is inset to the box already, and a clip
|
|
would cut off the copy-prompt menu. */
|
|
.hero{position:relative;border-bottom:1px solid var(--line)}
|
|
.hero::before{content:"";position:absolute;inset:0;
|
|
background-image:radial-gradient(var(--line-hi) 1px, transparent 1px);
|
|
background-size:7px 7px;
|
|
-webkit-mask-image:linear-gradient(115deg,#000 0%,rgba(0,0,0,.55) 38%,transparent 72%);
|
|
mask-image:linear-gradient(115deg,#000 0%,rgba(0,0,0,.55) 38%,transparent 72%);
|
|
pointer-events:none}
|
|
.hero .wrap{position:relative;padding-top:5.5rem;padding-bottom:4rem}
|
|
|
|
nav{border-bottom:1px solid var(--line)}
|
|
nav .in{max-width:60rem;margin:0 auto;padding:1.1rem 1.75rem;display:flex;
|
|
justify-content:space-between;align-items:center;gap:1rem}
|
|
.brand{font-family:var(--mono);font-size:.85rem;letter-spacing:.14em;
|
|
text-transform:uppercase;color:var(--ink);text-decoration:none;
|
|
display:inline-flex;align-items:center;gap:.6rem}
|
|
.brand i{font-style:normal;color:var(--faint)}
|
|
.mark{width:1.15em;height:1.15em;display:block;flex:0 0 auto}
|
|
nav a.up{font-family:var(--mono);font-size:.72rem;letter-spacing:.14em;
|
|
text-transform:uppercase;color:var(--soft);text-decoration:none}
|
|
nav a.up:hover{color:var(--ink)}
|
|
|
|
h1{font-family:var(--mono);font-size:clamp(2rem,5.4vw,3.4rem);line-height:1.12;
|
|
letter-spacing:-.02em;margin:0 0 1.1rem;font-weight:500;text-wrap:balance}
|
|
h1 em{font-style:normal;color:var(--faint)}
|
|
.lede{color:var(--soft);font-size:1.05rem;max-width:52ch;margin:0 0 2.25rem}
|
|
|
|
.btns{display:flex;flex-wrap:wrap;gap:.7rem;margin:0 0 .5rem;align-items:center}
|
|
.btn{display:inline-flex;align-items:center;gap:.5rem;font-family:var(--mono);
|
|
font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;
|
|
padding:.8rem 1.4rem;border:1px solid var(--line-hi);border-radius:var(--r);
|
|
color:var(--ink);text-decoration:none;background:transparent;cursor:pointer;
|
|
line-height:1.2;font-weight:400}
|
|
.btn:hover{background:#141414;text-decoration:none;border-color:var(--soft)}
|
|
.btn.solid{background:var(--ink);color:#000;border-color:var(--ink)}
|
|
.btn.solid:hover{background:#d8d8d4}
|
|
.btn .chev{width:.7em;height:.7em;flex:0 0 auto;transition:transform .15s ease}
|
|
.btn[aria-expanded="true"] .chev{transform:rotate(180deg)}
|
|
|
|
/* Copy-prompt selector. Each row copies the prompt for its own target. */
|
|
.copy{position:relative;display:inline-flex}
|
|
.menu{position:absolute;top:calc(100% + .5rem);left:0;z-index:20;min-width:21rem;
|
|
background:var(--panel);border:1px solid var(--line-hi);border-radius:var(--r-soft);
|
|
padding:.4rem;display:flex;flex-direction:column;
|
|
box-shadow:0 12px 32px rgba(0,0,0,.75)}
|
|
.menu[hidden]{display:none}
|
|
.mi{display:flex;align-items:center;gap:.7rem;width:100%;text-align:left;
|
|
padding:.62rem .8rem;border:0;border-radius:calc(var(--r-soft) - .35rem);
|
|
background:transparent;color:var(--ink);font-family:var(--mono);font-size:.76rem;
|
|
letter-spacing:.04em;text-decoration:none;cursor:pointer;line-height:1.3;
|
|
white-space:nowrap}
|
|
.mi:hover,.mi:focus-visible{background:#181818;outline:none}
|
|
.mi .mark{width:1.05rem;height:1.05rem;color:var(--soft)}
|
|
.mi:hover .mark{color:var(--ink)}
|
|
.mi u{margin-left:auto;color:var(--faint);text-decoration:none;font-size:.68rem;
|
|
letter-spacing:.1em;text-transform:uppercase}
|
|
|
|
/* Works-with bar: one scrolling row, name and mark per agent. */
|
|
.strip{border-bottom:1px solid var(--line);background:var(--panel)}
|
|
.strip .in{max-width:60rem;margin:0 auto;padding:.9rem 1.75rem;display:flex;
|
|
align-items:center;gap:1.25rem;font-family:var(--mono);font-size:.72rem;
|
|
letter-spacing:.1em;text-transform:uppercase;color:var(--faint)}
|
|
.strip b{color:var(--soft);font-weight:400;flex:0 0 auto;
|
|
border-right:1px solid var(--line);padding-right:1.25rem;align-self:stretch;
|
|
display:flex;align-items:center}
|
|
.bar{display:flex;align-items:center;gap:.5rem;flex:1 1 auto;min-width:0;
|
|
overflow-x:auto;scrollbar-width:none;scroll-snap-type:x proximity;
|
|
-webkit-overflow-scrolling:touch;
|
|
-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 3rem),transparent);
|
|
mask-image:linear-gradient(90deg,#000 calc(100% - 3rem),transparent)}
|
|
.bar::-webkit-scrollbar{display:none}
|
|
.agent{display:inline-flex;align-items:center;gap:.45rem;flex:0 0 auto;
|
|
padding:.4rem .85rem;border:1px solid var(--line);border-radius:var(--r);
|
|
color:var(--soft);white-space:nowrap;scroll-snap-align:start;
|
|
text-decoration:none;background:var(--ground)}
|
|
.agent:hover{color:var(--ink);border-color:var(--line-hi);text-decoration:none}
|
|
.agent .mark{width:.95rem;height:.95rem}
|
|
|
|
h2{font-family:var(--mono);font-size:1.1rem;letter-spacing:-.01em;margin:2.75rem 0 .75rem;font-weight:500}
|
|
h3{font-size:1rem;margin:2rem 0 .5rem;font-weight:600}
|
|
h4,h5,h6{font-size:.94rem;margin:1.5rem 0 .5rem;font-weight:600}
|
|
p{margin:0 0 1rem;max-width:70ch}
|
|
ul,ol{margin:0 0 1rem;padding-left:1.35rem;max-width:70ch}
|
|
li{margin:.22rem 0}
|
|
a{color:var(--ink);text-decoration:underline;text-underline-offset:3px;
|
|
text-decoration-color:var(--line-hi)}
|
|
a:hover{text-decoration-color:var(--ink)}
|
|
a:focus-visible{outline:1px solid var(--ink);outline-offset:3px}
|
|
code{font-family:var(--mono);font-size:.85em;background:var(--panel);
|
|
border:1px solid var(--line);border-radius:5px;padding:.1em .36em}
|
|
pre{background:var(--panel);border:1px solid var(--line);padding:1rem 1.1rem;
|
|
border-radius:var(--r-soft);overflow-x:auto;margin:0 0 1.25rem}
|
|
pre code{background:none;border:0;padding:0;font-size:.82rem;line-height:1.7}
|
|
blockquote{margin:0 0 1rem;padding-left:1rem;border-left:1px solid var(--line-hi);color:var(--soft)}
|
|
hr{border:0;border-top:1px solid var(--line);margin:2.5rem 0}
|
|
table{border-collapse:collapse;width:100%;margin:0 0 1.25rem;font-size:.92rem;
|
|
display:block;overflow-x:auto}
|
|
th,td{border:1px solid var(--line);padding:.5rem .7rem;text-align:left}
|
|
|
|
.curl{display:block;background:var(--panel);border:1px solid var(--line);
|
|
border-radius:var(--r-soft);padding:.95rem 1.1rem;font-family:var(--mono);
|
|
font-size:.8rem;color:var(--soft);overflow-x:auto;margin:0 0 2.5rem;
|
|
white-space:pre;line-height:1.9}
|
|
.curl b{color:var(--ink);font-weight:400}
|
|
.curl i{font-style:normal;color:var(--faint)}
|
|
|
|
/* index */
|
|
#q{width:100%;padding:.85rem 1.2rem;font-family:var(--mono);font-size:.85rem;color:var(--ink);
|
|
background:var(--panel);border:1px solid var(--line);border-radius:var(--r);margin:0 0 .6rem}
|
|
#q::placeholder{color:var(--faint);text-transform:uppercase;letter-spacing:.1em;font-size:.72rem}
|
|
#q:focus{outline:none;border-color:var(--soft)}
|
|
#count{color:var(--faint);font-family:var(--mono);font-size:.72rem;letter-spacing:.1em;
|
|
text-transform:uppercase;margin:0 0 2rem}
|
|
.cat{margin:2.5rem 0 .5rem;font-family:var(--mono);font-size:.7rem;letter-spacing:.16em;
|
|
text-transform:uppercase;color:var(--faint);border-bottom:1px solid var(--line);
|
|
padding-bottom:.45rem}
|
|
.row{display:block;padding:.6rem .9rem;margin:0 -.9rem;border-bottom:1px solid var(--line);
|
|
border-radius:var(--r-soft);text-decoration:none}
|
|
.row:hover{background:#0a0a0a}
|
|
.nm{font-family:var(--mono);font-size:.84rem;color:var(--ink);display:block}
|
|
.ds{color:var(--soft);font-size:.9rem;display:block;margin-top:.12rem}
|
|
footer{margin-top:4rem;padding:2rem 0 4rem;border-top:1px solid var(--line);
|
|
color:var(--faint);font-size:.85rem}
|
|
footer a{color:var(--soft)}
|
|
.fmap{display:grid;gap:1.75rem;grid-template-columns:repeat(auto-fit,minmax(11rem,1fr));
|
|
margin:0 0 2rem;font-size:.85rem}
|
|
.fmap b{display:block;font-family:var(--mono);font-size:.68rem;letter-spacing:.16em;
|
|
text-transform:uppercase;color:var(--faint);font-weight:400;margin:0 0 .6rem;
|
|
border-bottom:1px solid var(--line);padding-bottom:.4rem}
|
|
.fmap a{display:inline-block;color:var(--ink);text-decoration:none;margin:.3rem .35rem 0 0}
|
|
.fmap a:hover{text-decoration:underline}
|
|
.fmap div{color:var(--faint);line-height:1.5}
|
|
.fend{border-top:1px solid var(--line);padding-top:1.25rem;font-size:.82rem}
|
|
|
|
@media (max-width:640px){
|
|
.hero .wrap{padding-top:3.25rem;padding-bottom:2.75rem}
|
|
.btns{gap:.5rem}
|
|
.btn{padding:.75rem 1.15rem;font-size:.68rem}
|
|
.copy,.copy .btn{width:100%;justify-content:center}
|
|
.menu{left:0;right:0;min-width:0}
|
|
.strip .in{flex-direction:column;align-items:flex-start;gap:.6rem;padding:.9rem 1.75rem}
|
|
.strip b{border-right:0;padding-right:0}
|
|
.bar{width:100%}
|
|
}
|
|
</style>
|
|
<link rel="alternate" type="text/markdown" href="/hip-0026.md">
|
|
|
|
<link rel="icon" href="/favicon.svg">
|
|
<link rel="canonical" href="https://hanzoskills.com/hip-0026">
|
|
</head>
|
|
<!-- Reading this with a machine? Every page here is also plain markdown.
|
|
This one: https://hanzoskills.com/hip-0026.md
|
|
Index: https://hanzoskills.com/llms.txt
|
|
Corpus: https://hanzoskills.com/all.md
|
|
Append .md to any path for the markdown twin. -->
|
|
<body>
|
|
<nav><div class="in">
|
|
<a class="brand" href="/"><svg class="mark" viewBox="0 0 67 67" fill="currentColor" aria-hidden="true"><path d="M22.21 67V44.6369H0V67H22.21Z"/><path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z"/><path d="M22.21 0H0V22.3184H22.21V0Z"/><path d="M66.7198 0H44.5098V22.3184H66.7198V0Z"/><path d="M66.7198 67V44.6369H44.5098V67H66.7198Z"/></svg> HANZO<i>SKILLS</i></a>
|
|
<a class="up" href="/">All skills</a>
|
|
</div></nav>
|
|
|
|
<div class="wrap">
|
|
<h1>hip-0026</h1><p class="lede">HIP-26: Identity & Access Management Standard. Status Draft. Hanzo architectural specification.</p><h1>HIP-0026: Identity & Access Management Standard</h1>
|
|
<h2>Abstract</h2>
|
|
<p>Hanzo IAM is the identity and access management provider for the Hanzo ecosystem and the <strong>sole</strong> authority for identity and tokens. Nothing else in the estate issues a credential, validates one, or keeps a session: there is no service token, no shared secret and no per-app auth stack. This HIP specifies the <strong>server</strong>; HIP-0111 specifies the wire contract every client speaks to it, and where the two touch, HIP-0111 is authoritative.</p>
|
|
<p>IAM is a clean-room native rewrite on the Hanzo stack — <code>zip</code> over <code>hanzoai/orm</code>, with no Beego and no xorm. Storage is one <code>orm.DB</code> abstraction with the backend chosen at boot (<code>--store</code>): embedded SQLite by default (<code>hanzoai/sqlite</code>, pure-Go, WAL), or the shared <code>sql</code> or <code>datastore</code> over ZAP (HIP-0144). Every handler is written once against <code>orm.DB</code> and never against a driver.</p>
|
|
<p>It implements OAuth 2.0, OpenID Connect, and SCIM 2.0, and provides multi-tenant authentication with per-organization white-label identity domains. Any organization registered in IAM can be assigned a branded login page and identity domain; the default deployment ships hanzo.id, lux.id, zoo.id, pars.id and id.ad.nexus.</p>
|
|
<p><strong>Repository</strong>: <a href="https://github.com/hanzoai/iam">github.com/hanzoai/iam</a> <strong>Image</strong>: <code>ghcr.io/hanzoai/iam</code> <strong>Retired</strong>: the Beego/xorm fork this replaced is <code>hanzoai/iam-v1</code>, out of every graph. A description of Beego, xorm, or a Postgres schema is a description of that repository.</p>
|
|
<h2>Motivation</h2>
|
|
<h3>The Problem</h3>
|
|
<p>Every service in the Hanzo ecosystem needs authentication. Without a centralized IAM, each team independently builds login flows, token validation, user storage, and session management. This leads to:</p>
|
|
<ol><li><strong>Duplicated effort</strong>: Cloud, Commerce, Console, Platform, and Chat all need OAuth. Five teams building five login pages is waste.</li><li><strong>Inconsistent security posture</strong>: Some teams do PKCE, some do not. Some rotate tokens, some use static API keys. The attack surface is the union of all weaknesses.</li><li><strong>No cross-service SSO</strong>: A user logged into cloud.hanzo.ai should not need to log in again at console.hanzo.ai. Without centralized identity, SSO requires ad-hoc token sharing.</li><li><strong>Multi-org complexity</strong>: Hanzo (AI infrastructure), Lux (blockchain), Zoo (research foundation), Pars (regional platform), and AdNexus (advertising) are separate organizations with separate branding, but share users and infrastructure. Each organization needs its own login page, theme, and policies, while a single user (e.g., <code>[email protected]</code>) must hold memberships across all of them.</li><li><strong>Billing integration</strong>: AI usage is metered per-user. The billing system needs a single source of truth for "who is this user and what is their balance?" If user identity lives in IAM and balance lives in a separate billing service, every LLM API call requires two round-trips.</li></ol>
|
|
<h3>Why Centralized IAM Solves This</h3>
|
|
<p>A single IAM instance at hanzo.id eliminates all five problems. Services delegate authentication entirely. The OAuth application model provides per-service isolation (each app has its own client ID, redirect URIs, and scopes). Multi-org support is built into the data model. And the user entity in IAM carries a <code>balance</code> field, so balance checks are a single query against the same database that validates the token.</p>
|
|
<h2>Design Philosophy</h2>
|
|
<p>This section explains the <em>why</em> behind each major design decision. Good infrastructure decisions compound; bad ones metastasize. Understanding the rationale prevents future engineers from "fixing" things that are not broken.</p>
|
|
<h3>Why one identity service, owned outright</h3>
|
|
<p>A managed identity service prices per monthly active user and puts the most sensitive part of the stack behind somebody else's export path: migrating password hashes out is not a routine operation, and an air-gapped or sovereign deployment cannot use a hosted provider at all. Those are the constraints, and they are why identity is ours.</p>
|
|
<p>Owning it is not the same as forking it. The predecessor was a fork, and the fork is what a clean-room rewrite replaced — <code>hanzoai/iam</code> owns its source outright and collapses to one way of doing each thing. What that buys is the ability to delete: the vendor error envelope, the verb aliases, the second spelling of the token endpoint, and the second storage engine all go away because nothing upstream requires them (HIP-0111 §4 lists what is gone and §Conformance status records what is still live).</p>
|
|
<p>The cost is stated plainly: a rewrite carries no upstream community and no inherited security review, so the surface is RFC-standard precisely so that review can be done against the RFCs rather than against us.</p>
|
|
<h3>Why Multi-Tenant via Domain</h3>
|
|
<p>Each organization gets its own white-label identity domain. The system supports an arbitrary number of tenants — any organization registered in IAM can be assigned a custom domain. The default deployment includes:</p>
|
|
<p>| Organization | Domain | Primary Color | Description | |-------------|--------|---------------|-------------| | Hanzo | hanzo.id | #fd4444 (red) | AI infrastructure | | Lux | lux.id | #e4e4e7 (zinc) | Blockchain network | | Zoo | zoo.id | #10b981 (emerald) | Research foundation | | Pars | pars.id | #3b82f6 (blue) | Regional platform | | AdNexus | id.ad.nexus | #3b82f6 (blue) | Advertising platform |</p>
|
|
<p>Adding a new tenant requires:</p>
|
|
<ol><li>Create the organization in IAM (via API or init_data.json)</li><li>Create an OAuth application for the organization</li><li>Add the domain to the edge (an <code>IngressRoute</code> served by Hanzo Ingress, HIP-0068, or a DNS record)</li><li>Either add the domain to the <code>hanzo/id</code> middleware tenant map, or deploy a forked instance with <code>IAM_ORIGIN</code>, <code>NEXT_PUBLIC_ORG</code>, and <code>NEXT_PUBLIC_CLIENT_ID</code> environment variables</li></ol>
|
|
<p>Hanzo Ingress (HIP-0068) routes every tenant domain to the same IAM process. IAM resolves the organization from the request's <code>Host</code> header via the <code>origin</code> configuration and the application's <code>organization</code> field. Organizations are fully isolated — different themes, different OAuth applications, different password policies, different MFA requirements — while sharing one IAM process and one database.</p>
|
|
<p>The <code>hanzo/id</code> login UI is designed to be forked for deep customization. Organizations can:</p>
|
|
<ul><li>Fork <code>hanzoai/id</code> to <code>luxfi/id</code>, <code>zoofdn/id</code>, etc. for fully custom branding</li><li>Or use the same <code>hanzoai/id</code> image with per-tenant env vars for lightweight white-labeling</li><li>Or add entries to the middleware tenant map for multi-domain deployment from a single image</li></ul>
|
|
<p>The alternative (path-based multi-tenancy like <code>hanzo.id/lux/login</code>) is fragile. It leaks the organizational structure into URLs, makes CORS configuration harder, and prevents each org from having a clean, branded identity domain that users can trust.</p>
|
|
<h3>Why balances are NOT IAM's</h3>
|
|
<p>An earlier revision of this HIP argued that the user's balance belongs on the user record, so that "is this caller authenticated?" and "does this caller have credit?" answer in one token validation. That is not what shipped, and the argument does not survive contact with the money.</p>
|
|
<p>A balance is a position in a ledger. It is derived from transactions that Commerce records, that a payment processor confirms, and that a metered usage record debits — three systems with their own ordering, retries and reconciliation (HIP-0018, HIP-1220, HIP-1313, HIP-1001). Putting the authoritative copy on the identity record makes identity a participant in settlement: a failed debit becomes an identity write, and a disagreement between the two copies is resolved by whichever one a reader happened to ask.</p>
|
|
<p><strong>The balance fields IAM carries are read-only mirrors, and the code says so.</strong> The authoritative balance lives in Commerce. A service that gates on credit reads the entitlement surface, not the identity record; a token is proof of who is calling, never of what they can afford.</p>
|
|
<h2>Specification</h2>
|
|
<h3>Architecture</h3>
|
|
<pre><code> Internet
|
|
│
|
|
┌─────────┴─────────┐
|
|
│ Hanzo Ingress │
|
|
│ (TLS termination) │
|
|
│ HIP-0068 │
|
|
└─────────┬─────────┘
|
|
│
|
|
┌───────────────┼───────────────┐
|
|
│ │ │
|
|
hanzo.id lux.id zoo.id ...
|
|
│ │ │
|
|
└───────────────┼───────────────┘
|
|
│
|
|
┌─────────┴─────────┐
|
|
│ Hanzo IAM │
|
|
│ zip over orm.DB │
|
|
│ HTTP edge + ZAP │
|
|
└─────────┬─────────┘
|
|
│ --store
|
|
┌─────────┴─────────┐
|
|
│ sqlite (default) │
|
|
│ sql | datastore │
|
|
│ HIP-0144 │
|
|
└───────────────────┘</code></pre>
|
|
<h3>OAuth 2.0 Flow: Authorization Code Grant with PKCE</h3>
|
|
<p>Every Hanzo application uses Authorization Code Grant with PKCE (RFC 7636). Implicit grant is not supported. This is the flow:</p>
|
|
<pre><code>1. Client generates code_verifier (random 43-128 chars)
|
|
2. Client computes code_challenge = BASE64URL(SHA256(code_verifier))
|
|
|
|
3. Client redirects user to:
|
|
GET https://iam.hanzo.ai/v1/iam/oauth/authorize
|
|
?client_id=hanzo-app-client-id
|
|
&redirect_uri=https://hanzo.ai/callback
|
|
&response_type=code
|
|
&scope=openid profile email
|
|
&state=<random>
|
|
&code_challenge=<code_challenge>
|
|
&code_challenge_method=S256
|
|
|
|
4. User authenticates at the brand login UI (password, WebAuthn, or social login)
|
|
|
|
5. IAM redirects back:
|
|
GET https://hanzo.ai/callback
|
|
?code=<authorization_code>
|
|
&state=<random>
|
|
|
|
6. Client exchanges code for tokens:
|
|
POST https://iam.hanzo.ai/v1/iam/oauth/token
|
|
grant_type=authorization_code
|
|
&code=<authorization_code>
|
|
&redirect_uri=https://hanzo.ai/callback
|
|
&client_id=hanzo-app-client-id
|
|
&code_verifier=<code_verifier>
|
|
|
|
7. IAM returns:
|
|
{
|
|
"access_token": "eyJhbGciOi...",
|
|
"token_type": "Bearer",
|
|
"expires_in": 604800,
|
|
"refresh_token": "eyJhbGciOi...",
|
|
"id_token": "eyJhbGciOi...",
|
|
"scope": "openid profile email"
|
|
}</code></pre>
|
|
<p>Access tokens are JWTs signed with the application's certificate (e.g., <code>cert-hanzo</code>). Token lifetime defaults to 168 hours (7 days). Refresh token lifetime defaults to 720 hours (30 days).</p>
|
|
<h3>Multi-Tenant Domain Resolution</h3>
|
|
<p>When a request arrives, IAM resolves the organization context through the following chain:</p>
|
|
<ol><li><strong>Application lookup via <code>/v1/iam/get-app-login</code></strong>: The login UI (hosted at hanzo.id, served by the <code>hanzo.id-worker</code> Cloudflare Worker) calls this endpoint with the <code>clientId</code> from the OAuth authorize URL. IAM returns the application name and organization name. This is the source of truth.</li></ol>
|
|
<ol><li><strong>Direct login via <code>/v1/iam/login</code></strong>: The payload includes <code>application</code> and <code>organization</code> fields. These must match the application's configured organization. Hardcoding <code>organization: "hanzo"</code> for all requests breaks scoped SSO clients (e.g., KMS has its own client ID and expects the correct org context).</li></ol>
|
|
<ol><li><strong>Domain-based fallback</strong>: If no application context is provided, IAM falls back to matching the request <code>Host</code> header against known origins. Each application configures <code>origin</code> and <code>originFrontend</code> to enable this.</li></ol>
|
|
<h3>Application Configuration</h3>
|
|
<p>Each service in the ecosystem registers as an OAuth application with its own client credentials, redirect URIs, and scopes:</p>
|
|
<p>| Application | Client ID | Organization | Redirect URIs (production) | |------------|-----------|--------------|---------------------------| | app-hanzo | hanzo-app-client-id | hanzo | hanzo.ai/callback, hanzo.app/callback, cloud.hanzo.ai/callback | | app-cloud | hanzo-cloud-client-id | hanzo | cloud.hanzo.ai/callback | | app-commerce | hanzo-commerce-client-id | hanzo | commerce.hanzo.ai/callback | | app-console | hanzo-console-client-id | hanzo | console.hanzo.ai/api/auth/callback/hanzo-iam | | app-platform | hanzo-platform-client-id | hanzo | platform.hanzo.ai/callback | | app-zoo | zoo-app-client-id | zoo | zoo.ngo/callback, zips.zoo.ngo/callback | | app-lux | lux-app-client-id | lux | lux.network/callback, wallet.lux.network/callback | | app-pars | pars-app-client-id | pars | pars.ai/callback | | app-adnexus | adnexus-app-client-id | adnexus | ad.nexus/callback |</p>
|
|
<p>All applications use:</p>
|
|
<ul><li><strong>Grant types</strong>: <code>authorization_code</code>, <code>refresh_token</code>, <code>client_credentials</code>, <code>implicit</code>, <code>password</code></li><li><strong>Response types</strong>: <code>code</code>, <code>token</code>, <code>id_token</code></li><li><strong>Token format</strong>: JWT</li><li><strong>Password hashing</strong>: argon2id</li><li><strong>WebAuthn</strong>: Enabled</li></ul>
|
|
<p>Client secrets use KMS-managed placeholders (<code>${IAM_APP_HANZO_CLIENT_SECRET}</code>) resolved at startup via the <code>resolveSecrets()</code> function. Plaintext secrets never appear in configuration files or init_data.json.</p>
|
|
<h3>The balance mirror</h3>
|
|
<p>Every user and organization carries balance fields. They are a <strong>cache with a publisher</strong>, not a ledger:</p>
|
|
<ul><li>Commerce owns the authoritative position and every balance-affecting event.</li><li>IAM's copy exists so a surface that has already validated a token can render a</li></ul>
|
|
<p> number without a second round trip.</p>
|
|
<ul><li>A decision that costs money — admitting a request, starting a run, releasing a</li></ul>
|
|
<p> payout — MUST read the authoritative surface. Gating spend on a mirror gates it on a value that can be stale in the direction that costs us.</p>
|
|
<p>There is no <code>add-balance</code> and no <code>add-transaction</code> verb on IAM (HIP-0111 §4.8). The ledger's shape is specified where the ledger is: HIP-1001 for double-entry, HIP-1313 for the metered record, HIP-1220 for the merchant half.</p>
|
|
<h3>Bootstrap: init_data.json</h3>
|
|
<p>IAM bootstraps from <code>init_data.json</code> on first startup. This file defines the initial state of the system:</p>
|
|
<pre><code class="lang-json">{
|
|
"organizations": [
|
|
{
|
|
"name": "hanzo",
|
|
"displayName": "Hanzo",
|
|
"websiteUrl": "https://hanzo.ai",
|
|
"passwordType": "argon2id",
|
|
"defaultApplication": "app-hanzo",
|
|
"themeData": {
|
|
"themeType": "dark",
|
|
"colorPrimary": "#fd4444"
|
|
}
|
|
},
|
|
{ "name": "zoo", "displayName": "Zoo Labs", "colorPrimary": "#10b981" },
|
|
{ "name": "lux", "displayName": "Lux Network", "colorPrimary": "#e4e4e7" },
|
|
{ "name": "pars", "displayName": "Pars", "colorPrimary": "#3b82f6" },
|
|
{ "name": "adnexus", "displayName": "AdNexus", "colorPrimary": "#3b82f6" }
|
|
],
|
|
"applications": [
|
|
{
|
|
"name": "app-hanzo",
|
|
"organization": "hanzo",
|
|
"clientId": "hanzo-app-client-id",
|
|
"clientSecret": "${IAM_APP_HANZO_CLIENT_SECRET}",
|
|
"grantTypes": ["authorization_code", "refresh_token", "client_credentials", "implicit", "password"],
|
|
"tokenFormat": "JWT",
|
|
"expireInHours": 168,
|
|
"refreshExpireInHours": 720
|
|
}
|
|
],
|
|
"users": [
|
|
{
|
|
"name": "admin",
|
|
"email": "[email protected]",
|
|
"type": "normal-user",
|
|
"isAdmin": true,
|
|
"balance": 10000
|
|
}
|
|
],
|
|
"certs": [
|
|
{
|
|
"name": "cert-hanzo",
|
|
"cryptoAlgorithm": "RS256",
|
|
"bitSize": 4096
|
|
}
|
|
]
|
|
}</code></pre>
|
|
<p>The <code>initDataNewOnly</code> configuration flag controls whether init_data.json overwrites existing records (false) or only creates missing ones (true). Production uses <code>initDataNewOnly = false</code> to ensure configuration drift is corrected on restart.</p>
|
|
<h3>API Endpoints</h3>
|
|
<p><strong>HIP-0111 §1 is the one table of endpoints.</strong> It is not repeated here, because two tables of one surface is how the second one goes stale — which is exactly what happened: this section previously listed <code>get-account</code>, <code>get-user</code>, <code>add-user</code>, <code>update-user</code>, <code>delete-user</code>, <code>add-balance</code>, <code>add-transaction</code> and <code>get-transactions</code> as the user-management and billing surface, and every one of those is a verb alias HIP-0111 §4.8 forbids. Identity provisioning is SCIM 2.0 (§8); account claims are OIDC UserInfo (§1); delegation is RFC 8693 token exchange (§7); balances are Commerce's, not IAM's.</p>
|
|
<p>What this HIP states about the surface, as the server's own concern:</p>
|
|
<ul><li>The paths are <code>/v1/iam/<em></code>. There is no <code>/oauth/</em></code>, no <code>/api/login/*</code>, no</li></ul>
|
|
<p> <code>/api/</code> prefix anywhere, and no <code>v2</code> (HIP-0119).</p>
|
|
<ul><li>IAM serves a <code>200 text/html</code> SPA catch-all for any unregistered path, so a</li></ul>
|
|
<p> wrong path is silent breakage rather than a <code>404</code>. That is why clients reach the surface only through <code>@hanzo/iam</code>, which holds the paths in one place.</p>
|
|
<ul><li>The login entry point (<code>get-app-login</code>, <code>login</code>, <code>signup</code>,</li></ul>
|
|
<p> <code>send-verification-code</code>) is the authorization server's own concern — OAuth deliberately does not specify how an AS authenticates the end user — and is called by the hosted login UI alone. It is not a client integration surface. HIP-0111 §6 is normative for it.</p>
|
|
<ul><li>Health is at the root: <code>/healthz</code>, <code>/readyz</code>. Not <code>/api/health</code>.</li></ul>
|
|
<p>The discovery document is host-relative and self-consistent — issuer, authorize, token, userinfo and jwks share one origin, which requires <code>originFrontend</code> to be empty:</p>
|
|
<pre><code class="lang-json">{
|
|
"issuer": "https://iam.hanzo.ai",
|
|
"authorization_endpoint": "https://iam.hanzo.ai/v1/iam/oauth/authorize",
|
|
"token_endpoint": "https://iam.hanzo.ai/v1/iam/oauth/token",
|
|
"userinfo_endpoint": "https://iam.hanzo.ai/v1/iam/oauth/userinfo",
|
|
"jwks_uri": "https://iam.hanzo.ai/v1/iam/.well-known/jwks",
|
|
"end_session_endpoint": "https://iam.hanzo.ai/v1/iam/oauth/logout",
|
|
"response_types_supported": ["code"],
|
|
"grant_types_supported": ["authorization_code", "refresh_token", "client_credentials"],
|
|
"code_challenge_methods_supported": ["S256"],
|
|
"token_endpoint_auth_methods_supported": ["client_secret_basic"]
|
|
}</code></pre>
|
|
<p>A split-origin discovery document breaks strict OIDC clients that pin the issuer.</p>
|
|
<h3>SDK Integration</h3>
|
|
<p>The client contract is <strong>HIP-0111</strong>. JS/TS applications integrate only through <code>@hanzo/iam</code>; Go services use <code>iamsdk</code>. No application writes an OIDC path string.</p>
|
|
<h4>Go SDK</h4>
|
|
<pre><code class="lang-go">import "github.com/hanzoai/iam/iamsdk"
|
|
|
|
func init() {
|
|
iamsdk.InitConfig(
|
|
"https://iam.hanzo.ai", // IAM endpoint
|
|
"hanzo-app-client-id", // Client ID
|
|
"client-secret-here", // Client secret
|
|
"cert-hanzo", // Certificate name
|
|
"hanzo", // Organization
|
|
"app-hanzo", // Application
|
|
)
|
|
}
|
|
|
|
// Validate a JWT access token
|
|
func validateToken(token string) (*iamsdk.Claims, error) {
|
|
claims, err := iamsdk.ParseJwtToken(token)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("invalid token: %w", err)
|
|
}
|
|
return claims, nil
|
|
}
|
|
|
|
// Get user info from token
|
|
func getUserInfo(token string) (*iamsdk.User, error) {
|
|
return iamsdk.GetUserByAccessToken(token)
|
|
}</code></pre>
|
|
<h4>JavaScript / TypeScript SDK (<code>@hanzo/iam</code>)</h4>
|
|
<p>Server-side token validation:</p>
|
|
<pre><code class="lang-ts">import { validateToken } from "@hanzo/iam/server";
|
|
|
|
const result = await validateToken(accessToken, {
|
|
serverUrl: "https://iam.hanzo.ai",
|
|
clientId: "hanzo-app-client-id",
|
|
});
|
|
if (result.ok) {
|
|
const { userId, email, owner } = result; // owner = org slug; scope queries to it
|
|
}</code></pre>
|
|
<p>Framework providers (<code>@hanzo/iam/betterauth</code>, <code>@hanzo/iam/nextauth</code>), the React SPA client (<code>@hanzo/iam/react</code>, <code>@hanzo/iam/browser</code>), and Passport (<code>@hanzo/iam/passport</code>) are specified in HIP-0111.</p>
|
|
<h2>Implementation</h2>
|
|
<h3>Deployment</h3>
|
|
<p>IAM runs on the <code>hanzo-k8s</code> cluster, one process per brand origin, behind Hanzo Ingress (HIP-0068), which terminates TLS and routes every tenant domain to it. The image is <code>ghcr.io/hanzoai/iam</code>, built by Hanzo Git Actions from <code>.hanzo/workflows/</code> (HIP-0036); there is no second registry.</p>
|
|
<p>Health is at the root — <code>/healthz</code>, <code>/readyz</code> — never under a version prefix and never under <code>/api/</code> (HIP-0119 §Health).</p>
|
|
<h3>Configuration</h3>
|
|
<p>Configuration is flags with environment fallbacks; there is no <code>app.conf</code> and no Beego <code>runmode</code>.</p>
|
|
<p>| flag | what it decides | |---|---| | <code>--store</code> | <code>sqlite</code> (default), <code>sql</code>, or <code>datastore</code> — see Storage below | | <code>--db</code> | SQLite path, when the store is <code>sqlite</code> | | <code>--zap</code> | the ZAP listener for service-to-service calls | | <code>--http</code> | the external HTTP edge | | <code>--init-data</code> | seed file, new entities only |</p>
|
|
<p>Deployment environment: <code>IAM_ISSUER</code> pins the issuer per brand (e.g. <code>https://hanzo.id</code>) so every token and the discovery document advertise one stable issuer regardless of request host, never steerable by <code>X-Forwarded-Host</code>. The three capability allow-lists — <code>IAM_TOKEN_EXCHANGE_APPS</code>, <code>IAM_ADMIN_TOKEN_EXCHANGE_APPS</code> and <code>IAM_KEY_MINT_ALLOWED_APPS</code> — are specified in HIP-0111 §7, which is the one description of them.</p>
|
|
<p>The seed file expands <code>${VAR}</code> from the environment and creates only what is missing. It never deletes or overwrites an existing user, application or org, so a restart cannot reset a password, an MFA enrolment or any other user data.</p>
|
|
<h3>Storage</h3>
|
|
<p>One <code>orm.DB</code> abstraction, backend chosen at boot, per HIP-0144:</p>
|
|
<ul><li><code>sqlite</code> (default) — embedded, pure-Go, WAL. No server, no credential.</li><li><code>sql</code> — the one shared <code>hanzoai/sql</code>, reached over ZAP.</li><li><code>datastore</code> — <code>hanzoai/datastore</code> over ZAP, with snapshots, at no code change.</li></ul>
|
|
<p>There is no <code>hanzo_iam</code> database, no per-app Postgres instance, no Redis, and no MySQL path. Sessions are IAM's own state in that store, not a second engine: an external cache for sessions was a property of the retired fork.</p>
|
|
<p>The entities are <code>organization</code>, <code>user</code>, <code>application</code>, <code>token</code>, <code>session</code>, <code>cert</code>, <code>provider</code>, <code>permission</code> and <code>role</code>. Balance fields on an organization are <strong>read-only mirrors</strong>; the authoritative balance lives in Commerce (HIP-0018, HIP-1220) and the metered record in HIP-1313. IAM is not a billing engine and is not the source of truth for spend.</p>
|
|
<h3>Secrets</h3>
|
|
<p>Client secrets and signing material are KMS references, never values, and never plaintext in Git, a manifest, the seed file or an image. The path is derivable from the app that reads the secret and the variable it becomes — HIP-0136 is the one statement of that convention, and it also records why <code>base</code> keeps its own KMS project rather than being folded into the shared one.</p>
|
|
<p>Passwords are hashed, never stored or transmitted in the clear. Verification is algorithm-resolved from the stored row (argon2id and bcrypt), verify-only and fail-closed: an unrecognised algorithm is a refusal, not a fallback.</p>
|
|
<h2>Standards Compliance</h2>
|
|
<h3>Standards Implemented</h3>
|
|
<p>| Standard | Status | Notes | |----------|--------|-------| | RFC 6749 (OAuth 2.0) | Full | Authorization Code + PKCE; <code>client_secret_basic</code> | | RFC 7636 (PKCE) | Full | <code>S256</code> only | | OIDC Core 1.0 | Full | Discovery, UserInfo, ID Tokens | | OIDC Discovery 1.0 | Full | <code>/.well-known/openid-configuration</code> (host-relative) | | OIDC RP-Initiated Logout | Full | <code>/v1/iam/oauth/logout</code> | | RFC 7517 (JWK) | Full | <code>/v1/iam/.well-known/jwks</code> | | RFC 7519 (JWT) | Full | RS256 today; ML-DSA-65 hybrid JWT and JWKS from the Cert entity is the direction (HIP-0005) | | RFC 7662 / RFC 7009 | Full | Introspection and revocation | | RFC 8414 | Full | Authorization server metadata | | RFC 8693 (Token Exchange) | Full | Delegation, gated per HIP-0111 §7 | | RFC 8707 (Resource Indicators) | Full | <code>resource</code>/<code>audience</code> pins <code>aud</code>; validators fail closed | | RFC 7644 / RFC 7643 (SCIM 2.0) | Full | Identity provisioning |</p>
|
|
<h3>Custom Login UI</h3>
|
|
<p>The <code>hanzo/id</code> repository provides a forkable, white-label Next.js login UI that serves as the frontend for all identity domains. It includes:</p>
|
|
<ul><li><strong>OIDC discovery rewriting</strong>: serves <code>.well-known</code> host-relative to the tenant domain</li><li><strong>Multi-tenant detection</strong>: hostname-based tenant resolution (per-brand origin)</li><li><strong>PKCE support</strong>: built-in <code>S256</code> code challenge generation and verification</li><li><strong>White-label forkable</strong>: fork to <code>luxfi/id</code>, <code>zoofdn/id</code>, etc. for org-specific branding</li></ul>
|
|
<h3>SDK Compliance</h3>
|
|
<p>The client contract is <strong>HIP-0111</strong>. JS/TS uses <code>@hanzo/iam</code>; Go uses <code>iamsdk</code>. All hit the canonical <code>/v1/iam/oauth/*</code> endpoints.</p>
|
|
<p>| SDK | Package | Authorize | Token | |-----|---------|-----------|-------| | JS/TS | <code>@hanzo/iam</code> | <code>/v1/iam/oauth/authorize</code> | <code>/v1/iam/oauth/token</code> | | Go | <code>github.com/hanzoai/iam/iamsdk</code> | <code>/v1/iam/oauth/authorize</code> | <code>/v1/iam/oauth/token</code> |</p>
|
|
<h3>No Backward Compatibility</h3>
|
|
<p>There are no legacy paths. <code>/oauth/<em></code>, <code>/api/login/oauth/</em></code>, and <code>/api/</code>-prefixed auth paths are not served and not supported. The OIDC discovery document returns only the canonical <code>/v1/iam/oauth/*</code> endpoints.</p>
|
|
<h2>Security Considerations</h2>
|
|
<h3>Authentication Security</h3>
|
|
<ul><li><strong>PKCE required</strong>: All public clients (SPAs, mobile apps) MUST use PKCE (RFC 7636) with S256 challenge method. Authorization code interception is the most common OAuth attack vector; PKCE eliminates it.</li><li><strong>Token rotation</strong>: Refresh tokens are rotated on use. The previous refresh token is invalidated when a new one is issued. This limits the window of a leaked refresh token.</li><li><strong>Password hashing</strong>: argon2id with per-org salt configuration. argon2id is the winner of the Password Hashing Competition and is resistant to both GPU and side-channel attacks.</li><li><strong>WebAuthn</strong>: Enabled on all applications for phishing-resistant second-factor authentication.</li></ul>
|
|
<h3>Session Security</h3>
|
|
<ul><li><strong>Session timeout</strong>: <code>inactiveTimeoutMinutes = 30</code> in production. Idle sessions expire after 30 minutes.</li><li><strong>Secure cookies</strong>: Sessions use HttpOnly, Secure, SameSite=Lax cookies. The <code>authState</code> configuration pins sessions to the IAM origin.</li><li><strong>Sessions are IAM's own state</strong>, held in its <code>orm.DB</code> store with a TTL and registered for revocation. There is no external session cache: a second engine for sessions was a property of the retired fork, and it made "log everyone out" an operation on infrastructure rather than on the identity service.</li></ul>
|
|
<h3>Network Security</h3>
|
|
<ul><li><strong>TLS everywhere</strong>: Hanzo Ingress (HIP-0068) terminates TLS. HTTP is redirected to HTTPS. IAM rejects plaintext.</li><li><strong>CORS whitelist</strong>: The <code>origin</code> and <code>originFrontend</code> settings restrict which origins can interact with IAM APIs. Cross-origin requests from unknown origins are rejected.</li><li><strong>Rate limiting</strong>: Per-IP rate limiting on login endpoints prevents brute-force attacks. Failed login attempts increment a counter; after 5 failures, the IP is throttled for 15 minutes.</li><li><strong>Health endpoint isolation</strong>: <code>/healthz</code> is unauthenticated (load-balancer probes require it) and returns only a boolean status, leaking no internal state. It is at the root, not under <code>/api/</code> and not under a version prefix (HIP-0119).</li></ul>
|
|
<h3>Operational Security</h3>
|
|
<ul><li><strong>Error masking</strong>: <code>enableErrorMask = true</code> in production ensures internal errors (database errors, stack traces) are never exposed to clients. Clients receive generic error messages; details are logged server-side.</li><li><strong>Admin password rotation</strong>: The default admin password in init_data.json is <code>admin</code>. Production deployments MUST rotate this immediately. The <code>HANZO_INIT_USER_EMAIL</code> bootstrap flow creates admin users with KMS-managed passwords.</li><li><strong>Audit logging</strong>: All authentication events (login, logout, token refresh, password change) are logged with timestamp, IP, user agent, and result. Logs are shipped to the centralized logging stack.</li></ul>
|
|
<h3>Authentication vs Authorization (AuthN vs AuthZ)</h3>
|
|
<p>IAM handles both authentication (identity verification) and authorization (access control), but they are distinct concerns:</p>
|
|
<p><strong>Authentication (AuthN)</strong> — "Who are you?"</p>
|
|
<ul><li>OAuth 2.0 flows (authorization code + PKCE, client credentials, device code)</li><li>Password login with argon2id hashing</li><li>Social login (GitHub, Google, etc.) via identity providers</li><li>WebAuthn / FIDO2 for phishing-resistant MFA</li><li>SAML 2.0 and CAS for enterprise SSO</li><li>Session management (30-minute idle timeout, in IAM's own store)</li></ul>
|
|
<p><strong>Authorization (AuthZ)</strong> — "What can you do?"</p>
|
|
<ul><li><strong>OAuth scopes</strong>: Applications request scopes (openid, profile, email, custom). IAM validates requested scopes against the application's allowed scope set and returns <code>invalid_scope</code> per RFC 6749 §4.1.2.1 if the client requests scopes not configured for its application.</li><li><strong>RBAC roles and permissions</strong>: IAM supports role-based access control. Roles are collections of permissions; users are assigned roles per-organization. The <code>permission</code> and <code>role</code> tables enforce this.</li><li><strong>Organization isolation</strong>: Users can be members of multiple organizations (hanzo, lux, zoo, pars, adnexus) but each session is scoped to one organization context. Cross-org access requires switching context.</li><li><strong>Application-level isolation</strong>: Each OAuth application has its own client credentials, redirect URIs, grant types, and scopes. A token issued for <code>app-console</code> cannot be used at <code>app-commerce</code> (different <code>aud</code> claim).</li><li><strong>Admin vs normal user</strong>: The <code>isAdmin</code> flag on the user entity grants full API access within the organization. Non-admin users are restricted to self-service operations.</li><li><strong>Balance-gated access</strong>: Services can check <code>balance > 0</code> from the JWT claims or userinfo endpoint to gate access to paid features (AI inference, compute).</li></ul>
|
|
<p>The key design principle: <strong>IAM authenticates users and issues scoped tokens. Services authorize requests by validating token claims.</strong> IAM does not make fine-grained authorization decisions for downstream services — it provides the identity and claims that services use to make their own authorization decisions.</p>
|
|
<h2>References</h2>
|
|
<ol><li><a href="https://github.com/hanzoai/iam">Hanzo IAM</a> - Open-source identity and access management platform</li><li><a href="https://datatracker.ietf.org/doc/html/rfc6749">RFC 6749</a> - The OAuth 2.0 Authorization Framework</li><li><a href="https://datatracker.ietf.org/doc/html/rfc7636">RFC 7636</a> - Proof Key for Code Exchange (PKCE)</li><li><a href="https://datatracker.ietf.org/doc/html/rfc7519">RFC 7519</a> - JSON Web Token (JWT)</li><li><a href="https://openid.net/specs/openid-connect-core-1_0.html">OpenID Connect Core 1.0</a> - OIDC specification</li><li><a href="https://datatracker.ietf.org/doc/html/rfc7662">RFC 7662</a> - OAuth 2.0 Token Introspection</li><li><a href="https://datatracker.ietf.org/doc/html/rfc7009">RFC 7009</a> - OAuth 2.0 Token Revocation</li><li><a href="https://datatracker.ietf.org/doc/html/rfc8414">RFC 8414</a> - OAuth 2.0 Authorization Server Metadata</li><li><a href="https://datatracker.ietf.org/doc/html/rfc8628">RFC 8628</a> - OAuth 2.0 Device Authorization Grant</li><li><a href="https://datatracker.ietf.org/doc/html/rfc7517">RFC 7517</a> - JSON Web Key (JWK)</li><li><a href="https://datatracker.ietf.org/doc/html/rfc7033">RFC 7033</a> - WebFinger</li><li><a href="./hip-0111-iam-authentication-standard.md">HIP-0111: Hanzo IAM Authentication Standard</a> - the wire contract, authoritative where it touches this HIP</li><li><a href="./hip-0118-superadmin-and-tenant-isolation-model.md">HIP-0118: SuperAdmin & Tenant Isolation Model</a> - the reserved <code>admin</code> org and the one SuperAdmin predicate</li><li><a href="./hip-0519-one-identity-boundary.md">HIP-0519: One Identity Boundary</a> - where the token is validated and <code>X-Org-Id</code> is minted</li><li><a href="./hip-0068-ingress-standard.md">HIP-0068: Ingress Standard</a> - the edge that terminates TLS and routes every brand domain</li><li><a href="./hip-0144-where-state-lives.md">HIP-0144: Where State Lives</a> - the store this service is a tenant of</li><li><a href="./hip-0136-one-secret-one-path.md">HIP-0136: One Secret, One Path</a> - where a client secret is addressed</li><li><a href="./hip-0027-secrets-management-standard.md">HIP-0027: Secrets Management Standard</a> - the KMS this reads from</li><li><a href="./hip-0004-llm-gateway-unified-ai-provider-interface.md">HIP-0004: LLM Gateway</a> - consumes IAM tokens</li><li><a href="./hip-0018-payment-processing-standard.md">HIP-0018: Payment Processing Standard</a> - Commerce, which owns the authoritative balance</li><li><a href="./hip-0025-bot-agent-wallet-rpc-billing-protocol.md">HIP-0025: Bot Agent Wallet & RPC Billing Protocol</a> - agent identity, built on IAM</li></ol>
|
|
<h2>Copyright</h2>
|
|
<p>Copyright and related rights waived via <a href="https://creativecommons.org/publicdomain/zero/1.0/">CC0</a>.</p>
|
|
<footer>
|
|
<div class="fmap">
|
|
<div><b>Build</b>
|
|
<a href="https://hanzo.app">hanzo.app</a> app builder
|
|
<a href="https://hanzo.codes">hanzo.codes</a> code with an agent
|
|
<a href="https://hanzoskills.com">hanzoskills.com</a> what an agent reads</div>
|
|
<div><b>Run</b>
|
|
<a href="https://console.hanzo.ai">console.hanzo.ai</a> cloud console
|
|
<a href="https://api.hanzo.ai">api.hanzo.ai</a> the API</div>
|
|
<div><b>Account</b>
|
|
<a href="https://hanzo.id">hanzo.id</a> sign in
|
|
<a href="https://pay.hanzo.ai">pay.hanzo.ai</a> top up
|
|
<a href="https://billing.hanzo.ai">billing.hanzo.ai</a> invoices and usage</div>
|
|
<div><b>Company</b>
|
|
<a href="https://hanzo.ai">hanzo.ai</a> canonical
|
|
<a href="https://hanzo.ventures">hanzo.ventures</a> ventures</div>
|
|
</div>
|
|
<div class="fend"><a href="/hip-0026.md">This page as plain text</a> · <a href="/llms.txt">Index for agents</a></div>
|
|
</footer>
|
|
</div></body></html> |