feat(oidc): add login templates for interactive and headless login - #25
Merged
Merged
Conversation
…anch Named config-declared principals resolve headlessly via login_hint: a matching template wins over interactiveLogin/prompt=login; an unknown name is a hard invalid_request while templates are configured.
login_hint rides both authorize operations into the domain decode; the login page offers configured templates as an editable pre-fill dropdown (attribute-escaped claims JSON, no template.JS), gated off when empty.
…tion root loginTemplates entries map through the domain constructors (index-tagged fail-fast errors); buildWiring hands the collection to the AuthorizeService and the login page. OpenAPI regenerated for login_hint.
… suites Container e2e: dropdown rendered, headless login_hint flow with template identity verified against the served JWKS, unknown hint errors loudly. Webtest: two automated checks + dropdown pre-fill in the manual login check.
…parity New how-to (config + Docker mount + dropdown + headless login_hint), loginTemplates in the configuration reference, a Beyond parity note, nav entry, README feature bullet and doc link.
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.
Summary
First beyond-parity feature: login templates — named principals
{name, subject, claims}declared in the JSON config (loginTemplates, global scope, config-only):login_hint=<template-name>onGET /{issuer}/authorizeresolves the template and issues the code immediately — bypassing the login page even underinteractiveLogin: trueorprompt=login. Built for automated suites running the container with a mountedconfig.json;login_hintis a standard OIDC param, so off-the-shelf client libraries need no custom code.invalid_request(redirected into a usableredirect_uri, else the direct error page). With no templates,login_hintstays ignored (current behavior).Template claims resolve to an ordinary
LoginSubmission, so they inherit the existing login-claims merge semantics (putIfAbsent at mint; callbacks/registered claims win).Design/decision record: session 004 journal (
journal/jmgilman).Implementation
internal/oidc/logintemplate.go—LoginTemplate+ ordered unique-nameLoginTemplatescollection;AuthorizeServicegains aWithLoginTemplatesoption and the hint branch (after theresponse_typecheck, before interactive/prompt).internal/oidc/httpapi—login_hinton both authorize ops;Deps.LoginTemplates; dropdown + 10-line inline pre-fill script inlogin.html(attribute-escaped claims JSON, notemplate.JS).internal/config—loginTemplatesparsing with index-tagged fail-fast validation (blank name/subject, duplicate names abort startup).Testing
mise x -- moon run checkgreen (incl. openapi drift-guard).TestContainerLoginTemplatese2e (dropdown, headless flow verified against served JWKS, loud unknown-hint error); full integration suite green againstmock-oidc:dev.sub=alice+ template claims in the id_token; unknown hint errored; browser check (chrome-devtools) confirmed dropdown pre-fill, editability, and "— none —" leaving fields untouched.🤖 Generated with Claude Code