Skip to content

docs: add three-party flow examples with mermaid diagrams#25

Merged
dasiths merged 5 commits into
mainfrom
docs/three-party-flow-examples
May 28, 2026
Merged

docs: add three-party flow examples with mermaid diagrams#25
dasiths merged 5 commits into
mainfrom
docs/three-party-flow-examples

Conversation

@dasiths
Copy link
Copy Markdown
Collaborator

@dasiths dasiths commented May 28, 2026

Summary

Adds end-to-end three-party (PS-Asserted) flow examples to the README and Getting Started guide, including mermaid diagrams, code examples for all three parties, and a detailed protocol walk-through.

Changes

README.md

  • Mermaid sequence diagram showing the PS-Asserted flow with user consent (Agent → Resource → PS → User)
  • Self-hosted agent example — key generation, metadata publishing, self-issued tokens
  • Resource-side example — verification middleware, metadata, TrustedAuthTokenIssuers
  • Agent-calls-resource example — showing automatic challenge handling
  • Step-by-step walk-through — numbered explanation of each protocol message

docs/getting-started.md

  • Understanding the Protocol Participants — AP role explained, self-hosted vs enrolled comparison
  • Key Types & Cryptography — Ed25519, JWK Thumbprint, JWT signing
  • Supported Flows — table covering all 4 access modes with signing mode requirements
  • Three-Party Flow Deep Dive — detailed mermaid diagram, HTTP headers at each step, consent model (immediate vs deferred), auth token claims
  • Resource-Side Example — full verification + token issuance with TrustedAuthTokenIssuers
  • Enrollment: Hosted vs CLI/Desktop — comparison table
  • Expanded Next Steps links

Terminology

All terminology verified against draft-hardt-oauth-aauth-protocol (draft-01):

  • Person Server (not "auth server")
  • resource_token / auth_token (not "access token")
  • No bearer tokens — every credential bound to a signing key

- README: Add mermaid sequence diagram showing PS-Asserted flow with
  user consent, self-hosted agent setup, resource-side verification
  example, agent-calls-resource example, and step-by-step walk-through
- Getting Started: Add protocol participants section (AP role explained),
  key types & cryptography, supported flows table, three-party deep dive
  with detailed HTTP headers and consent model, resource-side example
  with TrustedAuthTokenIssuers, and enrollment comparison table
- Both files: Show PS trust relationship explicitly via
  TrustedAuthTokenIssuers in resource verification options
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-to-end documentation for the three-party (PS-Asserted) flow, including mermaid sequence diagrams and server/client examples, and introduces a lightweight plan folder documenting the research and execution plan for these doc updates.

Changes:

  • Expanded README three-party flow section with a mermaid diagram plus agent/resource/client examples and a step-by-step walkthrough.
  • Extended docs/getting-started.md with protocol participant explanations (AP/PS/AS), cryptography/key concepts, supported flows, and a detailed three-party deep dive.
  • Added .agent/plans/... research + phased implementation plan files for the documentation initiative.
Show a summary per file
File Description
README.md Adds PS-Asserted flow overview, diagram, and illustrative code snippets for agent/resource/client.
docs/getting-started.md Adds deep-dive protocol documentation, diagrams, examples, and updated “Next Steps” links.
.agent/plans/2026-05-28-readme-getting-started-update/research.md Captures spec terminology and supporting research for the doc changes.
.agent/plans/2026-05-28-readme-getting-started-update/implementation-plan.md Phased plan with DoD checkboxes for the doc updates and cross-references.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 9

Comment thread README.md
Comment on lines 73 to +88
```csharp
using AAuth.Crypto;
using AAuth.HttpSig;
using AAuth.Server;
using AAuth.Tokens;

// Hosted service: generate key at startup, self-issue tokens
var key = AAuthKey.Generate();
const string Kid = "svc-key-1";
var issuer = "https://my-service.example";

// Publish agent metadata so resources can discover the JWKS
app.MapAAuthAgentWellKnown(new AAuthAgentMetadataOptions
{
Issuer = issuer,
SigningKeys = new Dictionary<string, AAuthKey> { [Kid] = key },
});
Comment thread README.md
// Trust specific PSes — the resource verifies auth tokens against their JWKS.
// Omit to accept any PS (claims are namespaced by issuer per spec).
TrustedAuthTokenIssuers = new HashSet<string> { "https://ps.example" },
});
Comment thread docs/getting-started.md
Comment on lines +173 to +176
```
HTTP/1.1 401 Unauthorized
AAuth-Requirement: requirement=auth-token;resource_token="<resource-token>"
```
Comment thread docs/getting-started.md Outdated
AAuth-Requirement: requirement=auth-token;resource_token="<resource-token>"
```

The resource token contains: issuer (resource URL), audience (PS URL), agent identifier, agent key thumbprint (`jkt`), and requested scope.
Comment thread docs/getting-started.md Outdated
**5. Consent: immediate vs deferred**

- **Immediate**: User is online and grants consent in real time. PS returns the auth token directly.
- **Deferred**: User is not available. PS returns `202 Accepted` with `requirement=interaction` and a `pending` URL. The agent polls until the user consents (SDK handles this via `InteractionWaitMode`).
Comment thread docs/getting-started.md Outdated
- `iss`: PS URL
- `aud`: Resource URL
- `sub`: User identifier (stable, PS-scoped)
- `cnf.jkt`: Agent's key thumbprint (proof-of-possession binding)
Comment thread docs/getting-started.md Outdated
The resource verifies the auth token:
- Fetches the PS's JWKS (from `{iss}/.well-known/aauth-person.json`) and verifies the JWT signature
- Checks `aud` matches its own identifier
- Confirms `cnf.jkt` matches the signing key on the HTTP request (proof-of-possession)
Comment thread docs/getting-started.md Outdated
TrustedAuthTokenIssuers = new HashSet<string> { "https://ps.example" },
});

// Protected endpoint — if agent lacks auth, middleware issues 401 + resource_token
Comment thread docs/getting-started.md Outdated
| Key lifecycle | Generated at startup, published via JWKS | Generated in keystore at enrollment, loaded by handle |
| Token acquisition | Self-signed at startup | AP refresh endpoint (automatic via SDK) |
| Metadata | Publishes `/.well-known/aauth-agent.json` | AP publishes it |
| Code entry point | `MapAAuthAgentWellKnown()` + `AgentTokenBuilder` | `AAuthClientBuilder.Bootstrap().EnrolAsync()` |
dasiths added 4 commits May 28, 2026 09:06
- Add WebApplication setup to README agent example (missing app context)
- Add UseAAuthChallenge middleware to resource examples (issues 401 +
  resource_token when agent lacks auth token)
- Fix AAuth-Requirement header format: resource-token (hyphen) per spec
- Fix resource token claim name: agent_jkt (not jkt)
- Fix auth token PoP claim: cnf.jwk (not cnf.jkt) per spec
- Fix SDK type reference: InteractionHandlingOptions (not InteractionWaitMode)
- Fix Bootstrap call shape: Bootstrap(url, agentId) takes arguments
- Add AAuth.Crypto using to README resource example
Add Resource-Managed and Federated access modes to the table. Clarify
the distinction between signing modes (how the agent proves identity)
and access modes (how authorization is decided). Add note explaining
why Identity-Based access supports hwk despite hwk being pseudonymous.
@dasiths dasiths merged commit f75777e into main May 28, 2026
1 check passed
@dasiths dasiths deleted the docs/three-party-flow-examples branch May 28, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants