Repository navigation
Add trusted-assertion authentication provider (signed JWT from an authenticating reverse proxy) - #2595
Open
robireton wants to merge 2 commits into
Open
Add trusted-assertion authentication provider (signed JWT from an authenticating reverse proxy)#2595robireton wants to merge 2 commits into
robireton wants to merge 2 commits into
Conversation
Authenticates users from a short-lived signed JWT that an authenticating reverse proxy adds to each request (e.g. nginx auth_request in front of an SSO service), configured under security.auth.assertion.*. - GET /user/login/assertion verifies the header against a JWKS (ES256 by default; HS* and none refused), pins iss and aud, requires exp, and logs in through LoginService like every other provider. Listed in /auth/providers as an ajax provider, so Atlas needs no changes. - With enforce-on-every-request (default), a filter after Spring Security requires a valid assertion for the same user on every request made with a WebAPI session token. A leaked WebAPI token is useless without a live proxy session, and proxy sign-out takes effect within the assertion's lifetime. API-key requests are not affected. - An unreachable JWKS answers 503, not 401, so an outage doesn't read as everyone being signed out. JWKS fetches have a timeout. - auto-provision (default true) creates the user on first login; otherwise unknown users get 403. New UserOrigin.ASSERTION; origin is stored as a string, so no migration. Tests use a real local JWKS server so the production decoder, including its key fetch, is exercised: valid, expired, no exp, wrong/missing aud, wrong iss, no sub, foreign key, unknown kid, HS256, alg none, garbage, JWKS down, user binding, API-key and anonymous pass-through. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New articles/TrustedAssertion_HOWTO.md: when to use it, the login and per-request binding flow, property reference (including the optional claim and timeout settings), required claims, roles, proxy setup with an nginx auth_request example, endpoint responses and security notes. README lists security.auth.assertion.enabled with the other providers; LoginPipeline.md gains the flow entry and UserOrigin.ASSERTION. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Many sites already put WebAPI and Atlas behind an authenticating reverse proxy (nginx
auth_request, oauth2-proxy, Apachemod_auth_openidc, or an institutional SSO gateway). Today WebAPI can't use that sign-in directly. The options are a second login (DB/LDAP/OIDC) or trusting a plainREMOTE_USER-style header, which anyone who reaches WebAPI directly can forge.This provider accepts a signed, short-lived JWT that the proxy adds to each request. WebAPI verifies it against the proxy's JWKS. Nothing is trusted just because of the network path.
What it does
GET /user/login/assertionverifies the assertion header and logs in throughLoginServicelike every other provider. The user getsUserOrigin.ASSERTION; origin is stored as a string, so no migration is needed. It is listed in/auth/providersas an ajax provider, so Atlas needs no changes.Per-request binding (
enforce-on-every-request, default on). A filter that runs after Spring Security requires a valid assertion for the same user on every request made with a WebAPI session token. Two effects:API-key and anonymous requests are not affected.
Auto-provisioning (default on) creates the user on first login. When it is off, unknown users get 403. Assertions carry no roles; roles stay managed in WebAPI.
Security properties
HS*andnoneare rejected at config time and at verification.issmust match exactly andaudmust contain the configured value.expis required: Spring'sJwtTimestampValidatoralone would accept a token with noexp.SECURITY_AUDIT.jwk-set-uri,issuerandaudiencefails at startup.Configuration and docs
Disabled by default. Enable with
security.auth.assertion.enabled: trueplusjwk-set-uri,issuerandaudience. The full property reference, the claims the assertion must contain, an nginxauth_requestexample, the endpoint's error responses and the security considerations are in the newarticles/TrustedAssertion_HOWTO.md.Changes
org.ohdsi.webapi.security.authc.assertion:AssertionAuthConfig,AssertionAuthProperties,AssertionVerifier,AssertionLoginController,AssertionBindingFilter.AuthProviderService: lists the provider when it is enabled.UserOrigin: addsASSERTION.application.yaml: a documentedsecurity.auth.assertionblock, disabled by default.articles/TrustedAssertion_HOWTO.md; the provider is added to the README's auth-provider list and toarticles/LoginPipeline.md(flow andUserOrigin).spring-boot-starter-oauth2-resource-server.Tests
AssertionVerifierTest,AssertionLoginControllerTestandAssertionBindingFilterTestrun against a real local JWKS server, so the production decoder, including its key fetch, is exercised. They cover:exptokens;aud, wrongiss, nosub;kid, HS256,alg: none, garbage input;This is running in production at the University of Cincinnati Center for Health Informatics, in front of WebAPI 3 / Atlas3, behind nginx
auth_requestand our SSO service. It is early days: only a handful of users have signed in through it so far.🤖 Generated with Claude Code