Skip to content

Document adopting authn in the package doc - #517

Merged
jhrozek merged 2 commits into
mainfrom
tsm-05-doc
Nov 21, 2026
Merged

jhrozek merged 2 commits into
mainfrom
tsm-05-doc

Conversation

@jhrozek

@jhrozek jhrozek commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • A service that verifies tokens with its own code needs to know where this package decides differently, and what it leaves to the caller. The authn package doc now lists:
    • the defaults that differ from a hand-written verifier;
    • the checks the caller must still make: scopes, its own identity claim, qualifying claims by Principal.Trust, the JSON types in Claims, and mapping errors to responses;
    • how a TrustSet routes tokens, changes and goes stale.
  • It shows the intended pattern for two sources of issuers:
    • a set of human identity providers built once at startup;
    • a set fed from a directory service, rebuilt on a timer with WithProviderOnly and WithReservedIssuers, with a fallback from one set to the other on ReasonUnknownIssuer.
  • For Microsoft Entra and Okta it says what this API can express:
    • one trust per tenant (Entra common/organizations/consumers issuers are not refused, but no token carries them);
    • the Entra JWKS URLs and audience forms;
    • scp versus roles, and typ;
    • the guard against ID tokens: an API audience that is no client's ID, plus a required scope;
    • identifying users by tid and oid;
    • using an Okta custom authorization server.
  • Documentation only.

Stack: #506 → #507 → #508 → #509 → #510 → #511 → #514 → #515 → #516 (template issuers) → this PR

Test plan

  • go vet ./authn/ (doc comment only, no code change)

🤖 Generated with Claude Code

@rdimitrov rdimitrov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Useful doc, and the two-set example matches how #514/#515 are meant to be used. One correction needed:

Comment thread authn/doc.go Resolved
Base automatically changed from tsm-04-issuer-form to tsm-03-trustset-guards November 20, 2026 09:20
Base automatically changed from tsm-03-trustset-guards to tsm-02-trustset November 20, 2026 09:21
Base automatically changed from tsm-02-trustset to tsm-01-provider-only-config November 20, 2026 09:22
Base automatically changed from tsm-01-provider-only-config to tsm-00-jwks-close-race November 20, 2026 09:22
Base automatically changed from tsm-00-jwks-close-race to ts-04-wp3-scopes-algs November 20, 2026 09:22
Base automatically changed from ts-04-wp3-scopes-algs to ts-03-wp2-checks November 20, 2026 09:23
rdimitrov
rdimitrov previously approved these changes Nov 21, 2026

@rdimitrov rdimitrov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, the doc now points at (*Error).HTTPStatus and spells out the bare WWW-Authenticate: Bearer challenge for MissingCredentials(). LGTM.

Base automatically changed from ts-03-wp2-checks to main November 21, 2026 17:05
@jhrozek
jhrozek dismissed rdimitrov’s stale review November 21, 2026 17:05

The base branch was changed.

jhrozek and others added 2 commits November 21, 2026 19:41
A service that verifies tokens with its own code needs to know where
this package decides differently, and what it leaves to the caller. The
package doc now lists the defaults that differ from a hand-written
verifier, the checks the caller must still make (scopes, its own
identity claim, qualifying claims by Principal.Trust, the JSON types in
Claims, mapping errors to responses), and how a TrustSet routes,
changes and goes stale.

It shows the intended pattern for two sources of issuers: a set of
human identity providers built once at startup, and a set fed from a
directory service that is rebuilt on a timer with WithProviderOnly and
WithReservedIssuers, with a fallback from one to the other on
ReasonUnknownIssuer.

For Microsoft Entra and Okta it says what this API can express: one
trust per tenant, the Entra JWKS URLs, audience forms, scp versus
roles, typ, the guard against ID tokens (an API audience that is no
client's ID, plus a required scope), identifying users by tid and oid,
and using an Okta custom authorization server.

Documentation only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The package doc told callers to map errors with Code.HTTPStatus, which
answers missing credentials and unsupported schemes with 400, the case
its own doc warns about. Point at (*Error).HTTPStatus and say to answer
MissingCredentials with a bare "WWW-Authenticate: Bearer" challenge
(RFC 6750 §3.1). Callers copy what the package doc says.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jhrozek

jhrozek commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

@rdimitrov Merging #508 changed this PR's base, and the ruleset dismissed your approval. I rebased onto main (07c8b39). The PR now shows only authn/doc.go, byte-identical to the b78314e you approved. Could you re-approve when CI is green? Thanks!

@rdimitrov rdimitrov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-approving: after the rebase onto main, authn/doc.go is byte-identical to b78314e, which I approved. LGTM.

@jhrozek
jhrozek merged commit 3b2652a into main Nov 21, 2026
6 checks passed
@jhrozek
jhrozek deleted the tsm-05-doc branch November 21, 2026 18:59
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