Documentation
¶
Overview ¶
Package oauthpostgres owns the selected OAuth protocol's durable records. Identity, credentials, local sessions and the command coordinator remain borrowed authorities. Installing this schema does not enable an endpoint.
Index ¶
- func NewResourceVerifier(pool *database.Pool, c Config, keys *keyring.Provider, ...) (*oauth.ResourceVerifier, error)
- func NewService(pool *database.Pool, c Config, keys *keyring.Provider) (*oauth.Service, error)
- type ClientMigrationSource
- type ClientPublicMigrationSource
- type ClientRotationMigrationSource
- type ClientUpdateMigrationSource
- type Config
- type ConsentExpiryMigrationSource
- type ConsentMigrationSource
- type DeviceConfig
- type DeviceMigrationSource
- type DeviceStore
- func (d *DeviceStore) DevicePolicy() oauth.DevicePolicy
- func (d *DeviceStore) ExecuteDevice(ctx context.Context, e oauth.DeviceExecution) (out oauth.DeviceResult, err error)
- func (*DeviceStore) Format(f fmt.State, _ rune)
- func (d *DeviceStore) InspectDevice(ctx context.Context, e oauth.DeviceInspection) (out oauth.DevicePrompt, err error)
- func (*DeviceStore) MarshalJSON() ([]byte, error)
- func (*DeviceStore) MarshalText() ([]byte, error)
- func (d *DeviceStore) RecoverDevice(ctx context.Context, e oauth.DeviceRecovery) (out oauth.Completion, err error)
- type EndSessionMigrationSource
- type HumanCodeExchangeMigrationSource
- type MigrationSource
- type PairwiseMigrationSource
- type ProfileUserInfoConfig
- type RecoveryRequest
- type RecoveryResult
- type SigningMigrationSource
- type Store
- func (s *Store) ActivateSigningKey(ctx context.Context, kid string) error
- func (s *Store) ActivateSubjectKey(ctx context.Context, policyID string, policyVersion uint64, keyVersion uint32) error
- func (s *Store) AuthenticateCurrentClient(ctx context.Context, c oauth.Client, a oauth.ClientAuthentication) error
- func (s *Store) Authorize(ctx context.Context, c oauth.AuthorizationCommand) (oauth.AuthorizeResult, error)
- func (s *Store) BootstrapHumanCodeExchangeClient(ctx context.Context, r oauth.IntrospectRequest) error
- func (s *Store) ClientGet(ctx context.Context, e oauth.ClientReadExecution) (out oauth.ClientGetResult, err error)
- func (s *Store) ClientList(ctx context.Context, e oauth.ClientReadExecution) (out oauth.ClientListResult, err error)
- func (s *Store) CompromiseSigningKey(ctx context.Context, kid string) error
- func (s *Store) ConsentDelete(ctx context.Context, c oauth.ConsentExecution) (out oauth.ConsentDeleteResult, err error)
- func (s *Store) ConsentGet(ctx context.Context, c oauth.ConsentExecution) (out oauth.ConsentGetResult, err error)
- func (s *Store) ConsentList(ctx context.Context, c oauth.ConsentExecution) (out oauth.ConsentListResult, err error)
- func (s *Store) ConsentUpdate(ctx context.Context, c oauth.ConsentUpdateExecution) (out oauth.ConsentUpdateResult, err error)
- func (s *Store) Continue(ctx context.Context, c oauth.ContinuationCommand) (oauth.AuthorizeResult, error)
- func (s *Store) CurrentClient(ctx context.Context, id string) (oauth.Client, error)
- func (s *Store) DeviceStore(c DeviceConfig) (*DeviceStore, error)
- func (s *Store) EndSession(ctx context.Context, e oauth.EndSessionExecution) (out oauth.EndSessionResult, err error)
- func (s *Store) EndSessionSelected() bool
- func (*Store) Format(s fmt.State, _ rune)
- func (s *Store) HumanCodeExchangeClientAuthority(ctx context.Context, r oauth.IntrospectRequest) (authority.AuthorityRecord, error)
- func (s *Store) InstallSubjectKey(ctx context.Context, registration oauth.OIDCSubjectKeyRegistration) error
- func (s *Store) Introspect(ctx context.Context, c oauth.IntrospectionCommand) (out oauth.IntrospectResult, err error)
- func (s *Store) ManageClient(ctx context.Context, c oauth.ClientManagementExecution) (out oauth.ClientManagementResult, err error)
- func (*Store) MarshalJSON() ([]byte, error)
- func (*Store) MarshalText() ([]byte, error)
- func (s *Store) PublishSigningKeys(ctx context.Context) ([]oauth.PublicSigningKey, error)
- func (s *Store) Recover(ctx context.Context, request RecoveryRequest) (out RecoveryResult, err error)
- func (s *Store) RegisterSigningKey(ctx context.Context, key oauth.PublicSigningKey) error
- func (s *Store) ReserveSigningKey(ctx context.Context, kid string, expiry time.Time) error
- func (s *Store) RetireSigningKey(ctx context.Context, kid string) error
- func (s *Store) RetireSubjectKey(ctx context.Context, policyID string, policyVersion uint64, keyVersion uint32) error
- func (s *Store) Revoke(ctx context.Context, c oauth.RevocationCommand) (out oauth.RevokeResult, err error)
- func (s *Store) RotateClientSecret(ctx context.Context, e oauth.ClientSecretRotationExecution) (out oauth.ClientSecretRotationResult, err error)
- func (s *Store) SubjectKeyRegistrations(ctx context.Context, policyID string, policyVersion uint64) ([]oauth.OIDCSubjectKeyRegistration, uint32, error)
- func (s *Store) Token(ctx context.Context, c oauth.TokenCommand) (out oauth.TokenResult, err error)
- func (s *Store) UpdateClient(ctx context.Context, e oauth.ClientUpdateExecution) (out oauth.ClientUpdateResult, err error)
- func (s *Store) UserInfo(ctx context.Context, c oauth.UserInfoCommand) (out oauth.OIDCClaimsInput, err error)
- func (s *Store) VerificationSigningKey(ctx context.Context, kid string) (oauth.PublicSigningKey, error)
- type WorkloadAuthorityConfig
- type WorkloadExchangeMigrationSource
- type WorkloadMigrationSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewResourceVerifier ¶
func NewResourceVerifier(pool *database.Pool, c Config, keys *keyring.Provider, policy oauth.ResourceVerificationConfig) (*oauth.ResourceVerifier, error)
NewResourceVerifier composes the direct opaque-access profile over actual primary OAuth/identity owners. Policy is trusted startup input, not request selection. Install and select ConsentManagement before construction; exact client/version/issuer/environment/resource mismatches deny, never retarget. No introspection endpoint, client credential, cache, worker or migration is installed. Borrowed pool, keys and clocks must outlive concurrent calls.
func NewService ¶
NewService composes the native primary session owner and Store with the core protocol in one public entry point. No custom SessionReader/domain store is needed. It has NewStore's ownership, migration and concurrency obligations.
Types ¶
type ClientMigrationSource ¶
type ClientMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
ClientMigrationSource appends terminal managed-client authority to the installed consent history. Install while issuance is stopped; retire all old accepting instances before selecting the registry. Existing history is intact.
func (ClientMigrationSource) Load ¶
func (s ClientMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type ClientPublicMigrationSource ¶
type ClientPublicMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
ClientPublicMigrationSource appends no-secret public registrations without rewriting installed client, rotation or update history. Stop issuance, install after the complete selected history, replace unaware serving instances, then select matching native/protocol PublicClients flags. Confidential-only use requires neither this history nor the flags. Rollback to unaware binaries after public rows exist is unsupported; disable issuance instead. The single ALTER TABLE validates existing rows under ACCESS EXCLUSIVE, blocking reads and writes. Use a maintenance window with bounded lock_timeout and statement_timeout, or equivalent operator command deadlines; finish the schema install and public-aware binary rollout before enabling the flags. See https://www.postgresql.org/docs/18/sql-altertable.html.
func (ClientPublicMigrationSource) Load ¶
func (s ClientPublicMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type ClientRotationMigrationSource ¶
type ClientRotationMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
ClientRotationMigrationSource appends versioned secret rotation to the original client history without rewriting published migrations. Stop serving, install, then deploy only rotation-aware instances before selecting ClientSecretRotation. Overlap has at most one predecessor; timestamps are exact and exclusive.
func (ClientRotationMigrationSource) Load ¶
func (s ClientRotationMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type ClientUpdateMigrationSource ¶
type ClientUpdateMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
ClientUpdateMigrationSource appends independent registration authority after installed client-rotation history. It never rewrites prior SQL or digest bytes. Stop serving, install, replace every accepting instance with update-aware code, then enable ClientMetadataUpdates. Old/unselected binaries fail closed on separated versions and must not remain in the accepting fleet.
func (ClientUpdateMigrationSource) Load ¶
func (s ClientUpdateMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type Config ¶
type Config struct {
Schema string
Protocol oauth.Config
Session sessionpg.SessionServiceConfig
CSRFKeys []session.CSRFKey
TokenKeys []oauth.TokenDigestKey
ActiveTokenKeyVersion uint32
IntentKey [32]byte
ActiveEnvelopeKeyID string
Coordinator kernel.CoordinatorConfig
RequestKeys kernel.RequestKeyConfig
PolicyID string
Counters riskpg.Config
// WorkloadAuthority binds configured machine clients to existing primary
// directory and service-account authorization owners, never user substitutes.
WorkloadAuthority WorkloadAuthorityConfig
// WorkloadExchangeClientNamespace selects a distinct real authorization
// namespace keyed by tenant and client ID. Initialize its epoch to the
// immutable registration Version before selecting WorkloadExchange. Advance
// withdraws lineage AND new issuance from that unchanged registration.
// It must differ from WorkloadAuthority.PolicyNamespace. No request creates
// or adopts an authority row; absent/stale/unavailable authority denies.
WorkloadExchangeClientNamespace string
// HumanCodeExchangeClientNamespace is an independent public authorization
// namespace for deterministic per-registration subjects. Explicit native
// bootstrap initializes epoch1; exchange never creates or repairs authority.
// It must differ from session, workload principal and workload client policy
// namespaces: the public authority owner has no separate subject-kind key.
HumanCodeExchangeClientNamespace string
// ConsentManagement enables own-consent reads/withdrawal and mandatory
// consent-generation fences for every human token. Install the forward
// ConsentMigrationSource and retire all old/unselected serving instances
// before enabling. Workload-only composition must leave this false.
ConsentManagement bool
// ConsentNarrowing selects keyed strict-subset updates. ConsentManagement
// and the kernel's request-key preparation history must already be installed.
// Existing read/delete-only compositions leave this false.
ConsentNarrowing bool
// ClientSecretRotation enables bounded managed confidential-secret overlap.
// Install ClientRotationMigrationSource and retire non-rotation instances
// before enabling; every secret change advances actual client authority.
ClientSecretRotation bool
// ClientMetadataUpdates separates registration authority from digest generation.
// Install ClientUpdateMigrationSource and retire all non-update-aware serving
// instances before enabling. Rotation-aware consent/client history is required.
ClientMetadataUpdates bool
// PublicClients selects no-secret managed human-web registrations. It must
// match Protocol.ManagedClients.PublicClients. Install ClientPublicMigrationSource
// and retire unaware serving instances before enabling; confidential-only
// deployments leave both false and need no additional schema.
PublicClients bool
// ConsentReuseTTL explicitly selects silent OIDC approval reuse for 1s..24h.
// Zero selects only a preactivation legacy writer. After installing expiry
// history, EVERY accepting writer must retain a positive TTL; mixed/zero
// writer rollback is unsupported. Revoke consent to withdraw reuse. Install
// forward history and retire old writers first; legacy NULL is never reusable.
ConsentReuseTTL time.Duration
// RPInitiatedLogout selects exact issued-hint/source-session termination.
// Install both owners' forward logout histories and retire unaware serving
// instances before enabling. Only this explicit purpose withdraws existing
// OAuth grants; ordinary browser signout retains its existing grant policy.
RPInitiatedLogout bool
// ProfileUserInfo explicitly selects the existing primary profile owner for
// consented OIDC display-name reads. It must match the profile scope catalog;
// stored immutable schemas are never guessed or migrated by this adapter.
ProfileUserInfo *ProfileUserInfoConfig
}
Config selects platform-owned public/configured-Basic password single-factor web clients and/or explicitly configured machine workloads. Every authority, schema, policy and key is trusted startup input. Protocol clients are immutable registrations; changing policy invalidates earlier grants instead of silently widening them. IntentKey must be a dedicated nonzero key, independent of token, session, fingerprint and envelope keys. Retain all key versions/configuration needed by outstanding commands. Install kernel preparation/protected-counter, applicable session/workload, authorization, risk lockout, audit/outbox and OAuth histories before enabling calls. Construction never installs migrations or adopts existing objects. The pool/keyring and policy dependencies remain borrowed and must outlive concurrent operations.
func (Config) MarshalJSON ¶
MarshalJSON denies implicit secret-bearing configuration export.
func (Config) MarshalText ¶
MarshalText denies implicit secret-bearing configuration export.
type ConsentExpiryMigrationSource ¶
type ConsentExpiryMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
ConsentExpiryMigrationSource appends nullable approval expiry to installed consent-management history. NULL legacy approval is deliberately NOT reusable: migration cannot invent an original user's approval lifetime. Stop accepting writers, install forward history, replace old instances, then explicitly set positive ConsentReuseTTL on EVERY accepting writer. Mixed/zero-writer rollback is unsupported and history is not reversible; revoke consent to withdraw reuse. Original migration bytes and retained preparation are unchanged.
func (ConsentExpiryMigrationSource) Load ¶
func (s ConsentExpiryMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type ConsentMigrationSource ¶
type ConsentMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
ConsentMigrationSource appends own-consent withdrawal authority to Base's installed OAuth history (with or without WorkloadMigrationSource). Version must follow every Base version. It preserves published migration bytes and populated human grants, binding already-approved grants to generation one. Stop issuance/old writers for this exclusive ALTER/backfill window, allow table/index/WAL headroom, then enable ConsentManagement on every serving instance. Old binaries/configurations must not continue accepting tokens. This is correctness/reference integrity, not a performance optimization.
func (ConsentMigrationSource) Load ¶
func (s ConsentMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load returns independent forward-only history without IO or object adoption. Failure is transactional; no down migration erases durable withdrawal state.
type DeviceConfig ¶
type DeviceConfig struct {
Policy oauth.DevicePolicy
LookupKeys []oauth.TokenDigestKey
ActiveLookupKeyVersion uint32
}
DeviceConfig explicitly selects optional storage and independent versioned device lookup keys. Retain old versions while any live/terminal recovery row uses them. Keys are borrowed immutable opaque values; input slices are copied. Install DeviceMigrationSource and the existing rate-limit owner's migration before enabling. No constructor performs IO, migration or background work.
func (DeviceConfig) MarshalJSON ¶
func (DeviceConfig) MarshalJSON() ([]byte, error)
func (DeviceConfig) MarshalText ¶
func (DeviceConfig) MarshalText() ([]byte, error)
type DeviceMigrationSource ¶
type DeviceMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
DeviceMigrationSource appends optional device state to the selected ordinary human/consent history. This first profile excludes workload and silent-OIDC artifact histories. Stop writers, install, then deploy only device-aware writers before activation. Base OAuth construction/bootstrap does not select this source. No down migration may erase committed grant/recovery authority.
func (DeviceMigrationSource) Load ¶
func (s DeviceMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type DeviceStore ¶
type DeviceStore struct {
// contains filtered or unexported fields
}
DeviceStore is an optional immutable factory product over the actual core native owner. It owns no transaction coordinator, domain engine or pool; every mutation uses the same native phase/coordinator/audit/lifecycle composition.
func (*DeviceStore) DevicePolicy ¶
func (d *DeviceStore) DevicePolicy() oauth.DevicePolicy
DevicePolicy returns a safe copied policy projection with no keys or handles.
func (*DeviceStore) ExecuteDevice ¶
func (d *DeviceStore) ExecuteDevice(ctx context.Context, e oauth.DeviceExecution) (out oauth.DeviceResult, err error)
ExecuteDevice rechecks all actual native owners; public child projections do not bypass client authentication or current protected transaction admission.
func (*DeviceStore) InspectDevice ¶
func (d *DeviceStore) InspectDevice(ctx context.Context, e oauth.DeviceInspection) (out oauth.DevicePrompt, err error)
InspectDevice returns only a safe bounded prompt after shared abuse admission and repeated actual current session/client/subject/consent reads. It creates no domain command, audit, lifecycle or consent and never approves a complete URI.
func (*DeviceStore) MarshalJSON ¶
func (*DeviceStore) MarshalJSON() ([]byte, error)
func (*DeviceStore) MarshalText ¶
func (*DeviceStore) MarshalText() ([]byte, error)
func (*DeviceStore) RecoverDevice ¶
func (d *DeviceStore) RecoverDevice(ctx context.Context, e oauth.DeviceRecovery) (out oauth.Completion, err error)
RecoverDevice authenticates original client/device or human/user-code custody and delegates metadata-only recovery to the existing sole coordinator.
type EndSessionMigrationSource ¶
type EndSessionMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
EndSessionMigrationSource appends immutable issued-hint associations to the OAuth namespace. It does not install session history or enable logout. Apply after signing history, then the session owner's logout suffix, and retire unaware readers/writers before enabling RPInitiatedLogout. No down migration can safely erase a termination or its original recovery scope.
func (EndSessionMigrationSource) Load ¶
func (s EndSessionMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type HumanCodeExchangeMigrationSource ¶
type HumanCodeExchangeMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
HumanCodeExchangeMigrationSource appends optional human delegation metadata after the complete installed OAuth history. Install under exclusive schema access, retire unaware writers, explicitly bootstrap selected registration authority, then enable the profile. Existing code/refresh/silent/workload rows and installed migration bytes remain unchanged. No down migration erases it.
func (HumanCodeExchangeMigrationSource) Load ¶
func (s HumanCodeExchangeMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load returns immutable forward history without IO, bootstrap or implicit adoption. Missing/invalid bases, conflicting versions and cancellation deny.
type MigrationSource ¶
type MigrationSource struct {
Schema string
Version migrations.Version
}
MigrationSource supplies one forward-only, transactionally installed OAuth namespace in the application's existing migration history. Schema must be an unoccupied dedicated lowercase namespace; Version is a permanent allocation in 1..MaxInt64. Existing objects fail rather than being silently adopted. No device, OIDC or organization schema is required by this base profile. Load performs no IO, returns independently owned data and is concurrent-safe.
func (MigrationSource) Load ¶
func (s MigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load preserves cancellation and rejects invalid names/allocations. No down migration is supplied: durable grants cannot safely be erased by rollback.
type PairwiseMigrationSource ¶
type PairwiseMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
PairwiseMigrationSource appends durable subject-key custody and stable native bindings. Install before selecting registered pairwise clients. Bindings and retired key-version tombstones have no down migration: deletion could reassign an RP identity on later key rotation. Base must include the OAuth grant schema.
func (PairwiseMigrationSource) Load ¶
func (s PairwiseMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type ProfileUserInfoConfig ¶
type ProfileUserInfoConfig struct {
AttributeSchemas []identity.AttributeSchema
ProfileSchema kernel.ProfileSchemaRef
}
ProfileUserInfoConfig selects an exact existing identity profile schema from the same borrowed primary pool. NewStore freezes AttributeSchemas through the public identity repository and inherits the protocol/caller read budget. This configuration is neither consent nor permission to rewrite stored schemas. No callback, raw identity-table reader, migration or background work is added.
func (ProfileUserInfoConfig) Format ¶
func (ProfileUserInfoConfig) Format(f fmt.State, _ rune)
Format prevents private schema defaults from entering diagnostics.
func (ProfileUserInfoConfig) MarshalJSON ¶
func (ProfileUserInfoConfig) MarshalJSON() ([]byte, error)
MarshalJSON rejects implicit disclosure of caller-owned schema defaults.
func (ProfileUserInfoConfig) MarshalText ¶
func (ProfileUserInfoConfig) MarshalText() ([]byte, error)
MarshalText rejects implicit disclosure of caller-owned schema defaults.
type RecoveryRequest ¶
type RecoveryRequest struct {
OperationID string
CommandID identity.CommandID
ClientID string
TenantID identity.TenantID
Session auth.BearerCredential
Token string
ClientAuthentication oauth.ClientAuthentication
// ConsentID selects only the original consent-delete/update record. It must be
// empty for other variants and conveys no authority without exact original
// current browser, tenant/client and authenticated retained preparation.
ConsentID string
}
RecoveryRequest identifies one original command, never a new execution. OperationID is a selected canonical OAuth or own-consent mutation operation. Authorize requires the original current browser and tenant, with Token empty; continue additionally requires its original continuation. Token/revoke require the original client-bound protocol bearer and configured client authentication, with Session/TenantID empty. Browser operations accept no client credentials. Initial configured-workload token issuance has no incoming bearer: Token must be empty and the original command is authenticated against retained encrypted preparation using the owning client's Basic custody and trusted configuration. Workload exchange additionally requires its original source access token; encrypted preparation binds the original independent command and exact intent. No user, actor, scope, timestamp, redirect or command override is accepted. Session, Token and ClientAuthentication are borrowed secret custody; never log or serialize them.
func (RecoveryRequest) Format ¶
func (RecoveryRequest) Format(s fmt.State, _ rune)
Format redacts original bearer custody and correlated command scope.
func (RecoveryRequest) MarshalJSON ¶
func (RecoveryRequest) MarshalJSON() ([]byte, error)
MarshalJSON denies implicit credential export.
func (RecoveryRequest) MarshalText ¶
func (RecoveryRequest) MarshalText() ([]byte, error)
MarshalText denies implicit credential export.
type RecoveryResult ¶
type RecoveryResult struct {
Outcome identity.CommitOutcome
CommandID identity.CommandID
RetryAfter time.Duration
}
RecoveryResult contains only historical durability and bounded retry metadata. It contains no redirect, code, token, source identity or renewed permission. Unknown and live pending never prove rollback. Even committed recovery cannot redeliver an original credential or authorize another issuance.
type SigningMigrationSource ¶
type SigningMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
SigningMigrationSource appends the selected public-key lifecycle, never private custody. Install before composing OIDC signing. Retired/compromised rows are permanent kid tombstones; rollback must not erase overlap history.
func (SigningMigrationSource) Load ¶
func (s SigningMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements the public OAuth execution seam through the existing sole identity coordinator. It owns no pool, transaction, journal, goroutine or private authentication engine. Each invocation owns one comparable native participant and encrypted preparation. Immutable configuration is safe for concurrent callers; requests remain borrowed until their bounded call returns.
func NewStore ¶
NewStore validates and freezes native composition without IO or generation. Unsupported session profiles and missing current counter/lockout owners deny; no caller-written domain store, Work, coordinator or phase hook is accepted.
func (*Store) ActivateSigningKey ¶
func (*Store) ActivateSubjectKey ¶
func (s *Store) ActivateSubjectKey(ctx context.Context, policyID string, policyVersion uint64, keyVersion uint32) error
ActivateSubjectKey selects a staged, unretired writer. Existing durable subjects are never changed. Selection/retirement/rewrap serialize on the same policy row before reading key predicates, including after a lock wait.
func (*Store) AuthenticateCurrentClient ¶
func (s *Store) AuthenticateCurrentClient(ctx context.Context, c oauth.Client, a oauth.ClientAuthentication) error
AuthenticateCurrentClient verifies the registered none/Basic class after primary status/version admission. It never authenticates a human manager.
func (*Store) Authorize ¶
func (s *Store) Authorize(ctx context.Context, c oauth.AuthorizationCommand) (oauth.AuthorizeResult, error)
Authorize creates a browser-bound consent interaction, or a selected silent code after independently checking original bounded explicit approval. It authenticates sealed GetResult custody again and rechecks every current owner inside native preparation/apply/final commit. It never issues or replaces a local session.
func (*Store) BootstrapHumanCodeExchangeClient ¶
func (s *Store) BootstrapHumanCodeExchangeClient(ctx context.Context, r oauth.IntrospectRequest) error
BootstrapHumanCodeExchangeClient explicitly initializes the selected native per-registration client authority from an actual S256-derived access source and its owning Basic client. It accepts no asserted tenant/version/epoch. This is trusted installation/bootstrap, never an HTTP endpoint or an implicit issuance/read side effect. Install the forward history first. Repeating an existing epoch1 is idempotent; any advanced epoch denies and is never repaired. A commit acknowledgement failure returns Unavailable; retry re-observes the sole public authority row. No token, journal, source grant or permission is created or changed. Pool/key lifetimes remain borrowed and concurrent use safe.
func (*Store) ClientGet ¶
func (s *Store) ClientGet(ctx context.Context, e oauth.ClientReadExecution) (out oauth.ClientGetResult, err error)
ClientGet authenticates an actual current native human session and exact platform policy for one active safe registration. It has no mutation effects.
func (*Store) ClientList ¶
func (s *Store) ClientList(ctx context.Context, e oauth.ClientReadExecution) (out oauth.ClientListResult, err error)
ClientList authenticates each bounded native page afresh. Scoped cursors are not authorization, and failures never disclose a partial page or continuation.
func (*Store) CompromiseSigningKey ¶
func (*Store) ConsentDelete ¶
func (s *Store) ConsentDelete(ctx context.Context, c oauth.ConsentExecution) (out oauth.ConsentDeleteResult, err error)
ConsentDelete establishes one atomic consent-generation withdrawal, not an unbounded grant/artifact mutation. The same Work serializes approval/refresh admission against the root and persists its actual receipt, audit and primary consent.revoked.v1 event. Retry/recovery never redelivers bearer material.
func (*Store) ConsentGet ¶
func (s *Store) ConsentGet(ctx context.Context, c oauth.ConsentExecution) (out oauth.ConsentGetResult, err error)
ConsentGet reads only the genuine current session owner's approved row. Missing/foreign/revoked targets disclose no metadata; outages never become empty successful reads. Original admission cannot be renewed by final reads.
func (*Store) ConsentList ¶
func (s *Store) ConsentList(ctx context.Context, c oauth.ConsentExecution) (out oauth.ConsentListResult, err error)
ConsentList is a bounded own-subject keyset read. A cursor is authenticated to this exact tenant/user/limit and carries no credentials or new read freshness. Pages are not snapshots: inserts/reconfirmations between calls may change them.
func (*Store) ConsentUpdate ¶
func (s *Store) ConsentUpdate(ctx context.Context, c oauth.ConsentUpdateExecution) (out oauth.ConsentUpdateResult, err error)
ConsentUpdate retains original input in the kernel's existing immutable request-key mapping, then uses the sole coordinator's normal prepared Work. The mapping is correlation only: original session custody is authenticated before resolving it and again before mutation/recovery. No credentials return.
func (*Store) Continue ¶
func (s *Store) Continue(ctx context.Context, c oauth.ContinuationCommand) (oauth.AuthorizeResult, error)
Continue consumes only the originally issued interaction with its current browser/session and synchronizer. Selected OIDC freshness may adopt a genuine newly authenticated same-user session while fencing the original source too. Explicit denial remains a protected one-use transition; earlier consent never silently approves a new request.
func (*Store) CurrentClient ¶
CurrentClient resolves only the server-reserved namespace from actual primary state. Missing/tombstoned IDs never fall back to static registrations.
func (*Store) DeviceStore ¶
func (s *Store) DeviceStore(c DeviceConfig) (*DeviceStore, error)
DeviceStore selects the unbound, OAuth-only recent-password-human device profile. Ordinary NewStore/NewService remain device-free. Core consent management is required; workload/OIDC device variants are explicitly denied, never implemented by fake redirect/code exchanges or downgraded MFA sessions.
func (*Store) EndSession ¶
func (s *Store) EndSession(ctx context.Context, e oauth.EndSessionExecution) (out oauth.EndSessionResult, err error)
EndSession binds a verified, durably issued hint to its exact initiating browser. Fresh invalidation uses the existing sole coordinator and session effect. Repeats reconcile the original encrypted command without authenticating a self-revoked cookie as a current session or renewing its delivery deadline.
func (*Store) EndSessionSelected ¶
EndSessionSelected reports immutable explicit composition only; no IO, migration, signing publication or endpoint activation occurs here.
func (*Store) HumanCodeExchangeClientAuthority ¶
func (s *Store) HumanCodeExchangeClientAuthority(ctx context.Context, r oauth.IntrospectRequest) (authority.AuthorityRecord, error)
HumanCodeExchangeClientAuthority locates the real current public authority record for the selected source's actual tenant and registered client version. Owning Basic and a genuine active S256-derived source are required. A refreshed source additionally requires AllowRefreshIssuedAccess and native provenance. It accepts no subject hash, asserted version or tenant; consumers never copy the private derivation. An advanced epoch remains readable, not reset or authorized anew. Use the returned Scope/Version with authorization/postgres.AdvanceAuthority in the existing authorized owner's transaction and audit workflow to withdraw this registration's delegation. This projection grants no mutation permission or freshness lease, initializes nothing and reveals no bearer. Missing scopes and dependency failures deny with zero metadata. Calls are bounded and safe concurrently while the borrowed pool and keys remain alive.
func (*Store) InstallSubjectKey ¶
func (s *Store) InstallSubjectKey(ctx context.Context, registration oauth.OIDCSubjectKeyRegistration) error
InstallSubjectKey authenticates and durably stages exact versioned encrypted HMAC custody for a configured pairwise policy. The same material/version may be explicitly rewrapped; different material or a retired version never may. It does not activate writers. Deployment callers supply configuration only, never end-user/HTTP authority. At most eight unretired versions are retained.
func (*Store) Introspect ¶
func (s *Store) Introspect(ctx context.Context, c oauth.IntrospectionCommand) (out oauth.IntrospectResult, err error)
Introspect reads an actual opaque token for its separately authenticated, owning confidential client. It is opt-in, bounded, uncached and read-only. Current original directory/user/identifier/credential/authorization expectations match code/refresh admission; ordinary browser logout does not revoke an approved OAuth grant. No source session is authenticated or issued here. Unknown/foreign/inactive/withdrawn tokens return only false; dependency failures and cancellation deny with zero metadata. Explicit machine grants instead check their frozen directory/workload authorization epochs, not a fabricated user/session. Token hints never constrain lookup.
func (*Store) ManageClient ¶
func (s *Store) ManageClient(ctx context.Context, c oauth.ClientManagementExecution) (out oauth.ClientManagementResult, err error)
ManageClient authenticates the original manager and exact platform policy, then uses the existing immutable prepared request-key owner and sole Work. Generated secret custody exists only in encrypted native preparation and the fresh known-committed invocation; durable client authentication is digest-only.
func (*Store) MarshalJSON ¶
MarshalJSON denies runtime custody export.
func (*Store) MarshalText ¶
MarshalText denies runtime custody export.
func (*Store) PublishSigningKeys ¶
PublishSigningKeys durably publishes every registered key before projecting its public bytes. An unknown acknowledgement must not activate a new key; repeat this idempotent publication before activation. Private members cannot enter the table or public projection. No positive JWKS cache is maintained.
func (*Store) Recover ¶
func (s *Store) Recover(ctx context.Context, request RecoveryRequest) (out RecoveryResult, err error)
Recover authenticates original browser/grant custody and delegates solely to the existing coordinator's current-policy metadata reconciliation. It does not reserve, execute, generate, refresh admission or reveal retained output. Initial authorization authenticates its original encrypted preparation before disclosure because a random command ID alone does not prove client/session binding. Retain original keys/configuration and preparation history until recovery is retired. Missing/foreign custody denies; outages fail closed. Concurrent calls use independent native participants; earlier deadlines win.
func (*Store) RegisterSigningKey ¶
RegisterSigningKey binds an immutable kid to public material idempotently. Existing retired/compromised identities can never be installed again. These deployment-authorized key operations accept no untrusted request/actor input.
func (*Store) ReserveSigningKey ¶
ReserveSigningKey atomically retains the greatest possible ID-token expiry under the current published selection. It is conservative on token rollback, timeout or restart; no retry resets an expiry or re-creates a token.
func (*Store) RetireSigningKey ¶
func (*Store) RetireSubjectKey ¶
func (s *Store) RetireSubjectKey(ctx context.Context, policyID string, policyVersion uint64, keyVersion uint32) error
RetireSubjectKey drops inactive encrypted custody but retains its immutable version/material tombstone and all stable subject bindings. Active writers cannot retire. Native authorization Work holds the selection share lock until commit, so no pending first-binding operation can cross custody retirement. Existing grants need only stored subjects, never old derivation material.
func (*Store) Revoke ¶
func (s *Store) Revoke(ctx context.Context, c oauth.RevocationCommand) (out oauth.RevokeResult, err error)
Revoke authenticates the registered none/Basic method before token-bound revocation (RFC7009 sections2.1/5), including unknown-token no-ops. Unknown and foreign tokens are indistinguishable successful no-ops. Access revocation affects only that access record; refresh revokes its related grant, never another client/root family. The token hint is advisory, not authority.
func (*Store) RotateClientSecret ¶
func (s *Store) RotateClientSecret(ctx context.Context, e oauth.ClientSecretRotationExecution) (out oauth.ClientSecretRotationResult, err error)
RotateClientSecret uses the existing immutable encrypted request preparation, manager authority and sole coordinator Work. Secret changes advance the same oauth_client dimension as revocation (LIFECYCLE_CASCADES.md), so no old grant or consent survives merely because its Basic secret has bounded overlap.
func (*Store) SubjectKeyRegistrations ¶
func (s *Store) SubjectKeyRegistrations(ctx context.Context, policyID string, policyVersion uint64) ([]oauth.OIDCSubjectKeyRegistration, uint32, error)
SubjectKeyRegistrations returns one statement-consistent, independently owned snapshot of at most eight unretired encrypted keys and the active writer. Reconstruct the child with its public NewSubjectPolicy constructor and the existing envelope provider. Retired ciphertext is never returned. A concurrent later selection change may make this snapshot stale; native Authorize still fences the actual current writer rather than trusting this read as authority.
func (*Store) Token ¶
func (s *Store) Token(ctx context.Context, c oauth.TokenCommand) (out oauth.TokenResult, err error)
Token verifies the configured none/Basic client method before admitting a client-bound code/S256 or refresh bearer. Subject, tenant and root credential/policy epochs are loaded only from the original native grant; no browser cookie, request actor or token claim can replace them. A correct proof replay revokes only its related grant/family and returns invalid_grant.
func (*Store) UpdateClient ¶
func (s *Store) UpdateClient(ctx context.Context, e oauth.ClientUpdateExecution) (out oauth.ClientUpdateResult, err error)
UpdateClient uses original native request-key/encrypted preparation and sole Work. Only registration authority advances; both digest slots/generations and the predecessor's original exclusive expiry remain unchanged. Existing grants and consent are fenced by that advanced registration authority.
func (*Store) UserInfo ¶
func (s *Store) UserInfo(ctx context.Context, c oauth.UserInfoCommand) (out oauth.OIDCClaimsInput, err error)
UserInfo admits only a genuine current access artifact for its registered human client. Both primary OAuth reads fence the same original authority read; neither this projection nor the child may turn it into a positive cache.
func (*Store) VerificationSigningKey ¶
func (s *Store) VerificationSigningKey(ctx context.Context, kid string) (oauth.PublicSigningKey, error)
VerificationSigningKey reads retained public verification custody without publishing or activating anything. RP-Initiated Logout permits expired hints; last_expiry therefore does not discard retired material. Registered (never published), compromised, foreign and unavailable material fail closed.
type WorkloadAuthorityConfig ¶
type WorkloadAuthorityConfig struct{ GlobalAuthorityID, PolicyNamespace string }
WorkloadAuthorityConfig selects exact existing directory and authorization owner namespaces. Subject IDs must be unique across machine identities in this trusted namespace. It creates no authority row, credential or policy. Required when configured or managed workloads are selected; zero retains the prior web profile.
type WorkloadExchangeMigrationSource ¶
type WorkloadExchangeMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
WorkloadExchangeMigrationSource appends forward opaque-access lineage after WorkloadMigrationSource and any selected ConsentExpiryMigrationSource. The exchange suffix must be last: later consent-expiry activation is rejected before migration. Existing rows stay nonexchange roots. Install during an exclusive schema window, retire unaware writers, initialize each selected client's independent authorization epoch to its registration Version, then opt into exchange. Old roots lacking that epoch cannot be silently adopted. No down migration erases history; base/unselected construction needs no suffix.
func (WorkloadExchangeMigrationSource) Load ¶
func (s WorkloadExchangeMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load returns owned forward-only history without IO or implicit schema adoption.
type WorkloadMigrationSource ¶
type WorkloadMigrationSource struct {
Base migrations.Source
Schema string
Version migrations.Version
}
WorkloadMigrationSource appends typed machine grants to the installed OAuth history without changing published migration bytes. Base must include this schema's MigrationSource and Version must follow every Base version. Apply before selecting any Workload client; unchanged web-only composition does not require this extension. The migration preserves all existing human lineage.
ALTER constraints/generated columns and the typed-reference unique index need an exclusive schema migration window and table/index/WAL headroom. This is a referential-integrity index, not a query-performance optimization. Do not run concurrently with issuance. No down migration erases durable grant history.
func (WorkloadMigrationSource) Load ¶
func (s WorkloadMigrationSource) Load(ctx context.Context) ([]migrations.Migration, error)
Load returns owned forward history; no IO, migration or adoption occurs. Nil/zero inputs, non-successor versions and cancellation fail closed.
Source Files
¶
- client_authentication.go
- client_management.go
- client_migrations.go
- client_public_migrations.go
- client_read.go
- client_registry.go
- client_rotation.go
- client_rotation_migrations.go
- client_update.go
- client_update_migrations.go
- config.go
- consent.go
- consent_expiry_migrations.go
- consent_migrations.go
- consent_update.go
- device_config.go
- device_migrations.go
- device_store.go
- exchange.go
- exchange_migrations.go
- fresh_authentication.go
- human_exchange.go
- human_exchange_migrations.go
- human_refresh_exchange.go
- introspection.go
- logout.go
- logout_migrations.go
- migrations.go
- mutation.go
- oidc.go
- oidc_email.go
- oidc_profile.go
- pairwise_migrations.go
- phase.go
- recovery.go
- resource.go
- signing.go
- signing_migrations.go
- silent.go
- store.go
- subject_bindings.go
- subject_keys.go
- workload.go
- workload_migrations.go