Skip to content

Options reference

Every public op.With* option, grouped by what it touches. The first four are constructor-required; everything else is optional and refines the defaults.

How to read this page

Click the option name for the deep-dive page. The "Section" column tells you which discovery / endpoint surface the option moves. "Default" is empty when the option has no built-in default — supplying it is the only way to enable the behaviour.

Required (the four op.New refuses to start without)

OptionValueSectionDefault
WithIssuerstringdiscovery issuer, JWT iss, cookie scope
WithStoreop.Storeevery persistent substore
WithKeysetop.Keyset (P-256 / ES256)JWKS, JWS signing
WithCookieKey / WithCookieKeys32-byte key(s)session / CSRF cookie AES-256-GCM

Profile, features, grants

OptionValueSectionDefault
WithProfileprofile.Profileactivates a security profile in one switch (FAPI 2.0 Baseline / Message Signing)none
WithFeaturefeature.Flag (one per call; repeatable)enables PAR / DPoP / mTLS / JAR / introspect / revoke individuallyconservative defaults
WithGrants...grant.Type (variadic)restricts the grant types accepted at /tokenauthorization_code, refresh_token
WithScopeop.Scope (one per call; use the op.PublicScope / op.InternalScope constructors)extends the scope catalogopenid, profile, email, offline_access
WithOpenIDScopeOptional(no args)makes pure-OAuth2 (scope without openid) acceptablerequired
WithStrictOfflineAccess(no args)gates refresh_token issuance behind explicit offline_access consentlax (refresh on any openid grant)

Clients & registration

OptionValueSectionDefault
WithStaticClients...op.ClientSeed (use op.PublicClient / op.ConfidentialClient / op.PrivateKeyJWTClient)seeds the client registry at bootempty
WithFirstPartyClients...string (client IDs)grants first-party consent skipnone
WithDynamicRegistrationop.RegistrationOptionmounts /register (RFC 7591/7592)disabled

Authentication & login flow

OptionValueSectionDefault
WithLoginFlowop.LoginFlowdeclarative DAG of Step + Rule (recommended)none
WithAuthenticators...op.Authenticator (variadic)low-level seam (mutually exclusive with WithLoginFlow)none
WithInteractioninteraction.Driverswaps the entire interaction transport (HTML driver / SPA driver / custom)bundled HTML driver
WithInteractions...op.Interaction (variadic)non-credential prompts (T&C, KYC) layered on top of the driverconsent only
WithCaptchaVerifierop.CaptchaVerifierupstream captcha provider for StepCaptchanone
WithRiskAssessorop.RiskAssessorfeeds RuleRisk and LoginContext.RiskScorenone
WithLoginAttemptObserverop.LoginAttemptObservercounts failed attempts for RuleAfterFailedAttemptsnone
WithMFAEncryptionKey / WithMFAEncryptionKeys32-byte key(s)AES-256-GCM seal of TOTP secrets at restnone
WithPasskeyAttestation(preference string, aaguids []string) ("none" or "direct")WebAuthn attestation conveyance + AAGUID allowlist"none"
WithACRPolicyop.ACRPolicy (interface)step-up acr/aal mappingidentity

UI

OptionValueSectionDefault
WithSPAUIop.SPAUI (struct: LoginMount / ConsentMount / LogoutMount / StaticDir)swaps default HTML driver for SPA-driven JSON (any framework)HTML
WithConsentUIop.ConsentUI (wraps a *html/template.Template)overrides default consent pagebundled
WithChooserUIop.ChooserUI (wraps a *html/template.Template)overrides multi-account selectorbundled
WithCORSOrigins...stringstrict-CORS allowlist (auto-derived from redirect URIs if omitted)derived
WithDefaultLocaleop.Locale (BCP 47 tag)default UI locale when the request carries no ui_locales"en"
WithLocaleop.LocaleBundle (one per call; repeatable)registers a per-locale message bundle for the consent / chooser UIEnglish only

Tokens

