golem15.oauthserver
The compiled OpenID Connect provider for SummerCMS applications: wristband's OIDC flavour at the PHP provider's paths, with its tables, a database signing-key ring encrypted with the application key, server-rendered consent and error pages, and the user data of golem15.user.
import _ "git.golem15.com/golem15/sm-oauthserver-plugin"
Module git.golem15.com/golem15/sm-oauthserver-plugin, package oauthserver, plugin ID golem15.oauthserver, requires golem15.user.
Overview
The plugin ports the WinterCMS Golem15.OAuthServer plugin. It builds two wristband servers on one issuer and publishes them as one *oauthserver.Servers value (Servers.OIDC, Servers.MCP, Servers.KeyRing), so an application that looks up its own *wristband.Server is not affected:
- the OIDC server (
wristband.NewOIDCServer) serves discovery, JWKS, authorize with the login handoff, resume, consent and account switching, token and userinfo, and is wired to the plugin's stores throughSetOIDCBackend(classes.LazyStore, classes.KeyRing, classes.Host); - the MCP server (
wristband.NewServer) shares the issuer and is wired toclasses.LazyMCPStore; its routes are mounted only withmcp.enabled: true.
The tables keep the PHP names (golem15_oauthserver_clients, _auth_requests, _auth_codes, _access_tokens, _consents, _subjects) and columns, so an import copies rows as they are; _refresh_tokens, _keys, _settings and _mcp_codes are new.
Features
- PHP paths and bytes. The routes below answer like the PHP provider: the engine writes the redirects, JSON and headers; the plugin adds storage, keys, users and pages.
- Stores.
classes.Storeimplementswristband.OIDCBackendover GORM, one transaction per call. Clients are read withkind = 'oidc'in SQL. Codes and parked requests are consumed by single guardedUPDATEstatements, consents are one row per user and client (scopes merged), subjects are random UUIDs allocated once per user and sector (''is public), and refresh tokens keep their rotation lineage.classes.LazyStoreresolves*gorm.DBat request time, because the generated main publishes it after boot. Every OIDC transaction that touches a user's grant rows first takes that user's grants lock (shared):SubjectFor,ConsentForandSaveConsenttake it on entry,ConsumeCodeandRefreshTokenByHashForUpdateafter reading the row's user. A revoke or the grant cascade therefore either waits for a resume, consent decision, code exchange, refresh rotation or userinfo call in flight and then deletes what it issued, or runs first. - Key ring. The plugin publishes its
*classes.KeyRingon the application for the rotate and prune commands.classes.KeyRingimplementswristband.KeyStoreovergolem15_oauthserver_keys. The first key is generated on first use (RS256, orES256withkey_algorithm: ES256); the partial unique indexoas_keys_one_activelets exactly one of several racing instances win. The active kid is read from the database on every signing, so a rotation on one instance reaches all of them; parsed keys are cached per kid. The JWKS holds the active key and the keys retired withinrotation_grace_hours.RotateandPruneserve the rotation and prune commands. The private key is stored aslagoon.Encryptedciphertext, never serialised, never logged and never shown in the admin. - Signed-in user. The authorize routes read the session JWT through golem15.user's
classes.RequestUser(bearer header,tokenandauth_tokencookies). Switching account blacklists that JWT and forgets the cookie throughclasses.EndRequestSession. - Pages.
classes.Hostrendersviews/consent.html.tmplandviews/error.html.tmpl(ports of the PHP views, same layout, class names and copy) withhtml/templateand the plugin's translations (golem15.oauthserver::lang.*, en and pl). The consent page shows the client's logo (or its initial), the signed-in user with their avatar, the scopes still to consent to, the switch-account form and the decision form; every value is escaped. - Branding. The settings row
golem15_oauthserver_settings(id 1,models.Settings, logo as the attachOnelogo) holds the site name and the page colours, font stylesheet URL, font family and custom CSS.classes.LoadBrandingsanitises every value as the PHP plugin did (SanitizeColor: hex of 3 to 8 digits or a 3 to 24 letter name;SanitizeFontFamily;SanitizeCSSURL: https only;SanitizeCustomCSS: tag openers removed, capped atMaxCustomCSS), andBrandingCSSbuilds the:rootoverride from sanitised values only. The error heading always usesDangerColor. An empty site name falls back toapp.name. - Consent modes. With
consent_mode: pagethe plugin renders consent. Withconsent_mode: redirectthe browser goes toconsent_url?request={id}(or&request=), and the application's page reads and decides the request throughGETandPOST /oauth/authorize/requests/{request}(controllers.ConsentShow,controllers.ConsentDecide, behindjwt.auth). - Claims.
classes.Claimsreleases, forprofile,name(the trimmed name, else the email),picture(golem15.user'sAvatarURLatpicture_size, made absolute://hostbecomeshttps://host, a relative path is joined toapp.url),groups(sorted unique group codes, always present) andcommunities(the user's golem15.userfriends memberships in groups that are not deleted,{id, name, role}sorted by name then id, read only when those tables exist, else[]); foremail,emailwithemail_verified(whether the account is activated). A deleted or soft-deleted user gets no claims. - Authorized apps.
GET /oauth/authorizationslists the signed-in user's consents newest first in the PHP shape. Each object ends withkind, alwaysoidcormcp, taken from the client.DELETE /oauth/authorizations/{client_id}revokes one: inside the transactionclasses.LockUserGrantstakes the caller's grants lock, then the consent and the pair's authorization codes, MCP codes, access tokens and refresh tokens are deleted. An MCP allow takes the same lock, so a revoke and an allow of the same user never interleave. The OIDC store takes it too (shared), so a revoke never leaves behind a code or a successor token that a silent resume, a code exchange or a refresh rotation in flight issued. Another user's client, an unknown id, or a live MCP grant that has no consent row answers 404{"error":"not_found"}. The event after commit is unchanged:ClientIDis set andTokenIDstays zero. - User cascade.
classes.Cascadelistens to golem15.user'suser.Deleting(hard delete: access tokens, refresh tokens, OIDC codes, MCP codes, consents and subjects) anduser.Deactivating(the same without the subjects, so a restored user keeps the samesub), inside the user change's transaction. After the commit the cascade fires adeleted*pact.MCPSubjectChanged(guarduser), and the authorized-apps revocation (DELETE /oauth/authorizations/{client_id}) arevokedone carrying the client's id (ClientID), so the MCP endpoint ends the user's sessions on every instance, or after a revocation only the sessions of that client. - Grant revocation on ban, password reset and link changes.
Cascade.OnAccessRevokedlistens to golem15.user'suser.AccessRevoked(AccessRevokedEvent: a ban, a password reset, a password an administrator set, the user's own password change) and, in the event's transaction, ends every OAuth grant of the users created before the event'sBefore, MCP agents and OIDC sign-ins alike: their access and refresh tokens atmcpandoidcclients getrevoked_at, their consents at those clients are deleted (an OIDC client asks for consent again) and their unused OIDC and MCP authorization codes are deleted; subjects stay. golem15.user ends the users' MCP sessions after the commit.Cascade.OnBackendLinkedandCascade.OnBackendUnlinked(OnBackendLinkChanged) listen touser.BackendLinkedanduser.BackendUnlinked: in the link change's transaction they revoke the frontend user's unrevoked MCP access and refresh tokens whose scopes containbackend, delete the user's unexchanged MCP codes carryingbackendand, after the commit, fire arevokedevent with each such client'sClientID. Abackendgrant acts as the linked administrator, so any link change needs a new consent; grants withoutbackendare kept. Every revocation first takes the users' grants advisory locks, which the MCP and OIDC code exchanges and refresh rotations take too (shared, before they lock their row), so a rotation in flight finishes first and its successor is revoked as well. What guarantees that a grant never acts as an administrator the user did not consent to is the consented account it records: the consent decision stores the administrator the page showed on the code (backend_user_id,classes.WithConsentedBackend), the code exchange and every rotation copy it onto the access and refresh tokens (code that mints a grant directly throughclasses.MCPStorepasses the administrator in the context withclasses.WithConsentedBackend), the verifier reports it aspact.MCPGrant.BackendUserID, and the framework's MCP endpoint gives the grant a backend subject only while the user's link names that administrator. Upgrade note:backendgrants issued before the202610230001migration record no administrator and stop acting as one; the user connects the agent again. - MCP on the same stores.
classes.MCPStoreimplementswristband.Backend: clients withkind = 'mcp'(dynamic registration with the client cap under an advisory lock, the unconsented sweep), pending requests and codes ingolem15_oauthserver_mcp_codes, refresh lineage in_refresh_tokens, and access tokens (oas_at_+ 32 random bytes, stored hashed with the client id) in_access_tokens. An MCP client never passes the OIDC flow and an OIDC client never passes the MCP flow. The MCP consent page is the application's (/connect?request=, where the MCP authorize endpoint sends the browser); it reads and decides the request through the consent JSONGETandPOST /oauth/mcp/requests/{request}(controllers.MCPConsentShow,controllers.MCPConsentDecide) as the signed-in frontend user. The body names the client (its name, redirect host andlogo_url, an empty string when the client has no logo), the requested scopes as a string array,scope_details(name,label,description,locked— locked only forread),consent_requiredand the expiry, and, whenbackendis requested and golem15.user's publishedpact.MCPLinkedBackendResolverreports a link, the linked admin (backend_admin, shown as "also act as admin ").consent_requiredis false only when a consent row already holds every requested name. Labels whose catalog text contains::are resolved withphrasebook.Translator.Get; other catalog text is used as written.backendandoffline_accessare not catalog names: their labels and descriptions aregolem15.oauthserver::lang.consent.mcp.*.allowgrants the submitted scopes the client requested (all of them whenscopesis absent) and dropsbackendwhen the user has no link. When the pending request's offline-access flag is set, the show list includes the wordoffline_access. That word is the code'soffline_accesscolumn, not a scope passed toIssueCode.classes.WithGrantedOfflineAccesssets the column only when the decision body includedscopes; an omittedscopesfield leaves the pending flag. The allow runs in one transaction that first takes the user's grants lock (classes.WithinUserGrantsLock, the exclusive lock revoke and the grant cascade take). In it the code is issued (IssueCode, whose MCP store joins that transaction) and a consent row that already covers the request is only touched (TouchConsent); otherwise the stored scopes become the granted set, including the wordoffline_accesswhen that flag was granted. That write replaces the array. It does not callSaveConsent, which unions OIDC scopes. A revoke therefore lands before or after both writes, so it is never undone by an allow in flight, and a failed consent write leaves the request pending with no code. A deny leaves the row unchanged. The decision body carries the shown administrator's login asbackend_admin: when the grant includesbackend, it must name the administrator linked now, and with no link it must be absent, otherwise the answer is 409{"error":"backend_link_changed"}and the page shows the request again (the request stays pending). The link is read at consent, so a link made later needs a new consent. The MCP server advertises one scope list, and the OIDC server's scopes stayopenid,profileandemail. The MCP list is alwaysread,write,ai,offline_accessandbackend, then the declared member scopes (pact.MemberTokenScopeCatalog) in catalog order, except catalog entries namedread,writeorai.golem15.oauthserver.mcp_scopesfilters that declared tail: unset means every declared name, a YAML list (or the comma-separated env value) means only those names, and an empty list means the five fixed names only. A name in the list that no plugin declares fails boot.classes.AdvertisedMCPScopesbuilds the slice;NewServersassigns it to the MCP server and stores the same slice onclasses.MCPTokenVerifier, whoseMCPScopesSupportedreturns a clone. A client whose dynamic registration stored a non-nil scope ceiling still drops requested names outside that ceiling. This phase does not rewrite ceilings already stored on clients. A grant withbackendlets the application's MCP endpoint act as the backend account the user has linked (golem15.user's verified link). - MCP access-token verifier. With
mcp.enabled, Boot publishesclasses.MCPTokenVerifieraspact.MCPTokenVerifier. The same value implementspact.MCPAdvertisedScopes:MCPScopesSupportedis the slice the MCP server advertises, and pier copies it into protected-resource metadata when it is non-empty. The endpoint verifies theoas_at_tokens at the resource: the token must carry the prefix, its hash must name an access token that is neither revoked nor expired, its client must exist withkind = 'mcp', be active and not revoked, its user must still load (a deleted or deactivated user does not) and must not be banned, and the token must not predate the user'stokens_valid_after. The cutoff is stored in whole seconds whilecreated_atis not, so a token created earlier in the cutoff's own second is refused too (created_atbefore cutoff + 1s). The MCP refresh grant applies the same three refusals (user gone, banned, token before the cutoff) and answersinvalid_grant. An OIDC access token, or a token of any other client kind, is refused withpact.ErrMCPTokenInvalid.MCPResourceanswersmcp.resource;last_used_atis stamped at most once a minute per token. - Throttles. The plugin declares the PHP buckets (
surf.BucketProvider), shared across instances through surf's store; see Throttles. Discovery and JWKS are never throttled.
Routes
| Method and path | Group | Notes |
|---|---|---|
GET /.well-known/openid-configuration |
public | discovery, Cache-Control: max-age=3600, public |
GET /oauth/jwks |
public | active key plus retired keys within the grace window |
POST /oauth/token |
server to server | authorization_code (and refresh_token when enabled); client_secret_basic or client_secret_post |
GET /oauth/userinfo |
server to server | bearer access token |
GET /oauth/authorize |
browser | start: anonymous users go to login_url?redirect=/oauth/authorize/resume/{request} |
POST /oauth/authorize |
browser | the consent decision (request_id, consent_token, decision) |
GET /oauth/authorize/resume/{request} |
browser | resume after login; silent when the consent covers the request |
POST /oauth/authorize/switch-account |
browser | ends the session and returns to the resume path |
GET /oauth/authorize/requests/{request} |
consent JSON (redirect mode only) | {request_id, consent_token, client {client_id, name, logo_url}, scopes}; 410 {"error":"expired_request"} |
POST /oauth/authorize/requests/{request} |
consent JSON (redirect mode only) | JSON {consent_token, decision} answers {redirect_uri}; 410 as above |
GET /oauth/authorizations |
authorized apps (jwt.auth) |
{"authorizations":[{client_id, name, logo_url, scopes, first_authorized_at, last_used_at, kind}]}; kind is last and is always oidc or mcp |
DELETE /oauth/authorizations/{client_id} |
authorized apps (jwt.auth) |
{"revoked":true} after classes.LockUserGrants and deletion of the consent, codes, MCP codes, access tokens and refresh tokens; 404 {"error":"not_found"} when no consent exists |
GET /.well-known/oauth-authorization-server |
MCP (mcp.enabled only) |
RFC 8414 metadata |
GET /oauth/mcp/authorize |
MCP (mcp.enabled only) |
parks the request and sends the browser to {issuer}/connect?request= (mcp.consent_path when set; <backend.uri>/connect in backend mode) |
POST /oauth/mcp/register |
MCP (mcp.enabled only) |
dynamic client registration |
POST /oauth/mcp/token |
MCP (mcp.enabled only) |
code exchange and refresh rotation |
GET /oauth/mcp/requests/{request} |
MCP consent JSON (mcp.enabled and user mode only, jwt.auth) |
{request_id, client {name, redirect_host, logo_url}, scopes, expires_at, backend_admin, scope_details, consent_required}; logo_url is "" when the client has no logo; scope_details is {name, label, description, locked} with locked only for read; consent_required is false only when a stored consent already covers the request; backend_admin is {login, name} of the linked backend account when backend is requested and a link exists, else null; 404 {"error":"request_not_found"} |
POST /oauth/mcp/requests/{request} |
MCP consent JSON (mcp.enabled and user mode only, jwt.auth) |
JSON {decision, scopes, backend_admin} answers {redirect_uri}; 404 as above, 422 {"error":"no_grantable_scopes"}, 409 {"error":"backend_link_changed"} when backend_admin is not the administrator linked now |
The browser routes and the consent JSON routes (the MCP ones included) carry throttle:oauth-authorize; the token route oauthserver.body.limit:<token_body_limit> then throttle:oauth-token; userinfo throttle:oauth-userinfo; the authorized-apps routes jwt.auth and throttle:oauth-authorizations, preceded by cors:<cors_profile> when one is set (without a profile there is no OPTIONS route, where PHP answered 204). The MCP routes carry throttle:oauth-mcp-register and oauthserver.body.limit plus throttle:oauth-mcp-token. surf's own body.limit applies to non-raw routes only, so the token route caps its body with the plugin's middleware factory oauthserver.body.limit (BodyLimitMiddleware), placed before the throttle whose key reads the form.
Throttles
| Bucket | Limit | Key |
|---|---|---|
oauth-authorize (BucketAuthorize) |
30 a minute | oauth-authorize: + the user id of the session JWT (verified with the golem15.user secret, no database lookup), else oauth-authorize-ip: + client IP |
oauth-token (BucketToken) |
20 a minute | oac: + the client_id form field, else oac-ip: + client IP. As in PHP, the Basic header is not read, so client_secret_basic relying parties share their IP's bucket. |
oauth-userinfo (BucketUserInfo) |
60 a minute | oau: + SHA-256 hex of the bearer token (never the token), else oau-ip: + client IP |
oauth-authorizations (BucketAuthorizations) |
120 a minute | oauth-authorizations: + user id, else oauth-authorizations-ip: + client IP |
oauth-mcp-register (BucketMCPRegister, with mcp.enabled) |
10 a minute | oauth-mcp-register-ip: + client IP |
oauth-mcp-token (BucketMCPToken, with mcp.enabled) |
20 a minute | oauth-mcp-token: + the client_id form field, else oauth-mcp-token-ip: + client IP |
Client IPs honour http.trusted_proxies (surf.ClientIP).
API reference
oauthserver:PluginID,Plugin(withBuckets,MiddlewareFactories,Commands,Schedule,AdminFS,AdminControllers,Settings,Permissions,NavigationandAccountContributions),Servers,Config(withRotationInterval,MCPSubjectMode,MCPConsentPath,OIDCEnabledandBackendMode),AccountContributionMCPConnections,LoadConfig(app),NewServers(app, cfg, views),DefaultTokenBodyLimit,BodyLimitMiddleware,BucketAuthorize,BucketToken,BucketUserInfo,BucketAuthorizations,BucketMCPRegister,BucketMCPToken.classes:Store(NewStore(db),WithClaims,WithinOIDCTx),LazyStore,MCPStore(NewMCPStore(db),WithinTx),LazyMCPStore(BackendSubjects),MCPAccessTokenPrefix,MCPTokenVerifier(NewMCPTokenVerifier(app, resource, scopes),BackendSubjects,MCPVerifyToken,MCPResource,MCPScopesSupported),AdvertisedMCPScopes(app),LockUserGrants(ctx, db, userIDs),WithinUserGrantsLock(ctx, db, userIDs, fn),WithGrantedOfflineAccess(ctx, granted),SubjectModeUser,SubjectModeBackend,WithBackendSubject(ctx),LockBackendGrants(ctx, db, adminIDs),WithinBackendGrantsLock(ctx, db, adminIDs, fn),BackendSubjectCurrent(ctx, db, adminID, at),BackendGrantRef(AdminID,ClientID),RevokeBackendGrants(ctx, tx, adminIDs, clientID),FireBackendRevokedAfterCommit(ctx, app, tx, refs),BackendCascade(OnBackendAccessRevoked),ErrBackendRevocationNoTx,Cascade(OnUserDeleting,OnUserDeactivating,OnAccessRevoked,OnBackendLinked,OnBackendUnlinked,OnBackendLinkChanged),FireSubjectChanged(ctx, app, guard, userID, kind)andFireSubjectChangedAfterCommit(ctx, app, tx, guard, userID, kind)(both delegate to golem15.user's helpers of the same names),ErrDatabaseUnavailable,KeyRing(NewKeyRing(app, cfg),ActiveSigningKey,PublishedKeys,Rotate,Prune,Config),KeyRingConfig(Algorithm,Grace),Claims(IdentityClaims),Community,DefaultPictureSize,AbsoluteURL,DisplayName,Host(NewHost(app, views, opts),Options,ClientLogoURL),HostOptions,ConsentModePage,ConsentModeRedirect,ClientLogoURL(ctx, app, clientID),RevealStore(Park,Take),RevealTTL,DecidePath,SwitchPath,Branding,DefaultBranding,LoadBranding,BrandingCSS,SanitizeColor,SanitizeFontFamily,SanitizeCSSURL,SanitizeCustomCSS,DangerColor,MaxCustomCSSand theDefault*colour constants.console:ImportWinter(app)(oauthserver:import-winter),ImportWinterFile(ctx, db, opts, out),ImportKeyDir(ctx, db, dir, out),ImportSettings(ctx, app, db, file, uploadsDir, out),RotateKeys(app)(oauthserver:rotate-keys),Prune(app)(oauthserver:prune),PruneExpired(ctx, db, ring, now),PruneReport(AuthCodes,AccessTokens,AuthRequests,SigningKeys,RefreshTokens,MCPCodes),PruneMargin,WinterOptions(File,KeyDir,Settings,UploadsDir,Force,DryRun),WinterReport(Rows,Keys).controllers:ConsentShow(app, srv),ConsentDecide(app, srv),MCPConsentShow(app, srv),MCPConsentDecide(app, srv),MCPAdminConsent(NewMCPAdminConsent(app, srv),MCPAdminConsentShow,MCPAdminConsentDecide),AuthorizationsIndex(app),AuthorizationsDestroy(app),AdminControllers(app),BackendModeAdminControllers(app),ClientsControllerID,BrandingControllerID,MCPConnectionsControllerID,PermissionManageClients,PermissionManageSettings,PermissionManageMCPConnections,ActionRevokeMCPConnections,ActionRegenerateSecret, and the partial view modelsSecretRevealView,AuthorizationsView,AuthorizationRow.models:LangPrefix,Client(ClientLogoField,RedirectURIsText,Fillable,Rules,SetPendingSecret,TakePendingSecret),ClientKindOIDC,ClientKindMCP,AuthRequest,AuthCode,AccessToken,RefreshToken,Consent,Subject,SigningKey,Settings(SettingsLogoField),MCPCode,MCPConnection(MCPConnectionsTable),Strings,NewStrings,Uints,NewUints,Register,All.updates:Register,Alland the migrations202610190001_create_golem15_oauthserver_tables,202610190002_create_golem15_oauthserver_settingsand202610190003_create_golem15_oauthserver_mcp_codes,202610230001_add_golem15_oauthserver_backend_user_id,202610280001_backfill_golem15_oauthserver_mcp_consentsand202611200001_add_golem15_oauthserver_backend_subjects.
Configuration
Keys live under golem15.oauthserver.* and are set from the environment as SUMMER_GOLEM15__OAUTHSERVER__<KEY> (nested keys join with __).
| Key | Default | Environment | PHP | Meaning |
|---|---|---|---|---|
issuer |
"" (falls back to app.url) |
SUMMER_GOLEM15__OAUTHSERVER__ISSUER |
OAUTHSERVER_ISSUER |
the iss of every id_token; trimmed, trailing slash removed. Keep the PHP issuer at cutover. |
login_url |
/login |
SUMMER_GOLEM15__OAUTHSERVER__LOGIN_URL |
OAUTHSERVER_LOGIN_URL |
where anonymous browsers sign in |
rotation_grace_hours |
24 |
SUMMER_GOLEM15__OAUTHSERVER__ROTATION_GRACE_HOURS |
OAUTHSERVER_ROTATION_GRACE_HOURS |
how long a retired key stays published |
rotation_interval |
"" (off) |
SUMMER_GOLEM15__OAUTHSERVER__ROTATION_INTERVAL |
(new) | Go duration between scheduled key rotations, for example 2160h; empty schedules none; anything else that is not a positive duration fails boot |
key_algorithm |
RS256 |
SUMMER_GOLEM15__OAUTHSERVER__KEY_ALGORITHM |
(new) | RS256 or ES256 for generated keys; anything else fails boot |
ttl.id_token |
3600 |
SUMMER_GOLEM15__OAUTHSERVER__TTL__ID_TOKEN |
OAUTHSERVER_TTL_ID_TOKEN |
seconds |
ttl.access_token |
3600 |
SUMMER_GOLEM15__OAUTHSERVER__TTL__ACCESS_TOKEN |
OAUTHSERVER_TTL_ACCESS_TOKEN |
seconds |
ttl.auth_code |
60 |
SUMMER_GOLEM15__OAUTHSERVER__TTL__AUTH_CODE |
OAUTHSERVER_TTL_AUTH_CODE |
seconds |
ttl.auth_request |
600 |
SUMMER_GOLEM15__OAUTHSERVER__TTL__AUTH_REQUEST |
OAUTHSERVER_TTL_AUTH_REQUEST |
seconds |
ttl.refresh_token |
2592000 |
SUMMER_GOLEM15__OAUTHSERVER__TTL__REFRESH_TOKEN |
(new) | seconds |
refresh.enabled |
false |
SUMMER_GOLEM15__OAUTHSERVER__REFRESH__ENABLED |
(new) | refresh tokens for clients with offline access granted offline_access |
picture_size |
128 |
SUMMER_GOLEM15__OAUTHSERVER__PICTURE_SIZE |
OAUTHSERVER_PICTURE_SIZE |
avatar size of the picture claim |
consent_mode |
page |
SUMMER_GOLEM15__OAUTHSERVER__CONSENT_MODE |
(new) | page or redirect; anything else fails boot |
consent_url |
"" |
SUMMER_GOLEM15__OAUTHSERVER__CONSENT_URL |
(new) | the application's consent page; required with redirect |
token_body_limit |
65536 |
SUMMER_GOLEM15__OAUTHSERVER__TOKEN_BODY_LIMIT |
(new) | body cap of POST /oauth/token (and /oauth/mcp/token) in bytes |
cors_profile |
"" |
SUMMER_GOLEM15__OAUTHSERVER__CORS_PROFILE |
(new) | surf CORS profile (http.cors_profiles.<name>) of the authorized-apps routes |
mcp.enabled |
false |
SUMMER_GOLEM15__OAUTHSERVER__MCP__ENABLED |
(new) | mounts the MCP routes and publishes the MCP access-token verifier. Leave it off in an application that serves its own MCP authorization server: the paths would collide at boot. |
mcp.resource |
"" |
SUMMER_GOLEM15__OAUTHSERVER__MCP__RESOURCE |
(new) | the MCP server's resource indicator; must equal the MCP endpoint's mcp.resource. With mcp.enabled, a loopback value (localhost, 127.0.0.1, ::1) on an issuer that is not loopback fails boot in backend mode and logs a warning in user mode: it is a local default the deployment did not override |
mcp.subject |
user |
SUMMER_GOLEM15__OAUTHSERVER__MCP__SUBJECT |
(new) | who an MCP sign-in authenticates: user (a frontend user of golem15.user) or backend (an administrator, see Backend-subject mode). backend needs mcp.enabled and cannot be combined with mcp_scopes; anything else fails boot. One subject per application for now. |
mcp.consent_path |
"" |
SUMMER_GOLEM15__OAUTHSERVER__MCP__CONSENT_PATH |
(new) | the path the MCP authorize endpoint appends to the issuer for the consent screen; empty means <backend.uri>/connect in backend mode and /connect in user mode. With mcp.enabled, a value that is not a plain same-origin path (wristband.CheckConsentPath: one leading /, no ?, #, \, @, whitespace or control character) fails boot |
oidc.enabled |
true |
SUMMER_GOLEM15__OAUTHSERVER__OIDC__ENABLED |
(new) | false mounts none of the OpenID Connect provider routes (discovery, JWKS, authorize, resume, switch account, token, userinfo, the redirect-mode consent JSON); the authorized-apps routes then stay only in user mode |
mcp_scopes |
unset | SUMMER_GOLEM15__OAUTHSERVER__MCP_SCOPES |
(new) | declared member scopes advertised besides the fixed names read, write, ai, offline_access and backend, which are always present. Unset: every declared name. A list: only those names. Empty: the five fixed names only. A name no plugin declares fails boot. The env value is comma-separated. |
Backend-subject mode
With mcp.subject: backend an MCP sign-in authenticates an administrator (backend_users) instead of a frontend user, for an application whose MCP tools are backend-guarded and which has no frontend users. It is off by default, and with mcp.subject: user every route, scope list, row and test behaves as before. The plugin still requires golem15.user. A typical configuration:
mcp:
enabled: true
resource: https://example.test/mcp
subject: backend
oidc:
enabled: false
- Routes.
/.well-known/oauth-authorization-server,/oauth/mcp/authorize,/oauth/mcp/registerand/oauth/mcp/tokenas in user mode. The authorize endpoint hands the browser to{issuer}<backend.uri>/connect?request=<id>(or{issuer}<mcp.consent_path>), the admin SPA's consent screen. The user-mode consent JSON/oauth/mcp/requests/{request}is not mounted, so a frontend user can never finish an administrator's pending request. Withoidc.enabled: falsethe OpenID Connect provider routes and the authorized-apps routes are not mounted either. - Consent. Boot publishes
controllers.MCPAdminConsentaspact.MCPAdminConsent. cabana servesGETandPOST {api}/mcp/consent/{request}behind the admin session and applies the personal API token rules: the screen offers only the requested scopes the administrator can use, and*collapses the grant. The provider resolves the pending request and, on Allow, issues the code and replaces the administrator's consent for the client in one transaction under the administrator's grants lock (classes.WithinBackendGrantsLock). Under that lock it reads the administrator again (classes.BackendSubjectCurrent): one who was deactivated or deleted, or whosetokens_valid_aftermoved after the decision started (a password change or set that committed while the decision waited for the lock), gets 404 and nothing is written. The code exchange of an administrator's code is refused (invalid_grant) the same way when the administrator no longer loads or the code was issued before theirtokens_valid_after. A pending row turns into a code once (a conditionalUPDATE): of two administrators deciding the same request at the same time, the second gets 404 and the first decision's code stands. The same holds for two decisions in user mode. - Scopes.
scopes_supported(authorization server metadata, the authorize allow-list and the verifier'sMCPScopesSupported, so the MCP endpoint's protected-resource metadata too) is the personal API token catalog (cabana.TokenScopeNames:*,admin:readand the plugins'TokenScopes) plusoffline_access. A request that names no scope asks for the whole catalog, neverread. A grant is scope-limited exactly like ag15_token with the same scopes. - Storage. The existing tables hold the grants: an administrator's MCP code, access token, refresh token and consent have
user_idNULL and name the administrator inbackend_user_id(migration202611200001_add_golem15_oauthserver_backend_subjects: nullableuser_idon access tokens, refresh tokens and consents,consents.backend_user_id, the partial unique indexoas_consents_backend_client_uniqueper administrator and client, partial lookup indexes andNOT VALIDchecks that refuse a row naming no subject). User-mode queries filter onuser_idand never see these rows. The migration rewrites no table; its rollback deletes every administrator's grant, becauseuser_idbecomesNOT NULLagain. - Verification. The verifier answers such a token as
pact.MCPGrant{UserID: 0, BackendUserID, Subject: pact.MCPGrantSubjectBackend, ...}whilecabana.BackendPrincipalstill loads the administrator (not deleted, not deactivated) and the token is not older than the administrator'stokens_valid_after. A failed administrator lookup (a database error) is returned as is, so the request fails closed with a server error and the client keeps its grant. Every use stampslast_used_aton the token and, at most once a minute, on the administrator's consent. - Refresh. "Stay connected" on the consent screen grants
offline_access. A refresh rotation of an administrator's grant takes the administrator's grants lock (shared), keepsuser_idNULL andbackend_user_idon the new access and refresh tokens, and is refused (invalid_grant) when the administrator no longer loads or the refresh token is older than theirtokens_valid_after. The administrator is read through the rotation's own transaction; a failed read answers a server error, notinvalid_grant. - Revocation. Boot listens to
cabana.BackendAccessRevokedEventin backend mode only (classes.BackendCascade,OnBackendAccessRevoked). cabana fires it inside the save's transaction when an administrator is deleted or deactivated, changes their own password, has a password set by another administrator or reset withadmin:reset-password, or has their role, own permissions or superuser flag changed, and for every holder when a role's permissions change. The listener revokes, in that transaction, every access and refresh token of those administrators, deletes their unexchanged codes and their consents (classes.RevokeBackendGrants, underclasses.LockBackendGrants), and after the commit fires onepact.MCPSubjectChanged{Guard: "backend", Kind: revoked, ClientID}per client (classes.FireBackendRevokedAfterCommit), which ends exactly those MCP sessions. A failure rolls the administrator change back. An event without a transaction (Txnil, which cabana never fires) is refused withclasses.ErrBackendRevocationNoTxand revokes nothing, because the grants lock and the revocation only hold inside one transaction. Role and permission changes revoke rather than re-list tools. Frontend users' grants, including user-mode grants linked to the same administrators, are never touched. cabana offers no "sign out everywhere", so there is nothing to listen to for it. - My account. In backend mode only, the plugin contributes the My account section
mcp_connections(AccountContributionMCPConnections): the connector address (mcp.resource) as its status, and one row per client the signed-in administrator connected, most recently used first. A row shows the client name (the client id when it has none), the granted scope labels withoutoffline_access, and "Connected" with "Last used" or "Never used". Its one item actionrevoke(danger, with a confirmation naming the row) revokes that client's grant only and ends its sessions; a client the administrator did not connect answers 404. User-mode applications get no section. - MCP connections screen. In backend mode only, a side-menu entry MCP connections (
mcp_connections, iconnetwork, after Clients) openscontrollers.MCPConnectionsControllerID(golem15.oauthserver.mcpconnections), gated by the permissiongolem15.oauthserver.manage_mcp_connections(controllers.PermissionManageMCPConnections, no default role; superusers pass). It lists every administrator's connections (models.MCPConnection, read from the consents): administrator (full name, else login), email, client, scopes, connected and last used, 20 to a page, searchable by administrator, email and client. There is no create button and no record page. The bulk actionrevoke(controllers.ActionRevokeMCPConnections) revokes the selected connections exactly like the My account action. - One subject per application. An application runs either user mode or backend mode for now. User-mode applications see no new route, section, screen or permission. An administrator's grant is honoured in backend mode only: after a switch to
mcp.subject: user(withmcp.enabledstill on), the verifier refuses administrators' access tokens and the token endpoint refuses their codes and refresh tokens (invalid_grant), because nothing in user mode could list or revoke them (classes.LazyMCPStore.BackendSubjects,classes.MCPTokenVerifier.BackendSubjects, both set byNewServers). Frontend users' grants keep verifying in backend mode.
Admin
The plugin adds a navigation entry OAuth clients (order 560, permission golem15.oauthserver.*) with a Clients side menu, a Settings link OAuth Server to the branding form, and two permissions (PHP codes and labels): golem15.oauthserver.manage_clients (controllers.PermissionManageClients) and golem15.oauthserver.manage_settings (controllers.PermissionManageSettings). Both screens use stock field types only. Backend mode adds the MCP connections side-menu entry and the permission golem15.oauthserver.manage_mcp_connections (see Backend-subject mode).
- Clients (
controllers.ClientsControllerID,golem15.oauthserver.clients, needsmanage_clients). The list and the form show OIDC clients only (kind = oidc); MCP clients from dynamic registration are not managed here (D-08). Columns: name, client id, active, development, subject type, created. Fields: name; the client id (read only); redirect URIs as a textarea, one per line (Client.RedirectURIsText, stored in theredirect_urisJSON column), each checked withwristband.RejectRedirectURI, andhttp://loopback URIs only on a development client; scopes as a fixed-option taglist (openidis always kept,offline_accessis saved only with the offline access switch, which takes effect only withrefresh.enabled); the logo (fileupload, image); the active, development and offline access switches; the subject type (public or pairwise) and the sector identifier: a pairwise client must resolve a sector (wristband.SubjectSector), so one whose redirect URIs span two hosts without a sector identifier is refused on save instead of failing at sign-in. - One-time secret. Creating a client issues
oas_+ 24 hex characters and anoas_cs_secret (wristband.IssueOIDCClientCredentials); only the SHA-256 hash is stored. The plaintext is parked inclasses.RevealStore(Park,Take) in the application cache (cooler.FromApp) underoauthserver:reveal:{admin id}:{record id}forclasses.RevealTTL(5 minutes), and the form's secret partial takes it on its first read: the creating administrator sees it once, on that client only. The record actionregenerate_secret(controllers.ActionRegenerateSecret, a danger action on the preview screen) replaces the hash, so the old secret fails at/oauth/tokenat once, and parks the new one the same way. The secret hash is never a field, a column or a JSON member. Multi-instance deployments needcache.driver: redisfor the reveal to reach a request that lands on another instance; an administrator who misses the reveal regenerates the secret. The parked plaintext lives in that cache for at most five minutes. - Authorized users. The client form lists who consented to the client: name, email, the
subthe client sees for them (its sector), the granted scopes, first authorized and last used. Read only; users revoke their own grants through the authorized-apps API. - Branding (
controllers.BrandingControllerID,golem15.oauthserver.branding, needsmanage_settings) is a singleton controller over row 1 ofgolem15_oauthserver_settings, linked from Settings (codeoauthserver_branding), because a cabana settings form refuses file uploads. Fields: site name, logo, the seven colours (hex only), font stylesheet URL (https only), font family and custom CSS (at most 20000 characters). The pages sanitise every stored value again on render. The site logo is shown on the error pages, the client logo on the consent page. - The signing-key model is never an admin controller, form or list.
Importing from WinterCMS
oauthserver:import-winter moves a WinterCMS site's provider to the Go plugin without its relying parties noticing: the six PHP tables keep their ids, hashes and timestamps, and the PHP signing keys keep their kids (D-11), so pre-cutover id_tokens still verify against the new JWKS, live access tokens still read userinfo and every client keeps its secret.
-
Import the users first (golem15.user's import), keeping their ids: the import aborts, naming the count, when a row references a user the application does not have.
-
Export the provider tables from the PHP site's MariaDB/MySQL (read-only; check the table names first, see the header of the script):
mysql -N -B --raw <database> < scripts/winter-export.sql > oauthserver.jsonlThe file holds hashes and user ids, never a plaintext secret; keep it out of every repository and delete it afterwards.
-
Copy the PHP key_dir (
storage/app/oauthserverby default:keys.json,{kid}.key,{kid}.pub) to the Go host with its0700/0600modes. -
Import:
./app oauthserver:import-winter --file=oauthserver.jsonl --key-dir=/secure/oauthserver --dry-run ./app oauthserver:import-winter --file=oauthserver.jsonl --key-dir=/secure/oauthserverAdd
--settings=oauthserver.jsonlto copy the branding (thesystem_settingsitemgolem15_oauthserver_settings) into settings row 1, and--uploads-dir=<winter>/storage/app/uploadsto copy the client and site logos of the export'ssystem_fileslines into this application's storage (--uploads-dirneeds--settings; the same export file serves both flags).--dry-runreports the rows per table and the kids without writing. Non-empty target tables (or kids the ring already holds) are refused unless--force, which replaces them in the same transaction. The id sequences move past the copied ids.
What the import writes:
golem15_oauthserver_clients,_subjects,_consents,_auth_requests,_auth_codes,_access_tokens, one transaction. Hashes (secret_hash,code_hash,token_hash,consent_token_hash) are SHA-256 hex in both implementations and are copied as they are. Imported clients arekind = oidc,subject_type = public, without offline access (D-17), withclient_secret_basic; imported subjects are public (sector'').- With
--key-dir, onegolem15_oauthserver_keysrow per kid ofkeys.json: the original kid, the public key, the private key encrypted withapp.key(lagoon.NewEncrypted),created_atandretired_atfrom the manifest; only the manifest's active kid is active. A key whose private half does not match its.pubaborts the import. A key the Go ring generated before the import is retired (it stays verifiable for the grace window). The key directory is read and checked before any table is written. - With
--settings, the branding keys PHP and Go share (unknown keys are reported and ignored, a value longer than its column is reported and skipped); with--uploads-dir, each logo file is stored through lagoon attach (read from{uploads-dir}/{partition}/{disk_name}, or itspublic/andprotected/subdirectories) as the client's or the site's logo, replacing the previous one. - The output names tables, counts and kids, never a hash, a secret, a token or key material.
Environment mapping (PHP .env to the Go configuration):
| PHP | Go key | Environment |
|---|---|---|
OAUTHSERVER_ISSUER |
golem15.oauthserver.issuer |
SUMMER_GOLEM15__OAUTHSERVER__ISSUER |
OAUTHSERVER_LOGIN_URL |
golem15.oauthserver.login_url |
SUMMER_GOLEM15__OAUTHSERVER__LOGIN_URL |
OAUTHSERVER_ROTATION_GRACE_HOURS |
golem15.oauthserver.rotation_grace_hours |
SUMMER_GOLEM15__OAUTHSERVER__ROTATION_GRACE_HOURS |
OAUTHSERVER_TTL_ID_TOKEN, _ACCESS_TOKEN, _AUTH_CODE, _AUTH_REQUEST |
golem15.oauthserver.ttl.id_token, .access_token, .auth_code, .auth_request |
SUMMER_GOLEM15__OAUTHSERVER__TTL__ID_TOKEN and so on |
OAUTHSERVER_PICTURE_SIZE |
golem15.oauthserver.picture_size |
SUMMER_GOLEM15__OAUTHSERVER__PICTURE_SIZE |
At cutover:
- Keep the issuer identical (relying parties pin it).
- Stop the PHP scheduler's
oauthserver:prunecron; the Go plugin prunes on its own schedule. - Do not rotate keys within one hour of the cutover: relying parties cache the JWKS for up to an hour.
- After verifying the cutover, delete the PHP key_dir and the copied key directory securely; the keys now live encrypted in the database.
- When you later rotate
app.key, keep the old key inapp.previous_keys, or the imported keys become unreadable.
Security notes
- The application key protects the signing keys. Private keys are encrypted with
app.key. When you rotateapp.key, keep the old key inapp.previous_keys, or the ring becomes unreadable and every sign-in fails until new keys are generated (which relying parties will not trust until they refetch the JWKS). - Client secrets, codes and access tokens are stored as SHA-256 hex digests only, with the PHP prefixes (
oas_cs_,oas_ac_,oas_at_), so imported hashes keep working. - The consent form carries a one-shot token bound to the parked request and the user; the pages are never framed (the engine sets
X-Frame-Options: DENYandframe-ancestors 'none') and never cached. - Branding values are administrator input rendered to every visitor: they pass the sanitisers before they become CSS, and the custom CSS loses every tag opener until none is left (the PHP sanitiser's single pass could rebuild a
</style>from<<</style>). - Nothing logs a secret, a code, a token or key material.
CLI commands
| Command | Flags | What it does | Example |
|---|---|---|---|
oauthserver:import-winter |
--file, --key-dir, --settings, --uploads-dir, --force, --dry-run |
the WinterCMS cutover, see Importing from WinterCMS | bin/<app> oauthserver:import-winter --file oauthserver.jsonl --key-dir winter/keys --dry-run |
oauthserver:rotate-keys |
--prune |
promotes a new signing key (algorithm from key_algorithm) and retires the previous one, which stays in the JWKS and verifiable for rotation_grace_hours; --prune also deletes keys past the grace window. Prints PHP's lines (New signing key: {kid}, Retired previous key {kid} at {time} (verifiable for {n} more hours).); on failure only Key rotation failed: the signing key could not be generated or written. and a non-zero exit, never key material |
bin/<app> oauthserver:rotate-keys --prune |
oauthserver:prune |
deletes authorization codes, access tokens (expired or revoked), authorization requests, refresh tokens (expired or revoked) and MCP codes more than one day (console.PruneMargin) past expiry, and the signing keys retired before the grace window; prints Authorization codes pruned: {n}, Access tokens pruned: {n}, Authorization requests pruned: {n}, Signing keys pruned: {n} (PHP's four lines), then Refresh tokens pruned: {n} and MCP codes pruned: {n}, and ends with Pruned {rows} expired rows and {keys} signing keys. |
bin/<app> oauthserver:prune |
bin/<app> help <command> shows each command's long help and more examples. The plugin logs through the component oauthserver (log.components.oauthserver in config/log.yaml).
Schedule
oauthserver:prune runs daily. oauthserver:rotate-keys runs every rotation_interval when that key is set (2160h, 90 days, is a sensible value); it is off by default, and a value that is not a positive Go duration fails boot naming golem15.oauthserver.rotation_interval. The framework scheduler runs each job once per period across instances. Switching to ES256 is key_algorithm: ES256 plus a rotation: the JWKS then holds the RS256 and ES256 keys side by side until the grace window ends.
Dependencies
summercms v0.5.0 (backpack, bonfire, bouncer, diary, cabana, cooler, lagoon, lagoon/attach, pact, party, phrasebook, surf, towel, wristband), gocloud.dev/blob (the attachment bucket of the logo import), git.golem15.com/golem15/sm-user-plugin v0.1.11 (with classes.RequestUser, classes.EndRequestSession, classes.AvatarURL and classes.PrincipalByID), gorm.io/gorm, github.com/go-gormigrate/gormigrate/v2, github.com/jackc/pgx/v5. Tests only: github.com/golang-jwt/jwt/v5, github.com/testcontainers/testcontainers-go, and for the relying-party interop test github.com/coreos/go-oidc/v3 (v3.21.0) and golang.org/x/oauth2 (v0.37.0). No production file imports the last two.
During development go.work points summercms at ../summercms.go and sm-user-plugin at the checkout that carries the new exports.
Testing
go vet ./...
go test -short ./... # no Docker
go test ./... # also the Postgres tests (testcontainers)
The Postgres tests skip under -short. TestOIDCFlowSmoke signs a user in end to end (discovery, authorize with the session cookie, resume, consent, code exchange, id_token verified against the served JWKS, userinfo) and checks that the stored private key is ciphertext. TestKeyRingFirstKeyRaceSmoke races eight first-key calls and expects one active key. TestConsentPageBrandingSmoke covers the branding, escaping and framing headers, TestLoginHandoffAndSwitchSmoke the login handoff, account switching and the redirect consent mode, TestBucketKeysSmoke the throttle keys, TestRouteGuardSmoke that /oauth/{provider} routes of another plugin neither shadow nor are shadowed by the provider's paths, TestAuthorizationsSmoke the authorized-apps list and revocation, TestUserCascadeSmoke the delete and deactivate cascade, TestMCPStoreSmoke the MCP flow on the plugin's stores and the off switch, TestMCPConsentSmoke the MCP consent JSON (the backend_admin line and the backend grant with and without a link, the scope intersection, deny, unknown and foreign requests) and the revoked and deleted events, TestMCPTokenVerifierSmoke the resource-side verifier (valid token, OIDC-client token, revoked and expired tokens, revoked client, deactivated user, the last_used_at debounce), and TestMCPRevocationSmoke the revocation chain (a ban revokes the MCP and OIDC grants, the verifier and the refresh grant refuse, and an unlink revokes only the backend grant with a client-specific event). TestMCPVerifierRevocation pins the verifier and refresh refusals without a revoke listener (a token from before tokens_valid_after, the same-second cutoff, the untruncated Before of the access-revoked event, a ban written without moving the cutoff refusing both the verifier and the rotation until unbanned, a rotation of a token from before the cutoff, a deleted user), and TestMCPGrantRevocation the grant revocation (earlier MCP and OIDC tokens revoked and later ones kept, the consent and unused codes deleted, a self-service password change ending a grant its client rotated after the calling session's iat while the session survives, RemoveLink and a new SetLink revoking only backend tokens with client-specific events after the commit, the authorized-apps revoke event with its client). TestMCPBackendBinding pins the consented administrator: the 409 on a decision naming an administrator who is not linked now, backend_user_id from the code through the exchange and every rotation into pact.MCPGrant.BackendUserID, a directly minted grant recording the context's administrator, unexchanged backend codes deleted by a link change, and a revocation that waits for a rotation in flight and revokes its successor. TestMCPConsentAllowSerializesWithRevoke holds the user's grants lock in another transaction: the allow waits and writes nothing, and a revoke queued behind it removes the code and the consent the allow then wrote; TestMCPConsentFailureRollsBackCode shows that a failing consent write rolls the code back and leaves the request decidable. TestOIDCResumeSerializesWithRevoke, TestOIDCRefreshSerializesWithRevoke and TestOIDCExchangeSerializesWithRevoke park a silent resume, a refresh rotation and a code exchange mid-transaction: a revoke that lands then leaves no code or token for the pair, and the exchange does not deadlock with it; TestOIDCConsentAllowThenRevoke shows that a revoke queued behind a consent decision removes the consent and the code that decision issued.
TestImportWinterCutoverSmoke imports a WinterCMS export and a PHP-shaped key_dir and proves the cutover: both kids in the JWKS, pre-cutover id_tokens of either key verify, the old access token reads userinfo with the imported sub, the old client secret redeems an imported code and the new id_token carries the imported active kid, a second import is refused, and new rows get ids above the imported ones.
TestClientsAdminSmoke creates a client through cabana's admin API and checks the one-time reveal (once, only for the creating administrator, never on another client, never a hash in a list or a form), regenerate (the old secret fails at /oauth/token, the new one passes), the redirect URI round trip, the pairwise sector and loopback refusals, the authorized-users partial and the manage_clients permission. TestBrandingAdminSmoke opens the branding singleton from its Settings link, refuses a colour that is not hex, saves an accent colour and a site logo (both on the pages), uploads a client logo (on the consent page) and imports the Winter branding and its logo with ImportSettings.
TestRotateAndPruneSmoke rotates (new active kid, old kid still in the JWKS, a pre-rotation id_token still verifies), prunes rows on both sides of the one-day margin for every kind, prunes the retired key past the grace window, checks the PHP output lines and the fixed failure line. TestCommandsDocumented (no Docker) logs, without failing, each command whose help lacks a description, long help, examples or an option description (bonfire.CheckDocs). TestScheduleSmoke checks the default schedule, the scheduled rotation with rotation_interval: 2160h, and that soon and -1h fail boot.
The PHP parity suite (testdata/parity/, runbook in its README.md) holds ten tide spec flows of the relying-party-visible contract (discovery, JWKS, authorize errors, login handoff, consent allow, silent and deny, token and userinfo errors, authorized apps), the capture rules and the accepted deviations. TestPHPParityReplay replays the PHP recordings against the plugin and fails on any difference deviations.yaml does not explain; TestIDTokenShapeParity compares the id_token header members and claim set with the PHP id_token. Both skip with "no PHP recordings" until the flows are recorded, and fail instead with PHASE194_REQUIRE_PARITY=1. TestParityFixturesHoldNoSecrets checks that nothing under testdata/parity holds a secret, token, key or session cookie.
TestRelyingPartyInterop signs in with a stock relying party built on github.com/coreos/go-oidc/v3 and golang.org/x/oauth2, once against an RS256 ring and once against an ES256 ring: discovery, authorize with PKCE and a nonce, code exchange with client_secret_basic as x/oauth2 sends it, id_token and at_hash verified by the library, the nonce checked by the test (the library does not), userinfo with the same sub, and a silent second sign-in.