new proxy-auth-lib/ workspace for applications that sit behind an identity-aware proxy with JWKS-backed JWT verification#381
Conversation
…tname-derived config defaults - Add Express/Fastify/Hono Node adapters and shared core module - Add Flask/Django Python middleware - Add mieweb:accounts-proxy-auth Meteor package (accounts-base login) - Derive auth domain from host FQDN instead of hardcoding; all settings optional - Update tests and docs
- Accept TRUSTED_PROXY_PUBLIC_KEY (inline PEM) or _FILE (path) across Node, Python, Go, and Rust; when set, verification skips JWKS and runs offline - JWKS remains the preferred default for key rotation and OIDC providers - Pin verification algorithm to RS256 in all implementations - Require either a JWKS URL or a public key in config validation - Add shared testdata/public-key.pem fixture and static-key tests - Enable jsonwebtoken use_pem feature for PEM keys (Rust) - Document the JWKS vs static-key choice
Addresses code-quality review: drop 'from unittest import mock' and qualify usage as unittest.mock (with explicit submodule import).
Publish on a proxy-auth-lib-v<semver> tag to npm, JSR, PyPI (Trusted Publishing), crates.io, Atmosphere (Meteor), and the Go module proxy as independent jobs, plus a Bun/Deno install smoke test. Each job derives the version from the tag and runs a matching script in proxy-auth-lib/scripts/ that is reproducible locally. - Add scripts/ (stamp-version + per-registry publish + runtime smoke) and README - Add nodejs/jsr.json for JSR publishing - Fix Go module path to the monorepo subpath so it actually resolves; release tags proxy-auth-lib/go/v<version> and warms the Go proxy - Add required crates.io metadata (license, description, repository) - Ignore Python build artifacts
|
This is a large addition that is only orthogonally related to the work done in this repo. Due to that fact, I would like this moved to its own repo where the library lifecycle can be managed independently of the infrastructure. |
|
I don't necessarily disagree but I want to test alongside the server config for now. I'd like to merge it and then I'll use subtree to fork it out. We need a test environment to prove it out. |
|
Also. I want every container to default to proxy auth and have these libraries installed in the templates and be prompted to use them. |
Defaulting to proxy auth is very doable. There's no clean way to preinstall this (these?) libraries though. You'd want to handle that at a project template layer which we don't currently provide. |
|
Per our discussion, moving this to draft until the header contract is stabilized. See #355 for progress. |
|
@horner I think I've stablized the header contract we'll be supporting. It's described https://github.com/mieweb/opensource-server/blob/348-oauth2-proxy-forward-auth/mie-opensource-landing/docs/users/consuming-auth.md which will be going out with the next update. That document is suggesting the environment variables |
This introduces a new
proxy-auth-lib/workspace for applications that sit behind an identity-aware proxy and need to trust signed identity assertions instead of raw forwarded headers. It provides a consistent MVP across Node.js, Python, Rust, and Go for header extraction, JWKS-backed JWT verification, issuer/audience/expiration checks, and verified identity propagation.Multi-language middleware scaffold
proxy-auth-lib/with language-specific implementations for:net/httpmiddlewareTRUSTED_PROXY_ASSERTION_HEADERTRUSTED_PROXY_JWKS_URLTRUSTED_PROXY_ISSUERTRUSTED_PROXY_AUDIENCEVerification model
subject,email,name, raw claims)Shared fixtures and coverage
proxy-auth-lib/testdata/Docs and repository structure
Example
Updates since initial draft
Hostname-derived config defaults
auth.<parent-domain>of the host FQDN (e.g.web1.os.example.org→auth.os.example.org), with issuer/JWKS/audience derived from it. All vars remain optional overrides.Static public-key verification (JWKS still preferred)
TRUSTED_PROXY_PUBLIC_KEY(inline PEM) andTRUSTED_PROXY_PUBLIC_KEY_FILE(path) across all four languages.Algorithm pinning
Fixtures & tests
proxy-auth-lib/testdata/public-key.pem(matches existing token fixtures) plus offline static-key tests in each language.