OptionValueSectionDefault
WithAccessTokenFormatop.AccessTokenFormat (AccessTokenFormatJWT / AccessTokenFormatOpaque)JWT vs opaque, OP-wideJWT
WithAccessTokenFormatPerAudiencemap[string]op.AccessTokenFormat (RFC 8707 resource → format)mixed format by audienceOP-wide value
WithAccessTokenRevocationStrategyop.AccessTokenRevocationStrategy (RevocationStrategyGrantTombstone / RevocationStrategyJTIRegistry / RevocationStrategyNone)revocation policy for issued JWT access tokensgrant tombstone
WithAccessTokenTTLtime.Durationaccess token lifetime5 min
WithRefreshTokenTTLtime.Durationrefresh token lifetime (non-offline)30 days
WithRefreshTokenOfflineTTLtime.Durationrefresh token lifetime when offline_access granted90 days
WithRefreshGracePeriodtime.Duration (or -1 to disable)rotation grace window60 s
WithDPoPNonceSourceop.DPoPNonceSource (interface)server-supplied DPoP nonce store (op.NewInMemoryDPoPNonceSource provides one)none

Discovery & endpoints

OptionValueSectionDefault
WithEndpointsop.Endpoints (struct: per-endpoint path overrides)overrides default endpoint pathsspec defaults
WithMountPrefixstring (must start with /; pass / for root)embeds an issuer-relative path prefix/oidc
WithClaimsSupported...string (variadic)populates claims_supported in discoveryderived
WithClaimsParameterSupportedbooltoggles claims_parameter_supportedfalse
WithJWKSRotationActivefunc() boolpredicate that flips JWKS Cache-Control to short-cache during a rotation windowalways long-cache

mTLS / proxy / network

OptionValueSectionDefault
WithMTLSProxy(headerName string, trustedCIDRs []string)header-based mTLS termination at edgenone
WithTrustedProxies...string (CIDRs)resolves X-Forwarded-* / Forwarded to real client IPnone
WithAllowLocalhostLoopback(no args)accepts http://127.0.0.1 issuer in devstrict (HTTPS only)
WithAllowPrivateNetworkJWKS(no args)permits client JWKS hosted on RFC 1918 (test only)denied
WithAllowPrivateNetworkJAR(no args)permits request_uri hosted on RFC 1918 (test only)denied
WithBackchannelAllowPrivateNetworkboolpermits backchannel_logout_uri on RFC 1918 (test only)false
WithBackchannelLogoutHTTPClient*http.ClientHTTP client for back-channel logout fan-outdefault
WithBackchannelLogoutTimeouttime.Durationper-RP fan-out timeout5 s

Observability

OptionValueSectionDefault
WithLogger*slog.Loggerstructured operational log sink (handler is wrapped with the redaction middleware)discard
WithAuditLogger*slog.Loggerdedicated audit-event log sinkinherits WithLogger
WithPrometheus*prometheus.Registryregisters OP counters on caller's registry (no /metrics mounted)none

Operational posture

OptionValueSectionDefault
WithSessionDurabilityPostureop.SessionDurabilityPostureannotates back-channel logout audit events for SOCvolatile
WithClockop.Clocktime source (test injection)time.Now

What you do not configure here

These are deliberate non-options — see the linked design rationale for why each is fixed:

  • JOSE algorithm allow-list — fixed at RS256 / PS256 / ES256 / EdDSA. No flag widens it. See Security posture §2.
  • PKCE methodS256 only. plain is structurally rejected.
  • Cookie scheme__Host- prefix, AES-256-GCM, double-submit CSRF always on. See Required options §WithCookieKey.
  • Random sourcecrypto/rand only; math/rand is forbidden by lint.
  • /metrics mounting — your router's job, not the library's. See Use case: Prometheus metrics.

Verifying this list

The catalog is grepped from the live source. To audit:

sh
git clone https://github.com/libraz/go-oidc-provider.git
cd go-oidc-provider
grep -rhE '^func With[A-Z]' op/options.go op/options_authn.go \
  op/options_protocol.go op/options_fapi_proxy.go op/registration.go \
  op/access_token_revocation.go op/i18n.go \
  | sort -u

The shape (function name + receiver + first parameter type) is the canonical reference; the godoc on each function is the authoritative contract.