Configuration for the attesto_phoenix authorization-server layer.
This is the single source of truth consumed by every controller and plug in
the library. It reads the host's configuration (from a host-chosen
otp_app/config key), validates the required keys, applies neutral defaults,
and derives the Attesto.Config the protocol layer needs.
Controller actions resolve the already validated request configuration with
resolve!/1, which reads %AttestoPhoenix.Config{} from
conn.private[:attesto_phoenix_config]. The zero-argument resolve!/0
remains available for non-request code that intentionally reads the global
application configuration.
Build one with new/1 (from a keyword list or map) or from_otp_app/2 (to
read Application.get_env/2). Validation raises ArgumentError on a missing
required key so misconfiguration fails fast at boot.
Keys
Required
:issuer- absolute HTTPS issuer URL (string, with no query or fragment) used as the JWTiss, the discovery issuer, and the base for endpoint URLs. The bundled router's root well-known routes require an origin-only issuer; a path-bearing issuer requires standards-derived well-known routes mounted by the host. Derived endpoint URLs are resolved against the issuer origin: an issuer path is not prepended to the resolved endpoint paths, so a path-bearing issuer must also set:oauth_path_prefix(or the per-endpoint path overrides) to advertise its endpoints under that path.:keystore- module implementingAttesto.Keystoreproviding the signing key and the verification keys published via JWKS. Use a static keystore or a host KMS/HSM/Vault-backed implementation; per-keyalgmetadata is supported by the core keystore behaviour.:vc_keystore- the keystore used to sign issued Verifiable Credentials; defaults to:keystore. Configure a separate EC/ES256 keystore here to issue ES256-signed credentials (e.g. for HAIP) while ID tokens keep their own signing key.:verifier_encryption_keystore- retained for configuration compatibility. Presentation requests generate and persist a fresh P-256 recipient key per session for bothdirect_post.jwtanddc_api.jwt; this setting is not used by that path.:credential_encryption_keystore- optionalAttesto.Keystoremodule providing EC P-256 keys (signing_pem/0andverification_pems/0) for OID4VCI Credential Request and Credential Response encryption (§8.2, §10, §12.2.4). Must be distinct from, and not share key material with, the token-signing:keystore. When configured, the issuer metadata advertises bothcredential_request_encryptionandcredential_response_encryption, decryptsapplication/jwtcredential and deferred credential requests, and encryptsapplication/jwtresponses when requested.:credential_encryption_required- boolean (defaultfalse) controllingencryption_requiredin the advertised OID4VCI encryption metadata and requiring encryptedapplication/jwtrequests withcredential_response_encryption. May betrueonly when:credential_encryption_keystoreis configured.:cors_origins- which origins receive CORS response headers (RFC 10017 §6.3.3.4) from the metadata, JWKS, token, PAR, revocation, introspection, registration, UserInfo, credential and verifier endpoints.:*(the default) sendsAccess-Control-Allow-Origin: *. A non-empty list of origins, or a one-arity predicate receiving the requestOrigin, echoes a matching origin and addsVary: origin.falsesends no CORS headers.Access-Control-Allow-Credentialsis never sent, and the authorization, device verification, end-session and check-session endpoints never receive CORS headers.:identity_chaining- keyword options for issuing a JWT authorization grant to another authorization server from token exchange (draft-ietf-oauth-identity-chaining-17). Off by default.:enabled-trueto turn it on.:allowed_audiences- the issuer identifiers a grant may be minted for. Required when:enabledistrue, unless:authorize_targetis set.:authorize_target- optional callback receiving the client, the requested target, the requested resources and the subject token's claims. Return:ok, or{:ok, target}to substitute the target; any other result refuses the request withinvalid_target.:requested_token_types- therequested_token_typevalues accepted, fromurn:ietf:params:oauth:token-type:jwt(the default) andurn:ietf:params:oauth:token-type:id-jag. A request that omits the parameter and names an allowed audience inaudienceorresourcegets the first.:assertion_lifetime_seconds- maximum grant lifetime, default60; a grant never outlives the subject token.
:repo-Ecto.Repomodule used by the Ecto-backed code, refresh, nonce, and replay stores.:load_client-(client_id -> {:ok, client} | {:error, :not_found} | {:error, :revoked}). Resolves an OAuth client. The host owns the client registry and revocation policy.:verify_client_secret-(client, presented_secret -> boolean). Constant-time client-secret verification (e.g. viaAttesto.SecureCompare). The host owns secret hashing.:verify_dummy_client_secret- optional(presented_secret -> boolean)callback that performs the same fixed password-hash work for an unknown, revoked, or wrong-method client. Its return value is ignored. Configure this when:verify_client_secretaccepts only the host client type. The legacy:unknown_clientargument remains as a compatibility fallback through 5.x and will be removed in AttestoPhoenix 6.0.:load_principal-(subject_id -> {:ok, principal} | {:error, :not_found}). Resolves the subject/principal during protected-resource authentication.
Optional callbacks
Every callback key (required or optional) accepts a function, a
{module, function} tuple, or a {module, function, extra_args} tuple. In
the 3-tuple form, AttestoPhoenix.Callback.invoke/2 appends extra_args
after the per-call arguments (apply(module, function, call_args ++ extra_args)).
:client_auth_method-(client -> method | {:ok, method}). Returns the client's registeredtoken_endpoint_auth_methodas a string or atom from trusted registry data. Required for host-owned confidential clients. The presented method must match exactly, including Basic versus POST. Unknown or malformed callback results fail authentication; they never fall back to another method. Without this callback, confidential clients fail authentication; explicitly public clients may usenone. CIMD clients use their validated metadata document's declared method.:client_auth_method_validation-:runtime(default) or:boot. The boot policy rejects configuration advertising Basic or POST secret authentication without a trusted registered-method callback.:client_secret_auth_method_policy-:strict(default) or:observe. Observation permits only Basic/POST transport differences for a client registered for one of those secret methods, while emitting mismatch telemetry. Key, certificate, attestation, and public-client differences remain rejected. Use this temporary policy to measure a migration.:bind_unbound_refresh_families-:reject(default) or:configured_issuer. The compatibility policy is an operator assertion that the store belongs to exactly one issuer. It uses the configured issuer, never a presented token, to migrate legacy unbound families during a rolling upgrade. Existing bindings and attestation keys remain enforced. Return to:rejectafter legacy token writers are retired.:authorize_scope-(client, requested_scope -> {:ok, granted_scope} | {:error, :invalid_scope}), or the three-argument form(client, requested_scope, resources -> {:ok, granted_scope} | {:error, :invalid_scope | :invalid_target}), which also receives the request's resolved RFC 8707 resource indicators and is used when the callback has that arity. Resources arrive validated and deduplicated, soresource=R&resource=Ris[R]. Validates or narrows requested scope. Defaults to requiring every requested scope to appear in the effective authorization-server scope catalog. The policy runs at the authorization endpoint, after request validation and before the resource owner is authenticated, and again at the token endpoint, with the same arguments. At the authorization endpoint a refusal is a redirectableinvalid_scopeorinvalid_target(RFC 6749 §4.1.2.1, RFC 8707 §2), underprompt=nonetoo, and a narrowed scope is what the consent step sees and the code is bound to.:authorize_subject_scope-(client, subject, scope, resources -> {:ok, narrowed_scope} | {:error, :invalid_scope | :invalid_target}). Optional principal policy, applied after authentication and freshness checks on every authorization pass, including resume, before consent.subjectis the authenticated map passed to consent. Scope is the effective scope already approved by:authorize_scope; resources is the resolved list (empty when absent). Resources arrive validated and deduplicated, soresource=R&resource=Ris[R]. The result must be a subset, even when the effective scope is empty. Consent sees the narrowed scope and the authorization code is bound to it. Return:invalid_targetto refuse resources outside the principal's ceiling. This policy does not replace token-endpoint:authorize_scopechecks.:on_event-(%AttestoPhoenix.Event{} -> any). Audit/telemetry hook. No-op by default; the library never stores events itself.:render_end_session_error-(conn, %AttestoPhoenix.OAuthError{} -> conn). Optional, validated at boot. Renders every non-redirecting end-session error (RP-Initiated Logout 1.0 §4). The error contains only the library's code, description, and HTTP status, never request parameters. The conn still contains untrusted input; do not echo it. Defaults to the existing HTML page or JSON response according to Accept.:render_authorization_error-(conn, %AttestoPhoenix.OAuthError{} -> conn). Optional. Renders every authorization-endpoint error that cannot be redirected: an unknown client, a missing, invalid or unregisteredredirect_uri, an unknown or expiredrequest_uri, a refused resume, a request over plain HTTP, a refused embedded user agent. RFC 6749 §4.1.2.1 says the server must not redirect in these cases and should inform the resource owner, so this page is the only thing the person sees. The error carries the OAuth code in:error(:invalid_requestor:invalid_request_uri), the library's own reason text in:error_description, andstatus: 400. It carries no request parameter: aclient_id,redirect_uriorstateon such a request is untrusted input, and a page that echoes one is how an attacker's text or link ends up on the server's origin. They are still onconn; do not render them. The callback must send the response and return the conn. Unset, the library renders its built-in page (HTML for a browser, JSON otherwise). If the callback returns anything other than a sent conn, the built-in page is rendered and the fault is logged.:send_error-(conn, status, body_map -> conn). Optional transport hook used byAttestoPhoenix.OAuthErrorto serialize OAuth/OIDC errors into the host's API envelope while preserving the RFC status, challenge, and cache-control semantics.:no_store-(conn -> conn). Optional transport hook used byAttestoPhoenix.OAuthErrorto apply no-store headers.:www_authenticate-(conn, challenge_string -> conn). Optional transport hook used byAttestoPhoenix.OAuthErrorto write theWWW-Authenticatechallenge header.:resource_metadata- absolute HTTPS URL (with no fragment) of this resource's protected-resource metadata document (RFC 9728). When set,AttestoPhoenix.Plug.Authenticateadvertises it as aresource_metadataauth-param on everyWWW-Authenticatechallenge it renders (RFC 9728 §5.1), so a client that is refused with 401 can discover which authorization server issues tokens for this resource. Omitted from the challenge when unset.:resource_metadata_resolver-(conn -> absolute_url | nil). Optional request-aware override for:resource_metadata. When configured, its result selects the RFC 9728 metadata URI for that protected-resource request; returningnildeliberately omits the auth-param. This lets one origin serve multiple resource identifiers without pointing every challenge at one global document. An invalid callback result is omitted rather than advertised. The resolver is consulted once per protected-resource request - including requests that authenticate successfully, because the selected URI must be in place before verification renders any challenge - so it should be fast and total. Exceptions raised by the resolver are not rescued and abort the request, successful ones included. When unset, the static:resource_metadatavalue retains its existing behavior. The callback is trusted configuration: return pinned or allowlisted metadata URLs and do not derive their authority from request Host, forwarded, query, or header values.:basic_realm- realm string for token-endpoint Basic auth challenges. Default"OAuth".:htu-(conn -> canonical_url_string). Overrides how the DPoPhtuis computed behind proxies, at the bundled endpoints and at every protected resource. Defaults to derivation from:trusted_proxies, and at protected resources to:resource_originwhen that is set. Mutually exclusive with:resource_origin. Build it from configured origins, not from request headers.:cert_der-(conn -> der_binary | nil). Deprecated compatibility alias for terminator-provided certificate extraction. It is invoked only when the adapter-reported immediate socket peer matches:trusted_proxies. Migrate header readers to:forwarded_cert_der. Direct TLS adapters expose the authenticated certificate throughPlug.Conn.get_peer_data/1and need no callback.:forwarded_cert_der-(conn -> der_binary | nil). Extracts a client certificate forwarded by a TLS terminator. Unlike:cert_der, this callback is invoked only when the immediate peer matches:trusted_proxies; an untrusted request can never make its certificate header authoritative. The terminator MUST remove any client-supplied copy of the header and replace it only after a successful client TLS handshake; the application listener SHOULD be network-reachable only from those trusted terminators.:client_certificate_chain_validated?-(conn, der -> boolean). Confirms that the TLS terminator validated the presented certificate's PKI chain, validity, and applicable revocation policy. Required fortls_client_auth; the self-signed method does not use PKI validation.:client_mtls_metadata-(client -> map | {:ok, map} | nil | {:error, reason}). Returns the client's RFC 8705 registration metadata, includingtoken_endpoint_auth_methodand exactly one PKI subject field fortls_client_auth. Returnnilonly when the client has no mTLS registration; errors and malformed results fail authentication closed. Forself_signed_tls_client_auth,:client_jwkssupplies the resolved JWK Set.:register_client-(metadata -> {:ok, client} | {:error, reason}). Persists a dynamically registered client. Required only when:registration_enabled. A refusal reaches the client as follows:{:error, {:unavailable, retry_after_seconds}}, for a host that limits registrations by count or rate, answers503withRetry-After;{:error, %AttestoPhoenix.OAuthError{}}with a 4xx status is sent as the host built it; any other{:error, reason}answers400 invalid_client_metadata(RFC 7591 §3.2.2) and the reason is not sent.:update_clientfollows the same rule. The registration response describes the client the callback returned when:client_registration_metadatais configured (see that key); the identifier, the plaintext credentials and the management URI always come from issuance.:unregister_client-(client -> :ok | {:ok, client} | {:error, reason}). Deletes a dynamically registered client for registration management cleanup (RFC 7592). Optional; when unset, DELETE requests to the registration management endpoint fail closed.:client_registration_access_token_hash-(client -> String.t() | nil). Extracts the stored hash of the registration access token issued with a dynamic client (RFC 7592). Optional; when unset, every request to the registration management endpoint fails closed.:client_registration_metadata-(client -> map). Returns the client's registered metadata as it was handed to:register_client(a string-keyed map). ServesGETon the registration management endpoint (RFC 7592 §2.1) and is the baseline an update is compared with. It is also how a registration or update response reports what was registered (RFC 7591 §3.2.1): the callback is applied to the client:register_clientor:update_clientreturned, so a host that narrows scopes or grant types answers with what it kept. Credential hashes in the map are never sent to the client. Optional; when unset,GETandPUTreturn405 Method Not Allowedto an authenticated client, and a registration response reports the validated request.:update_client-(client, metadata -> {:ok, client} | {:error, reason}). Replaces a dynamically registered client's metadata after a validatedPUTto the registration management endpoint (RFC 7592 §2.2).metadatais the complete new registration, validated by the rules a registration request is, withclient_idandclient_id_issued_at; the host replaces what it stored and keeps the credential hashes. Optional; when unset, an authenticatedPUTreturns405 Method Not Allowedwith the available methods inAllow.:introspection_authorize-(caller_client_id, response -> boolean). Authorizes the authenticated introspection caller against the token being introspected (RFC 7662 §4 / RFC 9701 §5). Consulted only for an active response; returning anything buttrue(or raising) downgrades the response to%{"active" => false}so a caller not entitled to the token learns nothing about it (FAPI: a regular client querying introspection is a leakage risk).responseis the RFC 7662 member map (carryingaud,client_id,sub,scope, ...), letting the host match the token's audience/scope against the calling protected resource. Optional - when unset, a caller may introspect only a token issued to it (client_id) or naming it inaud; every other caller getsactive: false. Set it when a protected resource introspects tokens audienced to a resource identifier that is not itsclient_id, for examplefn caller, response -> resources_served_by(caller) |> Enum.any?(&(&1 in List.wrap(response["aud"]))) end.:resource_indicators- RFC 8707 resource policy as[allowed_resources: [...], allowed_resources_for: callback, default_resources_for: callback]. Static entries are absolute resource URIs. The optional one-argument:allowed_resources_forcallback receives the original OAuth client and returns additional identifiers that client may target. The same policy governs issuance, introspection, and token-exchange subject-token verification.The optional two-argument
:default_resources_forcallback chooses the resources to bind when an authorization request names none. It receives the client and the effective scope, after the:authorize_scopedefault for an omitted scope (RFC 6749 §3.3), and returns a list of resource identifiers. It runs only when the request carries noresource, at the authorization endpoint (direct, pushed, or resumed requests), device authorization, and CIBA. Its result is checked exactly like a requestedresource: a malformed or unserved identifier isinvalid_target, so the callback cannot widen what a client may target.[]keeps the:audiencedefault. Use it for clients that never sendresource, such as MCP clients that skip RFC 8707, when each protected resource requires its own audience.A three-argument
:authorize_scopepolicy first decides without resources, as before; when a default is bound it is asked again with it and may only narrow, so the authorization and token endpoints agree. The default is chosen before the principal's:authorize_subject_scopenarrowing, which sees the bound resources. With the callback configured, device authorization and CIBA run:authorize_scopeat the request endpoint to find the effective scope of a request naming no resource. The callback runs on each resolution of a request (including a resumed interaction), so it should be deterministic. A client ID metadata document client is passed as its self-asserted metadata; decide from itsclient_idURL. Grants that takeresourceon the token request (client credentials, token exchange, jwt-bearer) do not use it.:native_apps- RFC 8252 (BCP 212) native-app profile options as[loopback_redirect: true, loopback_include_localhost: false, reject_embedded_user_agents: false].The profile as a whole is off until the host classifies a client with
:client_native?, which defaults tofalse. That callback — not anything here — is what keeps an unconfigured deployment byte-identical.:loopback_redirectis an opt-out, defaulting totrue. RFC 8252 §7.3 states the port allowance as a MUST, so it follows from a client being marked native: aredirect_uriofhttp://127.0.0.1/...orhttp://[::1]/...matches the registered URI on any port, while scheme, host, path, and query still compare exactly. Nothing else is relaxed —https, private-use schemes, remote hosts, and the hostnamelocalhost(§8.3 discourages it) all stay exact-match, as does every non-native client. Set itfalseto forbid the exception server-wide: an operator kill switch, or a deployment certifying against a profile that mandates exact redirect-URI matching (the OpenID Connect and FAPI profiles do). Such a deployment normally has no native clients to begin with, so the usual answer is simply not to mark any.:loopback_include_localhostis an opt-in, defaulting tofalse. It widens the §7.3 port allowance to the bare hostnamelocalhost, selectingAttesto.RedirectURI's:exact_allow_loopback_port_including_localhostmode wherever:exact_allow_loopback_portwould have been selected. §8.3 recommends the IP literal over the name, but its reasons are all about what the client binds and how the user's device resolves names - a server refusing the request changes none of them - and real native clients (Claude Code's published metadata document among them) register a portlesshttp://localhost/callbackand bind an ephemeral port, which no strict deployment can serve at all. The name stays a distinct host identity:localhostnever cross-matches127.0.0.1or[::1], and everything else about the exception keeps its exact-match discipline (seeAttesto.RedirectURIfor the full constraint list). It is subordinate to:loopback_redirect: when that kill switch isfalse, this option has no effect.:reject_embedded_user_agentsenables the RFC 8252 §8.12 recommendation that the authorization endpoint refuse requests made from an in-app webview, which the host application can use to observe the user's credentials. Detection is aUser-Agentheuristic (AttestoPhoenix.RequestContext.embedded_user_agent?/1) and therefore produces false positives, which is why it is opt-in and applies to every client rather than only native ones — the embedding app is not necessarily the OAuth client.The remaining RFC 8252 obligations (§8.1 PKCE, §8.4 client authentication) likewise follow from
:client_native?alone: they are strictly additional restrictions on a client the host has deliberately classified as native.:principal_kinds- non-empty list ofAttesto.PrincipalKindvalues or a zero-arity callback returning that list, passed into the core token configuration.:build_principal-(client, subject, scope -> map). Builds the principal map passed toAttesto.Token.mint/3. The returned:subMUST be namespaced with the matchingAttesto.PrincipalKindsub_prefix:Attesto.Tokenrejects an unprefixed subject at mint time (:invalid_sub). This matters most for theclient_credentialsgrant (RFC 6749 §4.4), where the principal subject is the OAuthclient_id- and Dynamic Client Registration (RFC 7591 §3.2.1) issues that id unprefixed (the host's:register_clientchooses it; the library imposes no namespace).:build_principalis the sole seam that applies the prefix; the prefix is mint-time defense-in-depth (an issued token'ssubis unambiguous across principal kinds), not a substitute for it. The protocol layer injects the authenticated OAuthclient_idclaim required by RFC 9068; the callback may omit it or return the same value, but a conflicting value fails issuance.:build_refresh_principal- optional(client, refresh_context -> map | {:error, :invalid_grant})live policy check for refresh grants. It receives the authenticated client plus the persisted issuer and subject, effective scope and resource, refresh family/generation, originalacr/auth_time, and authorization-sessionsession_id. Its returned principal is used without a second:build_principallookup; protocol-owned claims and the authenticatedclient_idare reconciled before minting. A deliberate denial revokes the refresh family before returning a genericinvalid_grant; use it to enforce subject lock/deactivation, session termination, and tenant membership at refresh time.:authorization_grant_id_claim- optional access-token claim name for a stable, opaque authorization-code family identifier. When configured, authorization-code and descendant refresh access tokens carry the authoritativefamily_id; all other grant types omit the claim. A code that carried no usablefamily_idis permanently ineligible: redemption may still create an internal refresh family, but neither its initial nor any refreshed access token carries the claim. Within access tokens the library owns the value and strips a host-supplied one before signing; ID Token and UserInfo callback output is host-owned and unfiltered. Disabled by default.:build_userinfo_claims-(subject, granted_scopes, requested_claims -> claims_map). Produces the claim values the UserInfo endpoint (OpenID Connect Core §5.3) returns for the authenticated subject. The host owns the claim source (its user store); the library owns only the scope-to-claim shaping (OpenID Connect Core §5.4) and the guarantee thatsubis present (OpenID Connect Core §5.3.2).granted_scopesis the list of scopes on the access token;requested_claimsis the per-claim request map from the OpenID Connectclaimsparameter (%{}when none). It may return{:error, :invalid_token}to refuse the subject, for example one disabled after the access token was minted; the endpoint then answers401with the RFC 6750 §3.1invalid_tokenchallenge. Required only when the UserInfo endpoint is mounted.:build_credential-(subject, credential_configuration_id, holder_jwk -> {:ok, credential} | {:error, reason}). Produces the format-specific claim material and optional validity window for the OID4VCI Credential endpoint. For SD-JWT VC and JWT VC, the library bindsholder_jwkascnf; for mdoc, it binds the key as the MSO device key. An optional integer:issued_atsets SD-JWT VC'siator mdoc MSO'svalidityInfo.signed; omission uses the issuance clock. For mdoc, the host must supply an integer:valid_untillater than:valid_from(which defaults to the issuance clock), with:issued_atno later than:valid_from. The library does not choose a validity period. The library signs the resulting credential. Required when credential issuance is mounted.:build_deferred_credential-(subject, transaction_id -> {:ok, deferred_credential} | {:error, :issuance_pending} | {:error, reason}). Completes a previously deferred credential (OID4VCI §9) for the Deferred Credential endpoint.deferred_credentialmust be%{credential_configuration_id: id, holder_jwk: public_jwk, credential: credential_result}. Persistholder_jwkandidwhen the original Credential request proves possession; the deferred endpoint has no fresh proof from which it could recover either value. The library validates the public key and issues the configured SD-JWT VC, JWT VC, or mdoc through the same holder-binding and signing path as immediate issuance.{:error, :issuance_pending}reports the OID4VCIissuance_pendingerror so the wallet retries later; any other error maps toinvalid_credential_request. Required only when the Deferred Credential endpoint is used.Security — this callback owns the ownership check. The library authenticates the caller's access token and passes you its verified
subject, but it does not (and cannot) know which subject atransaction_idbelongs to — deferred-issuance state lives in your store. You MUST resolve the transaction scoped tosubjectand return an error (not the credential) when thetransaction_idwas not issued to that subject. Resolving bytransaction_idalone is an IDOR: any authenticated wallet could poll another wallet'stransaction_idand receive that holder's credential. Additionally, mint thetransaction_idwith a CSPRNG (e.g.Attesto.Secret.generate/0, 256-bit) so it cannot be guessed or enumerated.:credential_configurations_supported- map of OID4VCI credential configuration identifiers to the configuration metadata advertised by the Credential Issuer Metadata endpoint. Required when credential issuance is mounted.:federation_authority_hints- non-empty list of superior OpenID Federation entity identifiers to include in this entity's signed Entity Configuration. Optional; the claim is omitted when unset.:federation_entity_metadata- map of OpenID Federation entity-type identifiers to their metadata. Optional; the claim is omitted from the signed Entity Configuration when unset.:status_list_store- module implementingAttesto.StatusListStore, the allocated-index storage for IETF Token Status List (RFC-to-be) credential-status lists. Required when the host mounts thestatus_list: trueroute; the endpoint answers 404 for a list it cannot resolve through this store.:build_id_token_claims-(client, subject, granted_scopes, requested_claims -> claims_map). Produces the host claims merged into an ID Token (OpenID Connect Core §3.1.3.6 / §5.5id_tokenmember). Distinct from:build_userinfo_claims: it receives the resolvedclient, draws from theclaimsparameter'sid_tokenmember, and MUST NOT carrysub(the library sets the verified subject; a host-suppliedsubis rejected byAttesto.IDToken). Optional - when unset the ID Token carries only the protocol claims.:client_id-(client -> String.t()). Extracts the OAuth client identifier from the host's client struct.:client_jwks-(client -> jwks). Returns the client's trusted public JWK Set forprivate_key_jwtclient authentication. Required only for clients that authenticate withprivate_key_jwt. If this callback dereferences a dynamically registeredjwks_uri, treat it as untrusted: reject redirects, screen DNS and the connected IP, pin the approved address, and enforce response size, time, and media-type limits. Ordinary DCR does not automatically use the SSRF guarded CIMD fetcher.:client_redirect_uris-(client -> [String.t()]). Returns the client's registered redirect URIs (RFC 6749 §3.1.2.2). The authorization endpoint exact-matches the requestredirect_uriagainst this set (RFC 6749 §3.1.2.3); a client exposing none rejects every authorization request (fail closed).:authenticate_resource_owner-(conn, request, auth_opts -> {:authenticated, subject} | {:halt, conn} | {:none} | {:error, :login_required | :consent_required | :interaction_required | :server_error | :temporarily_unavailable}). Establishes the resource owner for an authorization request (RFC 6749 §3.1, OIDC Core §3.1.2.3). Returns{:authenticated, subject}once a resource owner is known (a map carrying at least:subject, the OIDCsub, and optionally:auth_time,:acr,:amr),{:halt, conn}to take over the connection (e.g. redirect to a host login page that re-enters the authorization endpoint),{:none}when no subject can be established without UI, an{:error, _}classifying why interaction is required (OIDC Core §3.1.2.6), or{:error, :server_error}/{:error, :temporarily_unavailable}when the host failed, such as a failedAttestoPhoenix.Interaction.park/2(RFC 6749 §4.1.2.1).auth_optsis a map carrying the OIDC Core §3.1.2.1prompt/max_agedirectives the host must honour::prompt,:force_reauth(prompt=login),:interactive(falseforprompt=none, forbidding UI),:max_age,:resumed,:parked_at, and:prompt_login_since(Unix seconds on resume, otherwise nil). Forprompt=login, return anauth_timeat or afterprompt_login_sinceon resume: the first park time for a login detour, or the bound already checked before a first park in consent. For a fresh request it must be no earlier than arrival minus 60 seconds. An unusable time is logged and returned asserver_error(OIDC Core §3.1.2.3). The host owns all login UI; the library only invokes this hook. Required only when the authorization endpoint is mounted.:consent-(conn, request, subject -> {:consented, subject} | {:halt, conn} | {:denied, reason} | {:error, :server_error | :temporarily_unavailable}). Obtains the resource owner's consent for an authorization request (RFC 6749 §4.1.1). Returns{:consented, subject}to proceed (the returned subject may carry consent-derived claims),{:halt, conn}to take over the connection (e.g. render a consent screen that re-enters the authorization endpoint), or{:denied, reason}to refuse (reported to the client asaccess_denied, RFC 6749 §4.1.2.1), or{:error, :server_error}/{:error, :temporarily_unavailable}when the host failed (reported with that code). When unset, consent is implicitly granted only for a client the host explicitly classifies as confidential. Public clients require an explicit consent callback before a code can be issued.:notify_ciba_user-(auth_req_id, request, subject -> :ok | {:error, reason}). Starts the out-of-band user-authentication step for a CIBA request. It runs asynchronously after the request is persisted, so the §7.3 acknowledgement never waits for the notification. Only:okis a successful dispatch; an{:error, reason}, exception, or any other return is logged as a failure and the authentication request remains pending.:client_public?-(client -> boolean()). Returns whether a client may authenticate without a secret and rely on PKCE.:client_native?-(client -> boolean()). Returns whether a client is an installed native application (RFC 8252 / BCP 212). Defaults tofalsewhen unset, so a host that does not classify its clients gets no RFC 8252 behavior. A native client always requires PKCE (§8.1) and, when it is also public, may not authenticate at the token endpoint with a secret (§8.4). See also:native_apps.:client_requires_mtls?-(client -> boolean()). Returns whether a client requires mTLS-bound token issuance.:client_requires_dpop?-(client -> boolean()). Returns whether a client requires DPoP-bound token issuance.:client_grant_types-(client -> [String.t()] | nil). Returns the grant types registered for this client (RFC 7591 §2). When set, the token endpoint rejects a requested grant type not in the returned list.:issue_refresh_token?-(client, granted_scope -> boolean()). Returns whether the authorization-code grant should issue an initial refresh token (RFC 6749 §6). When unset, the token controller issues one iff the granted scope containsoffline_access(OIDC Core §11) and a:refresh_storeis configured.:authorization_code_private_context-(context -> map | nil). Optional trusted issuance callback for host-private authorization state.contextcontains the authorized:client_id, the:subjectid string, the freshly generated authorization-grant provenance:family_id,:authentication(the subject map the host's authentication and consent callbacks returned, with whatever it carries::subject,:auth_time,:sid,:acr,:amrand any host keys), and the validated request's:scope(a list) and:resource(a list of RFC 8707 resource indicators, empty when none was requested). It contains no raw request parameters or token secrets. The family identifier is the value exposed by:authorization_grant_id_claimwhen configured, not the separately generated refresh-rotation family identifier. A returned map must be a portable JSON object (Attesto.Claims.portable_json_object?/1: string keys at every level and JSON-safe values) and is limited to 4 KiB once encoded. It rides with the authorization code inside the canonical grant:claimsunder a reserved namespaced key, and is supplied only as:private_contextin the completion callback context. It is stripped from the redeemed core grant before principal construction, so it never reaches an access token, ID Token, refresh token, or token-exchange input. The map is persisted as plaintext JSONB in the authorization row; this feature is not encryption. Store only non-secret identifiers and policy versions such as subject IDs or security epochs, never credentials or token/key material.nilstores nothing. The reserved key belongs to the bundled authorization endpoint. A custom authorization-code issuer or custom reconstruction path accepting request-derived claims MUST rejectAttestoPhoenix.AuthorizationCodePrivateContext.claims_key/0in those claims;reserved?/1is provided for that check. Exceptions from this callback propagate. When the authorization request came through PAR, itsrequest_urimay already have been claimed before this callback runs, as with other host callbacks. Configure this only together with:authorization_code_completion; missing state remains valid so the host can apply flow-specific fail-closed policy at completion. The reverse skew fails closed on the library's side: a code that DOES carry private context is refused with genericinvalid_requestunable-to-issue-token response when no:authorization_code_completioncallback is configured, so a node whose callback configuration or behaviour module is unavailable cannot issue tokens with the host's completion policy silently skipped. Deploy callback-capable nodes before enabling private context; this check cannot detect an older package version on another node.:authorization_code_issuance-(context, continuation -> result). Optional synchronous wrapper around authorization-code issuance at the authorization endpoint, after authentication, consent and the private-context callback, and before the code exists.contextis%{client_id, subject, family_id, private_context}: the authorized client, the subject id string, the authorization-grant provenance id, and the map:authorization_code_private_contextreturned (ornil). The zero-arity continuation stores the code and returns{:ok, code}or{:error, reason}. A host runs it inside its own transaction and locks to issue the code atomically with a session or eligibility check, and returns the continuation's result unchanged; the one{:ok, _}wrapper ofRepo.transaction/1is accepted. When unset, the code is issued directly, as before.The host may refuse with
{:error, %AttestoPhoenix.OAuthError{}}. Its error code becomes the redirectable authorization error:access_deniedwhen the user is no longer eligible,server_errorortemporarily_unavailableon a host failure.login_requiredis honored only for aprompt=nonerequest; on an interactive request, and for any other code, the answer isserver_errorwith a log line. The error description is not sent to the client.The continuation follows the rules of
AttestoPhoenix.AuthorizationServer.Continuation: one invocation, in the callback's process, during the callback. A success returned without invoking it issues nothing and is answeredserver_error. When the request came through PAR, itsrequest_urihas already been claimed, so a refusal here ends that pushed request. The continuation's result holds the authorization code; the callback must not log or store it.:refresh_completion-(context, continuation -> result). Optional synchronous wrapper around the refresh grant, from rotation of the presented refresh token through scope policy,:build_refresh_principaland the mint.contextis%{client_id, subject, family_id, scope, resource, auth_time, acr, sid}, read from the stored grant without consuming it: the authenticated client, the grant's subject, its refresh family, the granted scope and resource lists, the original authentication time and context, and the host session identifier the grant was issued under (nilwhen none was recorded). It carries no token, token hash, or host claims. The host re-checks the subject's eligibility and runs the continuation inside its own transaction and locks, returning its{:ok, response, events}or error result unchanged, or refuses with{:error, AttestoPhoenix.OAuthError.new(:invalid_grant)}. When unset, the grant runs directly in the order it always has.Rotation is the continuation's first step. A host that refuses without invoking the continuation has not consumed the presented token. With
AttestoPhoenix.Store.EctoRefreshStoreon the repo the host's transaction runs on, the rotation joins that transaction, so a rollback (aRepo.rollback/1, or an exception) also leaves the presented token usable. A refresh store that is not transactional with the host, such asAttesto.RefreshStore.ETS, cannot be rolled back: once the continuation has run, the presented token is rotated whatever the host returns, and a host that needs to refuse must do so before invoking it.Reuse detection is not undone by a rollback: when the continuation reports a replayed token, the family revocation is applied again after the callback returns, outside the host's transaction. The DPoP proof replay claim is committed before the callback and is not part of the continuation. A presented token with no stored record is not passed to the callback; the grant fails as an unknown token. The continuation follows the rules of
AttestoPhoenix.AuthorizationServer.Continuation. With a store implementingAttesto.RefreshStore.with_family_lock/2(including the bundled Ecto store), the callback and continuation run under the family's rotation/revocation lock and the grant is rechecked before the callback. This also covers a request that becomes a grace retry while waiting. A revocation may still commit immediately after minting; an already minted access token is not undone. To coordinate host eligibility, run minting through the continuation inside the host's transaction and use a consistent host/family lock order. A host that also needs code-row locks must acquire those before entering completion.:authorization_code_completion-(context, continuation -> result). Optional synchronous wrapper around authorization-code completion. It is invoked after the code has been redeemed and before:build_principalor token minting.contextcontains only the authenticated:client_id, the grant:subject, its:family_id, and the host's:private_contextmap (ornil); it never contains the authorization code or minted token secrets. The zero-arity continuation performs principal construction, host:build_id_token_claimsinvocation, access- and ID-token minting, optional logout-session recording, access-tokenjtirecording, optional generation-0 refresh-token insertion, and successful code finalization. A host may run it inside its own database transaction after locking and revalidating the subject's authorization policy.This is an initial authorization-code completion hook only. Scope policy and resource-indicator resolution precede it. Refresh, device-code, CIBA, pre-authorized-code, JWT-bearer, client-credentials, token-exchange, and every other grant type bypass the hook. It is not a per-request resource-server or MCP reauthorization mechanism; enforce request-time policy where the access token is used.
AttestoPhoenix binds the continuation to the callback's process and dynamic scope and permits exactly one invocation; a second, cross-process, or escaped invocation is rejected before token minting or persistence. The callback must return the first invocation's
{:ok, response, events}or{:error, oauth_error}result unchanged. This is enforced, not merely documented: a digest and outcome of the continuation's result are recorded and compared without retaining token strings in process state, so a callback that never invokes the continuation cannot pass off a fabricated{:ok, response, events}as a token set, and a callback that substitutes a different success is refused. The{:ok, _}wrapperRepo.transaction/1places around a committed return is also accepted and unwrapped, because that commit already carried the mint, refresh insertion, and finalization. Only that one wrapper layer is accepted: a nested transaction orEcto.Multicontainer must be unwrapped by the host so the callback returns the continuation's exact result. A success wrapper around a failed continuation result is unwrapped to preserve the wire error, but emits a static warning because earlier continuation writes may have committed unless the callback rolled the transaction back. If the continuation raises, throws, or exits before returning and the callback catches that termination, an OAuth error is accepted with a static warning that partial writes may have occurred; a substituted success is refused. The callback is trusted same-process host code: the private process entry is a correctness guard against accidental interference and contract mistakes, not a sandbox against a hostile callback that deliberately inspects or mutates its own process dictionary. Host exception and crash formatters may render callback arguments, including:private_context, which is another reason that map must never contain secrets. If the continuation returns an error inside a transaction, the callback must roll that transaction back rather than commit the normal error tuple. If the continuation succeeds and the host transaction rolls back, the callback MUST return an error and MUST NOT return the captured success result. The library cannot distinguish a rollback from a commit after the callback returns; returning that success would serve a response whose writes were rolled back. Rollback covers only stores using the same Ecto Repo and enclosing transaction as the callback. Stores using another Repo, an independently committed transaction, or an external service remain outside this boundary. A callback may decline to continue with{:error, reason}; anAttestoPhoenix.OAuthErrorpasses through, while any other failure is rendered as a generic token-issuance error without logging the reason. If the callback returns an error, raises, throws, or exits after the continuation succeeds, a transaction may already have committed code finalization; the failed client retry can then be detected as code reuse and revoke that response's access token and the refresh-token family descended from that redemption, forcing a new authorization flow without affecting unrelated authorization grants. Such error returns are logged with this consequence. Exceptions, throws, and exits get the same static, secret-free log before being re-raised with their original stacktrace; the reason and callback context are never logged. The code has already been claimed before this callback runs, so refusal, malformed persisted private context, a missing callback for a context-bearing code, or any callback failure before the continuation succeeds leaves it spent but unfinalized. The bundled Ecto store gives that claimed row a five-minute finalization reservation. After a successful refresh exchange, the bundled sweeper retains the replay marker while the refresh table contains an unexpired member of the issued family. This also gives legacy markers with a NULL family deadline a finite cleanup boundary. Audit events follow the final returned result: a substituted error does not emit the continuation's success events, andissue/2returns the normal:token_deniedevent for that error. Persisted or external side effects from a committed continuation remain the host's responsibility to reconcile. The spent row remains in the:claimedstate, with no refresh family. When unset, the continuation runs directly, preserving existing behavior.:code_store- module implementingAttesto.CodeStore.:refresh_store- module implementingAttesto.RefreshStore.AttestoPhoenix.Store.EctoRefreshStorewith a non-zero rotation grace also requiresconfig :attesto_phoenix, :refresh_successor_secretto be a stable secret of at least 32 bytes. The config builder rejects that combination when the secret is missing or invalid.:refresh_store_backend- optional trusted declaration that a wrapping refresh store persists throughAttestoPhoenix.Store.EctoRefreshStore. The direct Ecto store is recognized automatically. A declared wrapper must implement everyAttesto.RefreshStorecallback and delegate Ecto operations under the same request configuration. This declaration enables issuer migration and the Ecto retry-secret/cleanup checks; it never replaces:refresh_storeor bypasses its policy callbacks.:client_subject_type-(client -> "public" | "pairwise"). The client's subject identifier type (OpenID Connect Core §8). Unset, every client ispublicand sees the host's own subject identifier. Apairwiseclient sees asubderived from its sector identifier, the host subject and:pairwise_subject_salt(Attesto.PairwiseSubject.derive/3), the same value in its access tokens, ID Tokens, UserInfo responses, introspection responses and back-channel logout tokens. The sector identifier is the one host the client's registered redirect URIs share;sector_identifier_uriis not supported, so a pairwise client whose redirect URIs span hosts is refused wherever asubwould be issued. Pairwise access tokens carry an AES-256-GCM sealed copy of the host subject encrypted under:pairwise_subject_saltsoAttestoPhoenix.ProtectedResourceand introspection recover the host subject while nothing the client holds reveals it. At the end-session endpoint the:terminate_sessioncontext's:subjectcomes from theid_token_hint, so for a pairwise client it is the pairwise value, which cannot be turned back into the host subject; identify the session by:sidthere. Configuring this callback makes discovery advertisesubject_types_supported: ["public", "pairwise"]and requires:pairwise_subject_salt.:pairwise_subject_salt- the secret pairwise identifiers are derived with: a binary of at least 32 bytes, identical on every node and never changed (changing it changes every pairwisesub). Required when:client_subject_typeis configured.:client_userinfo_signed_response_alg-(client -> alg | nil). The client's registereduserinfo_signed_response_alg(OpenID Connect Dynamic Client Registration 1.0 §2). When it names an algorithm this server signs with, the UserInfo endpoint answers that client with a signed JWT (application/jwt) carryingissandaud(OpenID Connect Core §5.3.2).nil, or an unset callback, keeps the JSON response.:interaction_browser_binding-(conn -> binary). Returns a value that identifies the current browser, stable from the moment a request is parked until it is resumed and not presentable by another browser, such as the session secret provided byAttestoPhoenix.Interaction.BrowserBinding. Mount that plug after fetching the session and configure this callback as&AttestoPhoenix.Interaction.BrowserBinding.binding/1. Preserve the value across login (renew: truekeeps session data;drop: trueandPlug.Conn.clear_session/1do not). Losing it causes the wrong-browser refusal. Required to useAttestoPhoenix.Interaction.park/2; a parked request is resumed only by the browser whose value matches. Only a hash of the value is stored.:interaction_ttl- how long a parked authorization request can be resumed, in seconds. A positive integer no greater than 3600. Default600. Parked interactions are bounded separately from:par_max_entrieson the default ETS store (:interaction_max_entries, default8_192), and anonymous/authorizevisitors can hold those slots up to:interaction_ttlseconds, so public deployments should rate-limit/authorizeper source. For pushed (request_uri) requests, the pushed reference remains governed by:par_ttlwhen shorter than:interaction_ttl.:interaction_max_entries- maximum live parked interactions held by the default ETS store, separate from:par_max_entries. Default8_192.:par_store- module implementingAttestoPhoenix.PARStore. Defaults to the single-nodeAttestoPhoenix.Store.PAR.ETS; useAttestoPhoenix.Store.EctoPARStorefor a clustered/load-balanced deployment so arequest_uriresolves on every node (FAPI 2.0 requires PAR). The default ETS store retains at most:par_max_entrieslive PAR rows (default1_024) and:interaction_max_entrieslive parked interactions (default8_192) in separate tables, and each serialized row (across all stores forInteraction.park/3andPAR.ETS/EctoPARStore) must fit:par_max_record_bytes(default 256 KiB). It prunes expired rows before rejecting admission withtemporarily_unavailable; it never evicts a live entry.:consent_grant_store- module implementingAttestoPhoenix.ConsentGrantStore, the single-use request-bound consent primitive (RFC 6749 §4.1.1). The host consent screen mints a grant when the resource owner authorizes; the host's:consentcallback consumes it before a code is issued, so one consent click cannot approve a different client/redirect/scope/challenge. The library ships the Ecto-backedAttestoPhoenix.Store.EctoConsentGrantStore; there is no default, because the library never renders a consent screen — a host wires this only when it adopts the consent primitive. Read it back withconsent_grant_store/1.:grant_types_supported- the grant types the server supports. Advertised asgrant_types_supported(RFC 8414 §2), enforced by the token endpoint (agrant_typeoutside the set is rejected), and the accepted set for dynamic registration. When unset, defaults to every implemented grant, including enabled optional grants; when set, the list is exact, including[]. Include the exact CIBA, device, JWT-bearer, or pre-authorized-code URN when enabling one of those features with an explicit catalog. Seegrant_types_supported/1.:token_endpoint_auth_methods_supported- client authentication methods advertised/accepted by dynamic client registration and by the token/PAR endpoints when configured. When unset, the default is the exact four methodsclient_secret_basic,client_secret_post,private_key_jwt, andnone. Addtls_client_authand/orself_signed_tls_client_authexplicitly, together with the required mTLS callbacks, when those methods are retained. Any non-nillist, including[], is exact, except thatattest_jwt_client_authis omitted when trusted Wallet Provider keys are absent and the unsupportedattest_jwt_client_auth_dpopcombined mode is always omitted.:trusted_wallet_provider_jwks- trusted Wallet Provider public keys forattest_jwt_client_auth, as an RFC 7517 JWK Set, a single public JWK map, or a list of public JWK maps. The method is disabled and omitted from discovery metadata when this is unset.:wallet_attestation_challenge_store- optional module exportingissue/1andvalid?/1, or the config-awareissue/2andvalid?/2callbacks used byAttestoPhoenix.Store.NonceStore. When configured, every Client Attestation PoP must carry a live server-issued Challenge. Missing or rejected Challenges return HTTP 400use_attestation_challengewith a freshOAuth-Client-Attestation-Challengeheader (attestation draft 11 §6). Use a dedicated store namespace, separate from DPoP nonces. Defaults tonil, which disables Challenge policy while retaining PoP replay checks. The optionalattest_jwt_client_auth_dpopcombined mode is unsupported and is always omitted from discovery; independent DPoP may accompanyattest_jwt_client_auth. A validly signed, expired Client Attestation returnsuse_fresh_attestation; malformed credentials retaininvalid_client.:key_attestation_trusted_jwks- trusted keys for verifying akey_attestationheader carried in a credential proof (OID4VCI key attestation), same shapes as:trusted_wallet_provider_jwks. When unset, a presentkey_attestationheader is not inspected.:require_key_attestation- whentrue, the credential endpoint rejects a proof that carries nokey_attestationheader (HAIP). Only meaningful with:key_attestation_trusted_jwks; defaults tofalse.
Optional values (with defaults)
:audience- default access-token audience. This must be one absolute HTTPS resource identifier. Use RFC 8707resourceparameters and:resource_indicatorswhen a grant may target other resources.:resource_origin- the external origin clients address this configuration's protected resources by, such as"https://api.example.com": anhttpsURL with a host, an optional port, and no path, userinfo, query, or fragment. Defaultnil. When set, the DPoPhtua proof must sign (RFC 9449 §4.3) at every protected resource authenticated with this configuration is this origin followed byconn.request_path; the request's scheme,Hostheader, forwarded headers, and port are not used. That coversAttestoPhoenix.Plug.Authenticate, the bundled UserInfo and credential endpoints, andAttestoPhoenix.DPoP.Adapter.protected_resource_opts/1. When unset, the protected-resourcehtuis built from the request: theHostheader, or the forwarded host from a peer in:trusted_proxies. A server that answers more than oneHostthen accepts a DPoP-bound token with a proof made for another server, so set this on every deployment that accepts DPoP-bound tokens at its protected resources. It is independent of:issuer, which names the authorization server and may be a different origin. Set:htuinstead when this configuration's protected resources are served on several origins (including a bundled UserInfo endpoint on the issuer origin and host resources on another); the two options are mutually exclusive.:client_auth_signing_algs- the JOSE algorithms accepted forprivate_key_jwtclient-assertion signatures, and the set advertised astoken_endpoint_auth_signing_alg_values_supportedin discovery. Defaults toAttesto.SigningAlg.fapi_algs/0(PS256, ES256, legacy EdDSA over Ed25519, and explicit Ed25519). A non-FAPI deployment can widen it; verification and the advertised metadata stay in lockstep because both read this one value.:client_assertion_audiences- acceptedprivate_key_jwtaudiences at the token and backchannel authentication endpoints, as a list or a one-arity function of the config. Defaults to the issuer identifier alone (RFC 10070 §4, FAPI 2.0 §5.3.2.1), the value every other endpoint already requires. Endpoint URLs are not accepted by default because they are what the 2025 audience-injection disclosure (CVE-2025-27370, CVE-2025-27371) relies on: a malicious AS republishes this server's token endpoint as its own, so a client that uses one key at both sends it an assertion this server would accept. A deployment whose clients still send an endpoint URL (older RFC 7523 clients, FAPI-CIBA test plans) can list it explicitly, for examplefn config -> [config.issuer, AttestoPhoenix.Config.token_endpoint_url(config)] end; only this server's issuer and its own token, PAR, and backchannel authentication endpoint URLs are accepted, and accepted non-issuer audiences emit[:attesto_phoenix, :client_authentication, :legacy_assertion_audience]. Assertions must carry a single scalaraudstring; JSON arrays (including single-member arrays) are rejected.:client_auth_enforce_fapi_alg_policy- enforce FAPI's algorithm and Edwards-curve restrictions forprivate_key_jwt. RSA keys require at least 2048 bits under every policy. When unset, this defaults totrueif:client_auth_signing_algsis omitted and tofalseif the host supplies an explicit algorithm list. Set it totruewhen narrowing the FAPI allowlist; an enforced list must remain a subset ofAttesto.SigningAlg.fapi_algs/0. Set it tofalseonly for an explicit non-FAPI policy.:request_object_policy- anAttesto.RequestObject.Policycontrolling verification of signed authorization request objects (JAR, RFC 9101). Defaults to%Attesto.RequestObject.Policy{}(generic OpenID Connect §6.1:nbf/exp/typnot required). For FAPI 2.0 Message Signing §5.3.1 setAttesto.RequestObject.Policy.fapi_message_signing(); the policy is then enforced both at the PAR endpoint and at/authorize. Supplying an explicitaccepted_algslist selects non-FAPI key compatibility unless the policy'senforce_fapi_alg_policyfield istrue; the named FAPI policy sets that field explicitly, so narrowing its list retains FAPI's algorithm and Edwards-curve restrictions. RSA keys require at least 2048 bits under every policy.:openid_provider- whether this authorization server provides OpenID Connect authentication. Defaults totruefor compatibility. OAuth-only hosts set it tofalse. When enabled, the reservedopenidscope is added once to the effective authorization-server scope catalog. Provider Metadata, dynamic registration, registration defaults, and the built-in scope policy all consume that same catalog. This flag is independent of signing-key availability and of whether the optional bundled UserInfo route is mounted.:scopes_supported- list of supported authorization-server scope strings (concrete and wildcard) advertised in discovery and used as the default scope catalog. Withopenid_provider: true,openidmay be omitted from this input because config normalization adds it centrally. This catalog is not reused for protected-resource or MCP tool scope catalogs.:protected_resource_scopes_supported- independent scope catalog for the bundled RFC 9728 protected-resource metadata document. Whennil(the compatibility default), the raw:scopes_supportedinput is used; the centrally addedopenidscope is never copied. Set an explicit list to keep authorization-server and protected-resource policy fully separate. One config supplies one protected-resource document: the root URI and an optional:protected_resource_pathsURI are two locations for that same resource and therefore share this catalog. Multi-resource hosts need a distinct per-resource metadata owner and scope catalog for each resource;attesto_mcpprovides that routing model.:bearer_methods_supported- the RFC 6750 access-token presentation methods the resource server accepts, advertised asbearer_methods_supportedin the RFC 9728 protected-resource metadata document (/.well-known/oauth-protected-resource). A non-empty list of distinct methods, each"header"(§2.1) or"body"(§2.2) - the methodsAttestoPhoenix.Plug.Authenticateaccepts. The §2.3"query"method is rejected: the plug never accepts a query-presented token, so advertising it would name a method the library cannot honour (and RFC 6750 §2.3 says it SHOULD NOT be used). Defaults to["header"]; add"body"only for a resource server that intentionally accepts RFC 6750 §2.2 form-bodyaccess_tokencredentials and wants to advertise that method.:authorization_endpoint- absolute HTTPS authorization endpoint URL to advertise in OpenID Provider Metadata (RFC 6749 §3.1 / OpenID Connect Discovery §3).attesto_routes/1mounts the generic controller; the host supplies resource-owner authentication and consent through callbacks. It defaults to the URL derived from:issuerand:authorize_path.:userinfo_endpoint- absolute HTTPS UserInfo URL to advertise in OpenID Provider Metadata (OpenID Connect Core §5.3),:derived, ornil.attesto_routes/1mounts the generic controller by default and the host supplies claim values through:build_userinfo_claims. A URL is an authoritative host declaration and remains advertised even when the host replaces the bundled route at the same path.:derivedresolves throughuserinfo_endpoint_url/1; when the macro's local UserInfo route is disabled, only that derived value is eligible for suppression at the removed route-equivalent path.nilomits the member.:userinfo_scope_claims- a map from scope to extra claim names the UserInfo endpoint releases for that scope, added to the OpenID Connect Core §5.4 set (AttestoPhoenix.AuthorizationServer.Userinfo.standard_scope_claims/0). A standard scope gains the listed names; a host-defined scope gets the listed names as its whole set. Default%{}. A name is released only when:build_userinfo_claimsreturns a value for it.:userinfo_always_claims- claim names the UserInfo endpoint releases for every token carryingopenid, whatever its other scopes. Default[]. Neither option may namesub. When:claims_supportedis non-empty, every name in both options must appear in it; with the default empty:claims_supportedthat check is skipped.:claims_supported- list of claim names the host's UserInfo endpoint and ID Tokens can return (OpenID Connect Discovery §3). Advertised in the OpenID Provider Metadata; omitted when unset.:claims_parameter_supported- whether the provider accepts the OpenID Connectclaimsrequest parameter (OpenID Connect Discovery §3 / OpenID Connect Core §5.5). Defaultfalse: the authorization endpoint does not record aclaimsparameter on the code, the:build_id_token_claimsand:build_userinfo_claimscallbacks receive no requested claims from it, and UserInfo releases only the claims the granted scopes authorize. Whentrue, the authorization endpoint records the parameter and UserInfo also releases each claim named in itsuserinfomember that:build_userinfo_claimsreturns, whatever the granted scopes. The host's consent step and callback then decide which individually requested claims may be released. Advertised in the OpenID Provider Metadata only when set totrue(the core builder treats absence asfalseper OpenID Connect Discovery §3).:acr_values_supported- list of Authentication Context Class Reference values the provider can satisfy (OpenID Connect Discovery §3 / OpenID Connect Core §2). Advertised only when the host configures a non-empty list; omitted otherwise.:ui_locales_supported- list of BCP47 (RFC 5646) language tags the provider's UI supports (OpenID Connect Discovery §3). Advertised only when the host configures a non-empty list; omitted otherwise.:require_nonce- require the OpenID Connectnonceparameter on OpenID Connect Authentication Requests (OpenID Connect Core §3.1.2.1). Defaultfalse. Whentrue, the authorization endpoint passesrequire_nonce: truetoAttesto.AuthorizationRequest.validate/2for a request whose scope containsopenid, so a missingnonceon an OIDC request is rejected with a redirectableinvalid_requesterror. A non-OpenID OAuth 2.0 request is never affected (RFC 6749 keeps the authorization code at SHOULD, never requiring anonce). The host sets this per its own OpenID Provider policy.:require_pushed_authorization_requests- require front-channel authorization requests to use a PARrequest_uriissued by this server (RFC 9126). Defaultfalse.:authorization_response_iss- include the RFC 9207issauthorization response parameter on success and error redirects. Defaulttrue(authorization-server mix-up defense, mandated by FAPI 2.0); setfalseonly for a deployment that must omit it.:require_https- enforce HTTPS on incoming endpoint requests. Defaulttrue. This transport gate never relaxes the standards-required HTTPS issuer or advertised endpoint validation.:trusted_proxies- list of trusted proxy CIDRs/IPs controlling whetherX-Forwarded-*headers are honored. Default[](no forwarded trust).:response_modes_supported- the authorization response modes this server accepts and advertises asresponse_modes_supported: a non-empty list drawn fromAttesto.AuthorizationRequest.supported_response_modes/0, which is also the default. An authorization or pushed request for a mode outside the list is answered with a redirectableinvalid_request. A request with noresponse_modeasks forquery, so leaving"query"out makes an explicit mode mandatory."form_post"(OAuth 2.0 Form Post Response Mode) delivers the response as an auto-submitted HTML form POST to the redirect URI.:access_token_ttl- access-token lifetime, seconds. Default900.:id_token_ttl- ID Token lifetime, seconds (the distance fromiattoexp, OIDC Core §2). A positive integer no greater thanAttesto.IDToken.max_lifetime_seconds/0(3600). Default3600. It applies to every ID Token this server mints, including those from the CIBA grant.:id_token_azp- whether minted ID Tokens carry theazpclaim.:never(the default) omits it.:alwayssetsazpto the client the ID Token is issued to. OIDC Core §2 makesazpOPTIONAL and says implementations not using extensions "are encouraged to not use azp", so:alwaysruns against that encouragement; it exists for relying parties that checkazpon a single-audience ID Token.:refresh_token_ttl- refresh-token inactivity lifetime, seconds. Must be a positive integer no greater than2_147_483_647. Default1_209_600.:refresh_token_max_lifetime- optional positive lifetime, seconds, for an entire refresh family. New families persist a fixed deadline and every rotation is capped by it (RFC 10017 §6.3.2.3). Defaultnil; existing families without a deadline retain their inactivity policy. The bundled Ecto code store retains a successful authorization-code replay marker while the refresh table contains an unexpired member of the issued family, including when this setting isnil. With a:refresh_storethat does not persist throughAttestoPhoenix.Store.EctoRefreshStore, the marker is kept until the family deadline this setting fixes, and indefinitely when it isnil.:refresh_token_expiration_metadata- opt into the experimentaldraft-ietf-oauth-refresh-token-expiration-03token-timeout response and discovery fields. Defaultfalse. This advertises credential expiry; it does not assert an authorization lifetime.:refresh_token_rotation_grace_seconds- idempotency window, in seconds, during which a just-rotated refresh token can be retried and receive the same successor refresh token instead of being treated as a reuse attack. Must be a non-negative integer no greater than:refresh_token_ttl. Default60; set0for strict immediate reuse revocation. A non-zero window is important for clients that lose the first rotation response and retry the previous token (OAuth 2.0 Security BCP §4.14.2; FAPI 2.0 Security Profile §5.3.2.1). Inside the window a retry is accepted from any presenter that passes the family's binding check: client authentication for a confidential client, the bound key for a DPoP- or attestation-bound family, and only the publicclient_idfor a public client whose refresh token was issued without a DPoP proof. Someone who copied such an unbound public-client token before it was rotated can redeem it inside the window, receives the same successor as the legitimate client, and the family is not revoked; reuse is detected only on a presentation after the window. Public clients that send DPoP proofs receive key-bound refresh tokens and are not exposed this way. Use0, or a shorter window, when public clients refresh without DPoP and immediate reuse detection matters more than retry recovery. With the bundled Ecto refresh store, a non-zero value requires the application-wide:refresh_successor_secretdescribed under:refresh_store, a positive:sweep_interval_ms, and supervision of the packaged sweeper or an equivalent cleanup process.:authorization_code_ttl- authorization-code lifetime, seconds. Default60.:dpop_enabled- enable DPoP sender-constraint support. Defaulttrue.:dpop_nonce_required- require server-issued DPoP nonces. Defaultfalse.:mtls_enabled- enable mTLS (RFC 8705)cnfbinding. Defaultfalse.:mtls_endpoint_aliases- RFC 8705 §5 endpoint-name-to-HTTPS-URL map for a listener that requests client certificates separately from conventional endpoints. Omitted by default.:registration_enabled- enable/oauth/register. Defaultfalse.:registration_default_application_type-"web"(default) or"native", used only when registration omitsapplication_type. An explicit client value is never overridden. The native host profile applies the configured native-app redirect policy; it does not permit arbitrary HTTP redirects.:registration_default_scope- the scope assigned to a dynamically registered client (RFC 7591 §2) when its request omitsscope, echoed back in the §3.2.1 response.:scopes_supportedassigns the full catalog; a list assigns that explicit subset (validated against:scopes_supportedat boot). Defaultnil- a scopeless registration stays scopeless (fail-closed). Setting this lets a scopeless DCR client (e.g. an MCP/agent client) register with a usable scope without each host reinventing it.:registration_grant_types- the grant types a dynamic registration (RFC 7591 §2) may request. A list is enforced exactly and must be a subset of:grant_types_supported(validated at boot). Defaultnil- the supported subset ofauthorization_code,refresh_token, and the RFC 8628 device grant, the grants in which a resource owner approves the client.client_credentials, JWT-bearer, token exchange, and CIBA must be listed explicitly, and only behind an admission control, since an anonymous registration could otherwise claim a grant that mints tokens with no resource owner in the loop. Read it back withregistration_grant_types/1.:client_id_metadata- Client ID Metadata Document support - CIMD (draft-ietf-oauth-client-id-metadata-document-03, IETF OAuth WG). A keyword list configuring whether (and how) the authorization server dereferences an HTTPSclient_idURL to a client metadata document. The whole feature is off by default; whenenabled: true, discovery advertisesclient_id_metadata_document_supportedandAttestoPhoenix.ClientIdMetadata.Resolverresolves a CIMDclient_idthrough the configured fetcher and cache. Read it back withclient_id_metadata/1(the merged, defaulted keyword list) or theclient_id_metadata_enabled?/1predicate. Recognized members, with their defaults::enabled- master switch. Defaultfalse.:fetcher- module implementingAttestoPhoenix.ClientIdMetadata.Fetcher(the SSRF-guarded outboundGET). DefaultAttestoPhoenix.ClientIdMetadata.Fetcher.Req. A host may override with its own HTTP stack or a CIMD proxy service.:cache- module implementingAttestoPhoenix.ClientIdMetadata.Cache. DefaultAttestoPhoenix.ClientIdMetadata.Cache.Ecto(cluster-coherent); a single-node deployment may selectAttestoPhoenix.ClientIdMetadata.Cache.ETS.:allow_loopback- permit loopback addresses (the draft's "AS runs on loopback" exception; development only). Defaultfalse.:max_document_bytes- body size cap for the fetched document (draft's recommended 5 KB). Default5_120.:request_timeout_ms- connect and receive timeout for the fetch. Default5_000.:cache_ttl_bounds-{fallback_seconds, max_seconds}for HTTP freshness (RFC 9111). Explicit freshness is reduced by the response's current age and capped at the maximum, never raised to the fallback. Responses without explicit freshness use the age-adjusted fallback. Default{60, 86_400}.:require_same_origin_redirect_uri- additionally require the requestredirect_urito be same-origin with theclient_idURL, on top of the exact-match against the document'sredirect_uris(draft §2 MAY, enforced by default here). Defaulttrue.:allowed_hosts- optional allowlist of hostnames a CIMDclient_idURL may resolve through;nilmeans "any public host" (subject to the fetcher's SSRF guard). Defaultnil.:blocked_hosts- hostnames a CIMDclient_idURL must never resolve through, checked before any network work. Default[]. Host policies use lowercase IDNA ASCII names with one terminal root dot removed, for both metadata documents and remote JWKS.:max_concurrent_fetches/:max_concurrent_fetches_per_host- node-wide outbound concurrency limits. Defaults16/4.:max_fetches_per_window/:max_fetches_per_host_per_window- node-wide outbound request limits. Defaults120/30within:fetch_rate_window_ms(default60_000). Documents and remote JWKS share these quotas; requests over a limit fail closed. A fetch is charged when it is admitted, whether or not it succeeds, and theclient_idURL comes from an unauthenticated request. A caller who presents fresh uncached URLs can therefore spend the node-wide quota (on any hosts) or one host's quota (on that host) and leave every uncached CIMD client that depends on it unresolved, answeredinvalid_client, until the window resets. Cached clients keep working. Set:allowed_hostswhen the client hosts are known, size the quotas and the:cache_ttl_boundsfallback for the expected clients, and rate-limit the authorization endpoint per source in front of the application.:failure_backoff_ms- short failure suppression. Default1_000.:max_flow_entries- maximum coordinator bookkeeping entries. Default1_024.:max_singleflight_waiters- maximum followers sharing one concurrent resolution. Default32.:cache_max_entries- maximum entries in the built-in ETS and Ecto caches, with expired entries pruned before the earliest-expiring entries are evicted. ETS is node-wide; Ecto is per repository/schema. Default1_024. Custom caches must implement their own bounds.:cache_max_record_bytes- maximum serialized size of a built-in cache record, including attached JWKS. Default16_384bytes.
:replay_check- DPoPjtireplay check as a two-argument function,{module, function}, or{module, function, extra_args}callback. DPoP and jwt-bearer assertions default to the node-local ETS replay cache; supervise{Attesto.DPoP.ReplayCache, single_node?: true}only for a deployment with one node. Multiple nodes (including a rolling deploy) must configure a shared callback, such asAttestoPhoenix.Store.EctoReplayCheck.check_and_record/2, on every node. Do not supervise the local cache when using a shared callback. CIBA configurations that require signed authentication requests must set this explicitly so request-JWT replay protection cannot be omitted or left unsupervised. An optional signed request is rejected at runtime when this callback is nil.:nonce_store-Attesto.DPoP.NonceStoreimplementation. No store is selected by default. A capable store is required when:dpop_nonce_requiredistrue; useAttesto.DPoP.NonceStore.ETSon one node orAttestoPhoenix.Store.EctoNonceStoreacross nodes.:presentation_session_store- module implementingAttesto.PresentationSessionStorefor verifier-side OID4VP request state. Required when the host mounts thepresentation: trueroutes or callsAttestoPhoenix.Verifier.:verifier_client_id- verifier identifier placed in the presentation request and used as the holder Key Binding JWT audience. Required when creating verifier presentation requests with the default or"redirect_uri"client-id scheme.:verifier_client_id_scheme- OID4VP verifier client-id scheme.nil(the default) and"redirect_uri"retain the configured:verifier_client_id;"x509_san_dns"derives the identifier from:verifier_dns;"x509_hash"derives it from the leaf certificate's SHA-256 hash (HAIP 1.0 §5).:verifier_x5c- verifier certificate chain as DER binaries, leaf first. Required for"x509_san_dns"and"x509_hash". Identifies the request signer; it does not establish trust in credential issuers.:verifier_trusted_certificates- non-empty list of DER issuer trust anchors, ornil(default). PEM is not accepted, matching:verifier_x5c. Sessions use{:trusted_certificates, anchors}exclusively. Cannot be combined with:verifier_issuer_trustor per-request:issuer_trust. Core validates SD-JWT VCx5cand mdoc issuerAuthx5chainpaths.:verifier_certificate_trust- optional one-argument host callback receiving the validated leaf-first DER chain. Return:okto allow it or{:error, reason}to refuse it. Accepts a function,{module, function}, or{module, function, extra_args}. Forwarded as:certificate_trust; never persisted in the session and cannot override core validation.:verifier_status_resolver- optional 2-arity callback receiving the signed credential's status URI and requested media type. Returns{:ok, binary}or{:error, reason}. The default usesAttesto.StatusList.fetch/3: HTTPS, public addresses, pinned DNS, no redirects, a five-second deadline and a 1 MiB cap. Status references are always enforced; fetch and verification failures reject the presentation. A custom callback owns equivalent transport protection.:verifier_haip- boolean, defaulttrue, forwarded as:haipfor certificate verification. HAIP forbids self-signed leaves and chains containing a trust anchor.falseretains certificate path validation.:verifier_issuer_trust- optional default for the existing per-request:issuer_trust:{:issuer_jwks, keys}or{:resolve_issuer, callback}. Resolver callbacks accept the same forms as:verifier_certificate_trust. Mutually exclusive with:verifier_trusted_certificatesat boot. When both settings are absent, the host must supply per-request issuer trust.:verifier_dns- dNSName advertised by the verifier. Required when:verifier_client_id_schemeis"x509_san_dns".:presentation_response_mode- OID4VP response mode advertised to wallets. Defaults to"direct_post";"direct_post.jwt"encrypts redirect responses."dc_api.jwt"selects the Digital Credentials API with encrypted responses. Both encrypted modes use a fresh P-256 recipient key per session. Plain"dc_api"is not offered (HAIP 1.0 §5.2).:verifier_dc_api_origin- the HTTPS origin of the host's browser page, such as"https://verifier.example". Required for"dc_api.jwt"; otherwise optional. Validated at boot, with no path, trailing slash, credentials, query, fragment, or explicit default port. Recorded in the session's signed request asexpected_originsand used for core:dc_api_origin. Use a separately validated Config for each origin; never populate it from request headers, parameters, or wallet data.:verifier_accepted_algs- credential issuer algorithm list forwarded as:accepted_algs. The defaultnilretains core's ES256-only mdoc policy and the existing SD-JWT policy. An explicit list may include"ES256","ES384", and"ES512"; an empty list denies all issuer signatures. Core enforces P-256/P-384/P-521 pairing. SD-JWT issuer checks also receive this option and retain core's separate FAPI policy. Device authentication is unchanged.:sweep_interval_ms- interval forAttestoPhoenix.Store.Sweeper.start_link/1rejects an unset or non-positive value. The installer adds the supervised process automatically; manual Ecto configurations must add it after the repo when positive refresh retry grace or the bundled Ecto logout-session store is enabled. The sweeper also retries released and expired back-channel logout delivery leases. Configuration validates the interval but cannot prove that the host has actually supervised the process.:on_invalid_id_token_hint- what the end-session endpoint does with anid_token_hintthat fails verification.:reject(the default) answers400before:terminate_sessionruns.:terminate_sessionruns the callback with%{subject: nil, sid: nil, client_id: nil, hint: :invalid}so the host can ask the End-User whether to log out (RP-Initiated Logout 1.0 §2, §4).post_logout_redirect_uriis never honored for such a request. The:terminate_sessioncontext always carries:hint::verified,:absentor:invalid.logout: [retry_initial_delay_seconds: ..., retry_max_delay_seconds: ...]- bounded exponential backoff for failed deliveries in the bundled Ecto logout-session store. Defaults to 30 seconds initially and 3,600 seconds maximum. A due retry runs on the next configured sweeper interval.
:schema_prefix- optional PostgreSQL schema selected by Ecto'sprefix:option for every generated table and index. It must benilor a non-empty, lowercase ASCII PostgreSQL schema identifier containing only letters, digits, and underscores, beginning with a letter or underscore and no longer than 63 bytes. The 2.x:table_prefixoption is rejected; it did not identify one runtime layout: generated migrations could use literal names inpublic, while most stores queried canonical public tables and only the CIBA store and sweeper used it as an Ecto schema prefix. Inventory an existing database before selecting this value.
Endpoint paths advertised in metadata
The discovery documents (RFC 8414 §3, OpenID Connect Discovery §4) and the
RFC 7591 §3.2.1 registration response advertise absolute endpoint URLs built
from the :issuer and the request path each endpoint is mounted at. By
default the OAuth endpoints live under /oauth/* (the historic surface), but
a host that mounts them elsewhere (for example under /mcp/oauth/* to avoid
colliding with a legacy provider) MUST advertise the paths it actually serves
or clients are misdirected. These keys control that, all additive with
defaults that reproduce the historic /oauth/* surface exactly:
:oauth_path_prefix- path segment prepended to every OAuth endpoint tail. Default"/oauth", yielding the historic/oauth/token,/oauth/par, etc. A host mounting under/mcp/oauthsetsoauth_path_prefix: "/mcp/oauth"to advertise/mcp/oauth/tokenand so on. This is the FULL client-visible mount prefix, since the controllers cannot see the surrounding Phoenixscope. It does not relocate the router macro's discovery or JWKS routes. Those discovery routes are the fixed origin-issuer forms; seeAttestoPhoenix.Routerfor the path-bearing issuer boundary.:authorize_path,:token_path,:par_path,:revocation_path,:introspection_path,:registration_path,:userinfo_path- explicit per-endpoint path overrides. When set, the override wins over:oauth_path_prefixfor that one endpoint (the integrator's "explicit endpoint overrides plus sane defaults"). Each defaults tonil, meaning "derive from:oauth_path_prefix". An override is an absolute path reference ("/custom/token"), advertised verbatim merged onto the issuer.
Use the resolver helpers (token_endpoint_url/1, par_endpoint_url/1,
revocation_endpoint_url/1, registration_endpoint_url/1,
userinfo_endpoint_url/1, authorize_endpoint_url/1, jwks_uri/1, and the
resolved-path helpers token_path/1 and friends) rather than re-deriving the
URLs in callers. The bundled router macro mounts fixed /oauth/* tails and
takes the path before that segment as its :prefix; hosts that use an
explicit endpoint override must mount a matching route themselves.
Recommended production callback contracts
The loose *_client, *_principal, authorize_scope, consent, registration,
and event callbacks above are grouped into named behaviours that document the
full contract (with the governing RFC for each callback) and serve as the
recommended production shape: AttestoPhoenix.ClientStore,
AttestoPhoenix.PrincipalStore, AttestoPhoenix.ScopePolicy,
AttestoPhoenix.ConsentPolicy, AttestoPhoenix.RegistrationStore, and
AttestoPhoenix.EventSink. Wiring stays identical: pass an anonymous
function, a {module, function} pair, or a {module, function, extra_args}
triple per key as documented above. The behaviours are the contract; the
Config keys are how a host installs an implementation.
Behaviour-module Config keys
Rather than wiring every host callback as an individual flat key, a host may install one behaviour module per concern and let the library resolve each callback from it:
:client_store- a module implementingAttestoPhoenix.ClientStore.:principal_store- a module implementingAttestoPhoenix.PrincipalStore.:consent_policy- a module implementingAttestoPhoenix.ConsentPolicy.:scope_policy- a module implementingAttestoPhoenix.ScopePolicy.:event_sink- a module implementingAttestoPhoenix.EventSink.:registration- a module implementingAttestoPhoenix.RegistrationStore.:claims_provider- a module implementingAttestoPhoenix.ClaimsProvider.
Each per-callback value is resolved through the matching resolver fun on this
module (client_id_fun/1, load_principal_fun/1, consent_fun/1, and so on)
with a single precedence: the explicit flat key wins when set; otherwise, when
a behaviour module is installed and exports the corresponding behaviour
callback (after Code.ensure_loaded/1), the {module, function} pair is used;
otherwise the resolution is nil (and the consumer's existing fail-closed
default applies). Flat keys therefore never break: a host that wires the
individual callbacks keeps the exact behaviour it had. new/1 validates at
boot that any installed behaviour module is loadable and exports the callbacks
it claims, so a typo'd or partial module fails fast rather than silently
resolving to nil at request time.
Summary
Types
The host-provided values used to issue one JWT VC.
The host-provided values used to issue one mdoc credential.
The host-provided values used to issue one SD-JWT VC.
Functions
The set of resource identifiers this authorization server will mint a token
for, for client (RFC 8707 §2.2).
Resolve the authenticate_resource_owner callback. See resolve_callback/2.
Returns the configured authorization-code completion callback, or nil.
The host's optional wrapper around authorization-code issuance.
Returns the configured authorization-code private-context callback, or nil.
The configured authorization-grant ID access-token claim, or nil when disabled.
Absolute URL of the authorization endpoint: the issuer merged with
authorize_path/1. Advertised in the OpenID Provider Metadata when the host
does not supply a separate :authorization_endpoint.
The resolved request path of the authorization endpoint: the explicit
:authorize_path override when set, otherwise :oauth_path_prefix joined
with the conventional /authorize tail.
The scope-authorization callback and the arity to call it with.
Resolve the host's scope-authorization callback, or return the built-in policy that accepts only scopes in the effective authorization-server catalog.
Resolve the authorize_subject_scope callback. See resolve_callback/2.
Absolute URL of the CIBA backchannel authentication endpoint (advertised as backchannel_authentication_endpoint, CIBA Core §4).
The resolved request path of the CIBA backchannel authentication endpoint (CIBA Core §7).
The module that POSTs a logout_token to a Relying Party's backchannel_logout_uri.
Returns true iff the OP includes sid in its logout tokens (advertised as
backchannel_logout_session_supported, Back-Channel Logout 1.0 §2.1). attesto
always asserts sid when the session supplies one, so this tracks
backchannel_logout_supported?/1.
Returns true iff Back-Channel Logout is supported — logout is enabled AND a
:logout_session_store is wired (advertised as backchannel_logout_supported,
Back-Channel Logout 1.0 §2.1).
Legacy refresh-family issuer migration policy. Strict rejection is the default.
The name of the JavaScript-readable OP browser-state cookie (Session
Management 1.0 §3.2). The check_session_iframe script reads it, so it is
set without HttpOnly (and with SameSite=None; Secure, since the iframe is
embedded cross-site).
The OP browser-state cookie lifetime, in seconds.
The OP-only HMAC key for the browser-state value (Session Management 1.0
§3.2). It makes the value OP-owned (an injected/forged cookie cannot verify)
and login-bound (a re-auth / account switch rotates it). Required when session
management is enabled — validated at build time by new/1.
Invokes the host's :build_credential callback for the authenticated subject,
requested credential configuration, and holder public JWK.
Returns the configured OID4VCI credential builder callback, or nil.
Invokes the host's :build_deferred_credential callback for the
authenticated subject and the transaction id the wallet is polling.
Returns the configured OID4VCI deferred-credential builder callback, or nil.
Resolve the build_id_token_claims callback. See resolve_callback/2.
Resolve the build_principal callback. See resolve_callback/2.
Resolve the build_refresh_principal callback. See resolve_callback/2.
Invokes the host's :build_userinfo_claims callback for the authenticated
subject and returns the raw claims map it produces.
Resolve the build_userinfo_claims callback. See resolve_callback/2.
The configured Attesto.CNonceStore module, or nil.
Absolute URL of the check-session iframe (advertised as check_session_iframe, Session Management 1.0 §3.3).
The resolved request path of the check-session iframe (Session Management 1.0 §3.3).
The merged, defaulted OpenID Connect CIBA options.
The advertised + enforced CIBA modes (:poll/:ping; :push is rejected at boot).
Returns true iff OpenID Connect CIBA is enabled (ciba: [enabled: true]).
When enabled and grant_types_supported is nil,
urn:openid:params:grant-type:ciba is added to grant_types_supported/1 and
the backchannel_authentication_endpoint + CIBA capability metadata are
advertised. An explicit grant catalog must include the CIBA URN. The host
MUST ALSO pass ciba: true to attesto_routes/1 to mount the endpoint.
The module implementing AttestoPhoenix.CIBAPing for ping-mode delivery.
The configured Attesto.CIBAStore module, or nil.
The aud values a private_key_jwt client assertion may carry (RFC 7523 §3).
Resolve the client_auth_method callback. See resolve_callback/2.
Whether missing registered-method configuration is rejected at boot.
The Relying Party's backchannel_logout_session_required (Back-Channel Logout
1.0 §2.2): whether its logout token MUST carry sid. Defaults to false.
Resolve the client_backchannel_logout_session_required callback. See resolve_callback/2.
The Relying Party's registered backchannel_logout_uri (Back-Channel Logout
1.0 §2.2), or nil when the client is not back-channel-logout capable (so no
logout session is recorded and no token is fanned out to it).
Resolve the client_backchannel_logout_uri callback. See resolve_callback/2.
The client's registered CIBA metadata (CIBA Core §4), resolved from the host
:client_ciba_registration callback (or the AttestoPhoenix.ClientStore
behaviour), as a map with :token_delivery_mode (:poll | :ping | :push),
:client_notification_endpoint, :request_signing_alg, and
:user_code_parameter. A non-nil :request_signing_alg requires every
request from that client to be signed with exactly that algorithm; when it
is absent or nil, signed requests are rejected. A client the host does not
register for CIBA resolves to %{} (the core then treats it as
unauthorized_client).
Resolve the client_ciba_registration callback. See resolve_callback/2.
The Relying Party's frontchannel_logout_session_required (Front-Channel
Logout 1.0 §2): whether the rendered logout URI must carry iss and sid
query parameters. Defaults to false.
Resolve the client_frontchannel_logout_session_required callback. See resolve_callback/2.
The Relying Party's registered frontchannel_logout_uri (Front-Channel
Logout 1.0 §2), or nil when the client is not front-channel-logout capable
(so no iframe is rendered for it on the logout page).
Resolve the client_frontchannel_logout_uri callback. See resolve_callback/2.
Resolve the client_grant_types callback. See resolve_callback/2.
Resolve the client_id callback. See resolve_callback/2.
Returns the merged, defaulted Client ID Metadata Document (CIMD) options.
Returns true iff Client ID Metadata Document support is enabled.
Resolve the host identifier for an opaque client.
Resolve the client_jwks callback. See resolve_callback/2.
Resolve the client_mtls_metadata callback. See resolve_callback/2.
Resolve the client_native? callback. See resolve_callback/2.
The Relying Party's registered post_logout_redirect_uris (RP-Initiated
Logout 1.0 §2): the :client_post_logout_redirect_uris callback's result, or
[] when the host wires none (so an unvalidatable post_logout_redirect_uri
is always refused).
Resolve the client_post_logout_redirect_uris callback. See resolve_callback/2.
Resolve the client_public? callback. See resolve_callback/2.
Resolve the client_redirect_uris callback. See resolve_callback/2.
Resolve the client_registration_access_token_hash callback. See resolve_callback/2.
Resolve the client_registration_metadata callback. See resolve_callback/2.
Resolve the client_requires_dpop? callback. See resolve_callback/2.
Resolve the client_requires_mtls? callback. See resolve_callback/2.
Whether Basic/POST transport mismatches are enforced or observed during migration.
Resolve and load the host's client by client_id (RFC 6749 §2.2).
Resolve and run the host's constant-time client-secret verification
(RFC 6749 §2.3.1) for client/presented_secret.
Resolve the client_subject_type callback. See resolve_callback/2.
Resolve the client_userinfo_signed_response_alg callback. See resolve_callback/2.
Resolve the consent callback. See resolve_callback/2.
Returns the configured single-use consent-grant store module, or nil.
The configured OID4VCI credential-configuration catalog, or nil.
The EC P-256 keystore for OID4VCI Credential Request and Response encryption, or nil.
Whether OID4VCI Credential Request and Response encryption is mandatory (default false).
Absolute URL of the OID4VCI credential endpoint.
The resolved request path of the OID4VCI credential-offer endpoint.
The configured Attesto.CredentialOfferStore module, or nil.
The resolved request path of the OID4VCI credential endpoint.
The resource identifiers the host chose for a request that names none.
Whether a resource_indicators: [default_resources_for: callback] is configured.
Absolute URL of the OID4VCI deferred-credential endpoint.
The resolved request path of the OID4VCI deferred-credential endpoint.
The merged, defaulted RFC 8628 device-authorization options.
Returns true iff the RFC 8628 device authorization grant is enabled
(device_authorization: [enabled: true]). When enabled, device_code is
added to grant_types_supported/1 only when that setting is nil, and the
device_authorization_endpoint is advertised. An explicit grant catalog
must include urn:ietf:params:oauth:grant-type:device_code.
Absolute URL of the device-authorization endpoint (advertised as device_authorization_endpoint, RFC 8628 §4).
The resolved request path of the device-authorization endpoint (RFC 8628).
The configured Attesto.DeviceCodeStore module, or nil.
Absolute URL of the device-verification page.
The resolved request path of the device-verification page (RFC 8628 §3.3).
The RFC 8628 §3.2 verification URI shown to the user: the configured
device_authorization: [verification_uri: ...] override, otherwise the
issuer-derived device-verification endpoint URL.
Returns the configured Ecto repository, raising when it is unset.
Returns the normalized scope catalog shared by authorization-server surfaces.
Absolute URL of the end-session endpoint (advertised as end_session_endpoint, RP-Initiated Logout 1.0 §2).
The resolved request path of the end-session endpoint (RP-Initiated Logout 1.0).
The OpenID Federation superior entity identifiers, or nil.
The OpenID Federation entity-type metadata map, or nil.
Reads the config for otp_app under key (default AttestoPhoenix.Config)
from the application environment and builds a validated config.
Returns true iff the OP passes iss/sid query parameters on the rendered
frontchannel_logout_uri (advertised as frontchannel_logout_session_supported,
Front-Channel Logout 1.0 §3). attesto always includes both whenever the
session's sid is known, so this tracks frontchannel_logout_supported?/1.
Returns true iff Front-Channel Logout is supported — logout is enabled AND a
:logout_session_store is wired (advertised as frontchannel_logout_supported,
Front-Channel Logout 1.0 §3). The store is what lets the end-session endpoint
enumerate the RPs whose frontchannel_logout_uri the logout page must render.
The grant types the authorization server supports.
The merged, defaulted OAuth Identity and Authorization Chaining Across Domains
(draft-ietf-oauth-identity-chaining-17 / RFC 10092) options.
Returns true iff Trust Domain A identity-chaining ID-JAG issuance is enabled
(identity_chaining: [enabled: true, ...]).
Absolute URL of the token introspection endpoint (RFC 7662): the issuer merged
with introspection_path/1. Advertised as introspection_endpoint.
The resolved request path of the token introspection endpoint (RFC 7662). See
authorize_path/1.
Absolute URL of the JWK Set document (RFC 7517 §5; the jwks_uri per
RFC 8414 §2). This library keeps the JWKS document outside
:oauth_path_prefix, but preserves a tenant path carried by :issuer.
Returns the merged, defaulted Identity Assertion JWT Authorization Grant
(ID-JAG / jwt-bearer) options.
Returns true iff the Identity Assertion JWT Authorization Grant (ID-JAG /
jwt-bearer) is enabled.
Trusted keys for verifying a key_attestation header in a credential proof.
The configured keystore used for ID-token and authorization-server signing.
Resolve the load_client callback. See resolve_callback/2.
Resolve the load_principal callback. See resolve_callback/2.
The merged, defaulted OpenID Connect logout (RP-Initiated + Back-Channel) options.
Returns true iff OpenID Connect logout is enabled (logout: [enabled: true]).
When enabled, the end_session_endpoint is advertised and (with a
:logout_session_store wired) Back-Channel Logout is supported. The host MUST
ALSO pass logout: true to attesto_routes/1 to mount the endpoint.
The configured Attesto.LogoutSessionStore module (Back-Channel Logout), or nil.
How long a recorded back-channel-logout session lives before it is swept, in seconds.
The redirect-URI matching mode a loopback-capable client gets: RFC 8252 §7.3
port flexibility for the IP literals, widened to the bare localhost name
iff the host opted in with native_apps: [loopback_include_localhost: true].
Returns true unless the host has forbidden RFC 8252 §7.3 loopback interface
redirection server-wide with native_apps: [loopback_redirect: false].
Returns the merged, defaulted RFC 8252 native-app profile options, so every
recognized member (:loopback_redirect, :loopback_include_localhost,
:reject_embedded_user_agents) is always present.
Builds and validates a config from a keyword list or map.
Absolute URL of the OID4VCI nonce endpoint.
The resolved request path of the OID4VCI nonce endpoint.
Resolve the on_event callback. See resolve_callback/2.
Returns whether this authorization server is configured as an OpenID Provider.
Absolute URL of the pushed-authorization-request endpoint: the issuer merged
with par_path/1. Advertised as pushed_authorization_request_endpoint
(RFC 9126 §5).
The resolved request path of the pushed-authorization-request endpoint
(RFC 9126). See authorize_path/1.
The configured Attesto.PreAuthorizedCodeStore module, or nil.
Absolute URL of the OID4VP request-object endpoint.
The resolved request path of the OID4VP request-object endpoint.
Absolute URL of the OID4VP direct-post response endpoint.
The OID4VP direct-post response mode advertised to wallets.
The resolved request path of the OID4VP direct-post response endpoint.
The configured Attesto.PresentationSessionStore module, or nil.
Returns the RFC 9728 catalog without copying centrally added OIDC scopes.
The host's optional wrapper around the refresh grant's rotation and mint.
Declared persistence backend for refresh migration and Ecto configuration checks.
Resolve the register_client callback. See resolve_callback/2.
Absolute URL of an individual registered client's RFC 7592 management
endpoint: the registration endpoint URL with the URL-encoded client_id
appended. Returned as registration_client_uri in the RFC 7591 §3.2.1
client information response.
Application type used only for registration requests that omit the member.
The scope a dynamically registered client is assigned when its registration
request omits scope (RFC 7591 §2: the authorization server MAY register a
default scope). Resolves the :registration_default_scope setting to a
concrete list
Absolute URL of the dynamic client registration endpoint: the issuer merged
with registration_path/1. Advertised as registration_endpoint (RFC 7591
§3) only when registration is enabled.
The grant types a dynamic registration (RFC 7591 §2) may request.
The resolved request path of the dynamic client registration endpoint
(RFC 7591). See authorize_path/1.
Returns true iff the authorization endpoint should refuse requests that
appear to come from an embedded user agent (RFC 8252 §8.12).
Return the bounded operation's request config, or nil outside one.
Whether a credential proof MUST carry a verified key_attestation header.
Resolves the validated config from the library's configured :otp_app.
Resolves the validated config installed on a request connection.
Resolve a configured callback by its flat key.
Resolve the resolve_jwt_bearer_subject callback. See resolve_callback/2.
Returns the merged, defaulted RFC 8707 Resource Indicators options
(:allowed_resources, :allowed_resources_for, :default_resources_for).
Selects the RFC 9728 protected-resource metadata URL for conn.
Absolute URL of the revocation endpoint: the issuer merged with
revocation_path/1. Advertised as revocation_endpoint (RFC 8414 §2,
RFC 7009).
The resolved request path of the revocation endpoint (RFC 7009). See
authorize_path/1.
Resolve the public PostgreSQL schema prefix from a validated config.
The merged, defaulted OpenID Connect Session Management 1.0 options.
Returns true iff OpenID Connect Session Management 1.0 is enabled
(session_management: [enabled: true]). When enabled, the discovery document
advertises check_session_iframe, the authorization endpoint returns
session_state on authorization responses, and the OP browser-state cookie
is maintained. The host MUST ALSO pass session_management: true to
attesto_routes/1 to mount the iframe endpoint.
The configured default audience plus static RFC 8707 resource identifiers.
Absolute URL of the Token Status List endpoint.
The resolved request path of the Token Status List endpoint.
The configured Attesto.StatusListStore module, or nil.
Resolve the Ecto schema prefix for the current operation.
Resolve the prefix from an explicit config or connection.
Derives the Attesto.Config consumed by the protocol layer from this config.
The client-authentication methods accepted at the token, PAR, and revocation endpoints. Endpoint-specific policies may narrow this catalog.
Absolute URL of the token endpoint: the issuer merged with token_path/1.
Advertised as token_endpoint (RFC 8414 §2).
The resolved request path of the token endpoint. See authorize_path/1.
Trusted Wallet Provider keys for attestation-based client authentication.
Resolve the unregister_client callback. See resolve_callback/2.
Resolve the update_client callback. See resolve_callback/2.
Absolute URL of the UserInfo endpoint: the issuer merged with
userinfo_path/1. This is the URL selected by
userinfo_endpoint: :derived; an explicit URL or nil remains
authoritative in Provider Metadata.
The resolved request path of the UserInfo endpoint (OpenID Connect Core
§5.3). See authorize_path/1.
The keystore used to sign issued Verifiable Credentials; defaults to
:keystore. Configure a separate EC/ES256 keystore here to issue
ES256-signed credentials (e.g. for HAIP) while ID tokens keep their own
signing key.
Returns the PEM used to sign issued Verifiable Credentials.
The VC keystore's raw X.509 certificate-chain callback value, or nil.
Accepted credential issuer algorithms, forwarded to core as :accepted_algs.
The optional host policy applied after core certificate validation.
The verifier client identifier used as the OID4VP presentation audience.
The OID4VP verifier client-id scheme, or nil for the default behavior.
The configured DC API page origin; never derived from HTTP input.
The dNSName advertised by an x509_san_dns verifier.
The dedicated EC P-256 keystore for encrypted OID4VP responses, or nil.
Whether to enforce HAIP certificate restrictions (default true).
The default issuer keys or resolver used when no per-request trust is supplied.
The optional status-list fetch callback; nil selects the screened default fetcher.
The issuer trust anchors as DER certificates, or nil for key-based trust.
The verifier certificate chain as DER binaries, leaf first.
Resolve the verify_client_secret callback. See resolve_callback/2.
Resolve the verify_dummy_client_secret callback. See resolve_callback/2.
Run a conn-free callback with config as the request-local configuration.
Types
@type credential_result() :: sd_jwt_credential_result() | jwt_vc_credential_result() | mdoc_credential_result()
@type jwt_vc_credential_result() :: %{ :credential_type => String.t(), :claims => map(), optional(:valid_from) => integer(), optional(:valid_until) => integer() }
The host-provided values used to issue one JWT VC.
@type mdoc_credential_result() :: %{ :namespaces => %{required(String.t()) => %{required(String.t()) => term()}}, :valid_until => integer(), optional(:doc_type) => String.t(), optional(:issued_at) => integer(), optional(:valid_from) => integer() }
The host-provided values used to issue one mdoc credential.
@type sd_jwt_credential_result() :: %{ :vct => String.t(), :claims => map(), optional(:issued_at) => integer(), optional(:valid_from) => integer(), optional(:valid_until) => integer() }
The host-provided values used to issue one SD-JWT VC.
@type t() :: %AttestoPhoenix.Config{ access_token_ttl: pos_integer(), acr_values_supported: [String.t()], audience: String.t() | nil, authenticate_ciba_user: callback() | nil, authenticate_device_user: term(), authenticate_resource_owner: callback() | nil, authorization_code_completion: callback() | nil, authorization_code_issuance: callback() | nil, authorization_code_private_context: callback() | nil, authorization_code_ttl: pos_integer(), authorization_endpoint: String.t() | nil, authorization_grant_id_claim: String.t() | nil, authorization_response_iss: boolean(), authorize_path: String.t() | nil, authorize_scope: callback() | nil, authorize_subject_scope: callback() | nil, backchannel_authentication_path: String.t() | nil, basic_realm: String.t(), bearer_methods_supported: [String.t()], bind_unbound_refresh_families: :reject | :configured_issuer, build_credential: callback() | nil, build_deferred_credential: callback() | nil, build_id_token_claims: callback() | nil, build_principal: callback() | nil, build_refresh_principal: callback() | nil, build_userinfo_claims: callback() | nil, c_nonce_store: module() | nil, cert_der: callback() | nil, check_session_path: String.t() | nil, ciba: keyword(), ciba_ping_http_client: module(), ciba_store: module() | nil, claims_parameter_supported: boolean(), claims_provider: module() | nil, claims_supported: [String.t()], client_assertion_audiences: [String.t()] | (t() -> [String.t()]) | nil, client_auth_enforce_fapi_alg_policy: boolean() | nil, client_auth_method: callback() | nil, client_auth_method_validation: :runtime | :boot, client_auth_signing_algs: [String.t()] | nil, client_backchannel_logout_session_required: callback() | nil, client_backchannel_logout_uri: callback() | nil, client_certificate_chain_validated?: callback() | nil, client_ciba_registration: callback() | nil, client_frontchannel_logout_session_required: callback() | nil, client_frontchannel_logout_uri: callback() | nil, client_grant_types: callback() | nil, client_id: callback() | nil, client_id_metadata: keyword(), client_jwks: callback() | nil, client_mtls_metadata: callback() | nil, client_native?: callback() | nil, client_post_logout_redirect_uris: callback() | nil, client_public?: callback() | nil, client_redirect_uris: callback() | nil, client_registration_access_token_hash: callback() | nil, client_registration_metadata: callback() | nil, client_requires_dpop?: callback() | nil, client_requires_mtls?: callback() | nil, client_secret_auth_method_policy: :strict | :observe, client_store: module() | nil, client_subject_type: callback() | nil, client_userinfo_signed_response_alg: callback() | nil, code_store: module() | nil, consent: callback() | nil, consent_grant_store: module() | nil, consent_policy: module() | nil, cors_origins: :* | :all | String.t() | [String.t()] | false | callback(), credential_configurations_supported: map() | nil, credential_encryption_keystore: module() | nil, credential_encryption_required: boolean(), credential_offer_store: module() | nil, device_authorization: term(), device_authorization_path: term(), device_code_store: module() | nil, device_verification_path: term(), dpop_enabled: boolean(), dpop_nonce_required: boolean(), end_session_path: term(), event_sink: module() | nil, federation_authority_hints: [String.t()] | nil, federation_entity_metadata: map() | nil, forwarded_cert_der: callback() | nil, grant_types_supported: [String.t()] | nil, htu: callback() | nil, id_token_azp: :never | :always, id_token_ttl: pos_integer(), identity_chaining: keyword(), interaction_browser_binding: callback() | nil, interaction_max_entries: pos_integer(), interaction_ttl: pos_integer(), introspection_authorize: callback() | nil, introspection_path: String.t() | nil, issue_refresh_token?: callback() | nil, issuer: String.t(), jwt_bearer: keyword(), key_attestation_trusted_jwks: map() | [map()] | nil, keystore: module(), load_client: callback(), load_principal: callback(), logout: keyword(), logout_session_store: term(), mtls_enabled: boolean(), mtls_endpoint_aliases: %{optional(String.t()) => String.t()} | nil, native_apps: keyword(), no_store: callback() | nil, nonce_store: module() | nil, notify_ciba_user: callback() | nil, oauth_path_prefix: String.t(), on_event: callback() | nil, on_invalid_id_token_hint: :reject | :terminate_session, openid_provider: boolean(), pairwise_subject_salt: binary() | nil, par_max_entries: pos_integer(), par_max_record_bytes: pos_integer(), par_path: String.t() | nil, par_store: module() | nil, par_ttl: pos_integer(), pre_authorized_code_store: module() | nil, presentation_response_mode: String.t(), presentation_session_store: module() | nil, principal_kinds: [Attesto.PrincipalKind.t()] | callback() | nil, principal_store: module() | nil, protected_resource_scopes_supported: [String.t()] | nil, refresh_completion: callback() | nil, refresh_store: module() | nil, refresh_store_backend: module() | nil, refresh_token_expiration_metadata: boolean(), refresh_token_max_lifetime: pos_integer() | nil, refresh_token_rotation_grace_seconds: non_neg_integer(), refresh_token_ttl: pos_integer(), register_client: callback() | nil, registration: module() | nil, registration_default_application_type: String.t(), registration_default_scope: [String.t()] | :scopes_supported | nil, registration_enabled: boolean(), registration_grant_types: [String.t()] | nil, registration_path: String.t() | nil, render_authorization_error: callback() | nil, render_device_verification: term(), render_end_session_error: callback() | nil, render_logged_out: callback() | nil, replay_check: callback() | nil, repo: module(), request_object_policy: Attesto.RequestObject.Policy.t() | nil, require_https: boolean(), require_key_attestation: boolean() | nil, require_nonce: boolean(), require_pkce: boolean(), require_pushed_authorization_requests: boolean(), resolve_jwt_bearer_subject: callback() | nil, resource_indicators: keyword(), resource_metadata: String.t() | nil, resource_metadata_resolver: callback() | nil, resource_origin: String.t() | nil, response_modes_supported: [String.t()], revocation_path: String.t() | nil, schema_prefix: String.t() | nil, scope_policy: module() | nil, scopes_supported: [String.t()], send_error: callback() | nil, session_management: keyword(), status_list_store: module() | nil, sweep_interval_ms: pos_integer() | nil, terminate_session: callback() | nil, token_endpoint_auth_methods_supported: [String.t()] | nil, token_path: String.t() | nil, trusted_proxies: [ :any | :loopback | :inet.ip_address() | String.t() | Attesto.IPAddress.cidr() ], trusted_wallet_provider_jwks: map() | [map()] | nil, ui_locales_supported: [String.t()], unregister_client: callback() | nil, update_client: callback() | nil, userinfo_always_claims: [String.t()], userinfo_endpoint: String.t() | :derived | nil, userinfo_path: String.t() | nil, userinfo_scope_claims: %{required(String.t()) => [String.t()]}, vc_keystore: module() | nil, verifier_accepted_algs: [String.t()] | nil, verifier_certificate_trust: callback() | nil, verifier_client_id: String.t() | nil, verifier_client_id_scheme: String.t() | nil, verifier_dc_api_origin: String.t() | nil, verifier_dns: String.t() | nil, verifier_encryption_keystore: module() | nil, verifier_haip: boolean(), verifier_issuer_trust: {:issuer_jwks, map() | list()} | {:resolve_issuer, callback()} | nil, verifier_status_resolver: callback() | nil, verifier_trusted_certificates: [binary()] | nil, verifier_x5c: [binary()] | nil, verify_client_secret: callback(), verify_dummy_client_secret: callback() | nil, wallet_attestation_challenge_store: module() | nil, www_authenticate: callback() | nil }
Functions
The set of resource identifiers this authorization server will mint a token
for, for client (RFC 8707 §2.2).
Composes the server's own :audience (always served), the static
resource_indicators: [allowed_resources: [...]] list, and the per-client
:allowed_resources_for callback's result. A requested resource is honored
only when it appears here; anything else is invalid_target.
Resolve the authenticate_resource_owner callback. See resolve_callback/2.
Returns the configured authorization-code completion callback, or nil.
See the :authorization_code_completion option. When nil, the token
endpoint runs the completion continuation directly. The continuation closure
captures completion state, including the plaintext authorization code;
trusted host code MUST NOT inspect or dump its function environment.
The host's optional wrapper around authorization-code issuance.
See the :authorization_code_issuance option. When nil, the authorization
endpoint issues the code directly.
Returns the configured authorization-code private-context callback, or nil.
See the :authorization_code_private_context option. The value the callback
returns rides with the code inside the canonical grant :claims and is
surfaced only to :authorization_code_completion.
The configured authorization-grant ID access-token claim, or nil when disabled.
Absolute URL of the authorization endpoint: the issuer merged with
authorize_path/1. Advertised in the OpenID Provider Metadata when the host
does not supply a separate :authorization_endpoint.
The resolved request path of the authorization endpoint: the explicit
:authorize_path override when set, otherwise :oauth_path_prefix joined
with the conventional /authorize tail.
The scope-authorization callback and the arity to call it with.
The three-argument form (client, requested_scope, resources) is preferred:
an explicit :authorize_scope function of arity 3 (or an MFA that resolves
to one), or a :scope_policy module exporting authorize_scope/3. Otherwise
the two-argument form is used, including the built-in catalog policy.
Resolve the host's scope-authorization callback, or return the built-in policy that accepts only scopes in the effective authorization-server catalog.
An explicit :authorize_scope callback or installed :scope_policy module
always takes precedence, so host client and user restrictions are preserved.
Resolve the authorize_subject_scope callback. See resolve_callback/2.
Absolute URL of the CIBA backchannel authentication endpoint (advertised as backchannel_authentication_endpoint, CIBA Core §4).
The resolved request path of the CIBA backchannel authentication endpoint (CIBA Core §7).
The module that POSTs a logout_token to a Relying Party's backchannel_logout_uri.
Returns true iff the OP includes sid in its logout tokens (advertised as
backchannel_logout_session_supported, Back-Channel Logout 1.0 §2.1). attesto
always asserts sid when the session supplies one, so this tracks
backchannel_logout_supported?/1.
Returns true iff Back-Channel Logout is supported — logout is enabled AND a
:logout_session_store is wired (advertised as backchannel_logout_supported,
Back-Channel Logout 1.0 §2.1).
@spec bind_unbound_refresh_families(t()) :: :reject | :configured_issuer
Legacy refresh-family issuer migration policy. Strict rejection is the default.
The name of the JavaScript-readable OP browser-state cookie (Session
Management 1.0 §3.2). The check_session_iframe script reads it, so it is
set without HttpOnly (and with SameSite=None; Secure, since the iframe is
embedded cross-site).
@spec browser_state_cookie_max_age(t()) :: pos_integer()
The OP browser-state cookie lifetime, in seconds.
The OP-only HMAC key for the browser-state value (Session Management 1.0
§3.2). It makes the value OP-owned (an injected/forged cookie cannot verify)
and login-bound (a re-auth / account switch rotates it). Required when session
management is enabled — validated at build time by new/1.
@spec build_credential(t(), String.t(), String.t(), map()) :: {:ok, credential_result()} | {:error, term()}
Invokes the host's :build_credential callback for the authenticated subject,
requested credential configuration, and holder public JWK.
Raises ArgumentError when the callback is not configured, so a mounted
Credential endpoint cannot silently issue an empty credential.
Returns the configured OID4VCI credential builder callback, or nil.
Invokes the host's :build_deferred_credential callback for the
authenticated subject and the transaction id the wallet is polling.
Raises ArgumentError when the callback is not configured, so a Deferred
Credential endpoint request cannot silently issue an empty credential.
Returns the configured OID4VCI deferred-credential builder callback, or nil.
Resolve the build_id_token_claims callback. See resolve_callback/2.
Resolve the build_principal callback. See resolve_callback/2.
Resolve the build_refresh_principal callback. See resolve_callback/2.
@spec build_userinfo_claims(t(), String.t(), [String.t()], map()) :: map() | {:error, :invalid_token}
Invokes the host's :build_userinfo_claims callback for the authenticated
subject and returns the raw claims map it produces.
The callback is applied with [subject, granted_scopes, requested_claims]
(see the :build_userinfo_claims key documentation). It is the claim source
for the UserInfo endpoint (OpenID Connect Core §5.3); the host owns the claim
values, the controller owns the scope-to-claim shaping. Raises
ArgumentError when the host has not configured the callback, so a mounted
UserInfo endpoint cannot silently return an empty document.
Resolve the build_userinfo_claims callback. See resolve_callback/2.
The configured Attesto.CNonceStore module, or nil.
Absolute URL of the check-session iframe (advertised as check_session_iframe, Session Management 1.0 §3.3).
The resolved request path of the check-session iframe (Session Management 1.0 §3.3).
The merged, defaulted OpenID Connect CIBA options.
@spec ciba_delivery_modes(t()) :: [:poll | :ping]
The advertised + enforced CIBA modes (:poll/:ping; :push is rejected at boot).
Returns true iff OpenID Connect CIBA is enabled (ciba: [enabled: true]).
When enabled and grant_types_supported is nil,
urn:openid:params:grant-type:ciba is added to grant_types_supported/1 and
the backchannel_authentication_endpoint + CIBA capability metadata are
advertised. An explicit grant catalog must include the CIBA URN. The host
MUST ALSO pass ciba: true to attesto_routes/1 to mount the endpoint.
The module implementing AttestoPhoenix.CIBAPing for ping-mode delivery.
The configured Attesto.CIBAStore module, or nil.
The aud values a private_key_jwt client assertion may carry (RFC 7523 §3).
Defaults to [config.issuer]. Endpoint URLs are accepted only when the
host lists them in :client_assertion_audiences; see the moduledoc for the
audience-injection attack they enable.
Resolve the client_auth_method callback. See resolve_callback/2.
@spec client_auth_method_validation(t()) :: :runtime | :boot
Whether missing registered-method configuration is rejected at boot.
The Relying Party's backchannel_logout_session_required (Back-Channel Logout
1.0 §2.2): whether its logout token MUST carry sid. Defaults to false.
Resolve the client_backchannel_logout_session_required callback. See resolve_callback/2.
The Relying Party's registered backchannel_logout_uri (Back-Channel Logout
1.0 §2.2), or nil when the client is not back-channel-logout capable (so no
logout session is recorded and no token is fanned out to it).
The URI is also fail-closed against server-side request forgery: the OP POSTs
a logout_token to it, so a non-https URL, one carrying userinfo/a fragment,
or one whose host is a loopback / private / link-local / unique-local literal
(e.g. 127.0.0.1, 10.x, 169.254.169.254, localhost) is treated as
absent. A registered URL that resolves to an internal address only via DNS is a
residual risk the host's egress controls own.
Resolve the client_backchannel_logout_uri callback. See resolve_callback/2.
The client's registered CIBA metadata (CIBA Core §4), resolved from the host
:client_ciba_registration callback (or the AttestoPhoenix.ClientStore
behaviour), as a map with :token_delivery_mode (:poll | :ping | :push),
:client_notification_endpoint, :request_signing_alg, and
:user_code_parameter. A non-nil :request_signing_alg requires every
request from that client to be signed with exactly that algorithm; when it
is absent or nil, signed requests are rejected. A client the host does not
register for CIBA resolves to %{} (the core then treats it as
unauthorized_client).
Resolve the client_ciba_registration callback. See resolve_callback/2.
The Relying Party's frontchannel_logout_session_required (Front-Channel
Logout 1.0 §2): whether the rendered logout URI must carry iss and sid
query parameters. Defaults to false.
Resolve the client_frontchannel_logout_session_required callback. See resolve_callback/2.
The Relying Party's registered frontchannel_logout_uri (Front-Channel
Logout 1.0 §2), or nil when the client is not front-channel-logout capable
(so no iframe is rendered for it on the logout page).
The URI is rendered as an <iframe src> on the OP's HTTPS logout page, so a
non-https URL (which browsers would block as mixed content, and which §2
only permits for confidential clients), one carrying userinfo, or one with no
host is treated as absent (fail closed).
Resolve the client_frontchannel_logout_uri callback. See resolve_callback/2.
Resolve the client_grant_types callback. See resolve_callback/2.
Resolve the client_id callback. See resolve_callback/2.
Returns the merged, defaulted Client ID Metadata Document (CIMD) options.
This is the host's :client_id_metadata keyword list merged over the library
defaults (draft-ietf-oauth-client-id-metadata-document-03 §9), so every
recognized member (:enabled, :fetcher, :cache, :allow_loopback,
:max_document_bytes, :request_timeout_ms, :cache_ttl_bounds,
:require_same_origin_redirect_uri, :allowed_hosts, :blocked_hosts) is
always present. AttestoPhoenix.ClientIdMetadata.Resolver and the discovery
wiring read the feature's configuration through this helper rather than
reaching into the struct field directly.
Returns true iff Client ID Metadata Document support is enabled.
The feature is off unless the host sets client_id_metadata: [enabled: true].
Discovery advertises client_id_metadata_document_supported and the
authorization endpoint resolves a CIMD client_id URL only when this is
true.
Resolve the host identifier for an opaque client.
A client resolved from a Client ID Metadata Document carries its validated URL identifier in the document. That identifier is returned directly; the host callback only receives host-owned client values.
absent_default is used only when no :client_id callback is configured.
Once configured, the callback must honor its non-empty-string contract;
invalid results are integration faults and never fall through to a
credential-carried identifier.
Resolve the client_jwks callback. See resolve_callback/2.
Resolve the client_mtls_metadata callback. See resolve_callback/2.
Resolve the client_native? callback. See resolve_callback/2.
The Relying Party's registered post_logout_redirect_uris (RP-Initiated
Logout 1.0 §2): the :client_post_logout_redirect_uris callback's result, or
[] when the host wires none (so an unvalidatable post_logout_redirect_uri
is always refused).
Resolve the client_post_logout_redirect_uris callback. See resolve_callback/2.
Resolve the client_public? callback. See resolve_callback/2.
Resolve the client_redirect_uris callback. See resolve_callback/2.
Resolve the client_registration_access_token_hash callback. See resolve_callback/2.
Resolve the client_registration_metadata callback. See resolve_callback/2.
Resolve the client_requires_dpop? callback. See resolve_callback/2.
Resolve the client_requires_mtls? callback. See resolve_callback/2.
@spec client_secret_auth_method_policy(t()) :: :strict | :observe
Whether Basic/POST transport mismatches are enforced or observed during migration.
Resolve and load the host's client by client_id (RFC 6749 §2.2).
A required callback (:load_client / AttestoPhoenix.ClientStore); this
helper invokes the resolved callback so consumers do not re-derive it.
Resolve and run the host's constant-time client-secret verification
(RFC 6749 §2.3.1) for client/presented_secret.
Resolve the client_subject_type callback. See resolve_callback/2.
Resolve the client_userinfo_signed_response_alg callback. See resolve_callback/2.
Resolve the consent callback. See resolve_callback/2.
Returns the configured single-use consent-grant store module, or nil.
The store implements AttestoPhoenix.ConsentGrantStore (the RFC 6749 §4.1.1
request-bound consent primitive). There is no default: the library renders no
consent screen, so a host wires :consent_grant_store only when it adopts the
primitive (typically AttestoPhoenix.Store.EctoConsentGrantStore). A host's
consent UI and its :consent callback read it through this helper.
The configured OID4VCI credential-configuration catalog, or nil.
The EC P-256 keystore for OID4VCI Credential Request and Response encryption, or nil.
Whether OID4VCI Credential Request and Response encryption is mandatory (default false).
Absolute URL of the OID4VCI credential endpoint.
The resolved request path of the OID4VCI credential-offer endpoint.
The configured Attesto.CredentialOfferStore module, or nil.
The resolved request path of the OID4VCI credential endpoint.
The resource identifiers the host chose for a request that names none.
Invokes the resource_indicators: [default_resources_for: callback]
callback with the client and the effective scope. Returns [] when no
callback is configured. The result is not authorized here: callers pass it
through the same RFC 8707 checks as a requested resource. Raises
RuntimeError when the callback returns anything but a list.
Whether a resource_indicators: [default_resources_for: callback] is configured.
Absolute URL of the OID4VCI deferred-credential endpoint.
The resolved request path of the OID4VCI deferred-credential endpoint.
The merged, defaulted RFC 8628 device-authorization options.
Returns true iff the RFC 8628 device authorization grant is enabled
(device_authorization: [enabled: true]). When enabled, device_code is
added to grant_types_supported/1 only when that setting is nil, and the
device_authorization_endpoint is advertised. An explicit grant catalog
must include urn:ietf:params:oauth:grant-type:device_code.
Absolute URL of the device-authorization endpoint (advertised as device_authorization_endpoint, RFC 8628 §4).
The resolved request path of the device-authorization endpoint (RFC 8628).
The configured Attesto.DeviceCodeStore module, or nil.
Absolute URL of the device-verification page.
The resolved request path of the device-verification page (RFC 8628 §3.3).
The RFC 8628 §3.2 verification URI shown to the user: the configured
device_authorization: [verification_uri: ...] override, otherwise the
issuer-derived device-verification endpoint URL.
@spec ecto_repo!() :: module()
Returns the configured Ecto repository, raising when it is unset.
A validated request-local config always wins. Without a request config, the
host config under the configured :otp_app is used. A package-level :repo
is retained only for legacy deployments that have no :otp_app pointer; it
is never used to rescue a missing or malformed request/host config.
missing_message is available for adapters that have a more specific
existing error message; the lookup and default failure stay shared.
Returns the normalized scope catalog shared by authorization-server surfaces.
Absolute URL of the end-session endpoint (advertised as end_session_endpoint, RP-Initiated Logout 1.0 §2).
The resolved request path of the end-session endpoint (RP-Initiated Logout 1.0).
The OpenID Federation superior entity identifiers, or nil.
The OpenID Federation entity-type metadata map, or nil.
Reads the config for otp_app under key (default AttestoPhoenix.Config)
from the application environment and builds a validated config.
Returns true iff the OP passes iss/sid query parameters on the rendered
frontchannel_logout_uri (advertised as frontchannel_logout_session_supported,
Front-Channel Logout 1.0 §3). attesto always includes both whenever the
session's sid is known, so this tracks frontchannel_logout_supported?/1.
Returns true iff Front-Channel Logout is supported — logout is enabled AND a
:logout_session_store is wired (advertised as frontchannel_logout_supported,
Front-Channel Logout 1.0 §3). The store is what lets the end-session endpoint
enumerate the RPs whose frontchannel_logout_uri the logout page must render.
The grant types the authorization server supports.
Advertised as grant_types_supported (RFC 8414 §2) by both discovery documents
and enforced by the token endpoint — a grant_type outside this set is rejected
as unsupported_grant_type before dispatch. When unset, defaults to every
grant the token endpoint implements (["authorization_code", "refresh_token", "client_credentials", "urn:ietf:params:oauth:grant-type:token-exchange"])
plus enabled optional-feature grants. When set, the list is exact, including
[]; include the exact optional-feature URN yourself when the feature is
enabled. This same catalog drives discovery, endpoint enforcement, and
dynamic registration.
The merged, defaulted OAuth Identity and Authorization Chaining Across Domains
(draft-ietf-oauth-identity-chaining-17 / RFC 10092) options.
Returns true iff Trust Domain A identity-chaining ID-JAG issuance is enabled
(identity_chaining: [enabled: true, ...]).
Absolute URL of the token introspection endpoint (RFC 7662): the issuer merged
with introspection_path/1. Advertised as introspection_endpoint.
The resolved request path of the token introspection endpoint (RFC 7662). See
authorize_path/1.
Absolute URL of the JWK Set document (RFC 7517 §5; the jwks_uri per
RFC 8414 §2). This library keeps the JWKS document outside
:oauth_path_prefix, but preserves a tenant path carried by :issuer.
Returns the merged, defaulted Identity Assertion JWT Authorization Grant
(ID-JAG / jwt-bearer) options.
The merged options control issuer trust, public-client eligibility, assertion
lifetime, granted authorization detail types, and remote key lookup. See
AttestoPhoenix.AuthorizationServer.JwtBearer and the ID-JAG guide.
Returns true iff the Identity Assertion JWT Authorization Grant (ID-JAG /
jwt-bearer) is enabled.
The feature is off unless the host sets jwt_bearer: [enabled: true, ...].
When enabled and grant_types_supported is nil,
urn:ietf:params:oauth:grant-type:jwt-bearer is added to
grant_types_supported/1 (so both discovery and the token endpoint honour it).
An explicit grant catalog must include that URN when this feature is used.
Trusted keys for verifying a key_attestation header in a credential proof.
Returns an RFC 7517 JWK Set, a single public JWK map, a list of public JWK
maps, or nil when key-attestation verification is disabled.
The configured keystore used for ID-token and authorization-server signing.
Resolve the load_client callback. See resolve_callback/2.
Resolve the load_principal callback. See resolve_callback/2.
The merged, defaulted OpenID Connect logout (RP-Initiated + Back-Channel) options.
Returns true iff OpenID Connect logout is enabled (logout: [enabled: true]).
When enabled, the end_session_endpoint is advertised and (with a
:logout_session_store wired) Back-Channel Logout is supported. The host MUST
ALSO pass logout: true to attesto_routes/1 to mount the endpoint.
The configured Attesto.LogoutSessionStore module (Back-Channel Logout), or nil.
@spec logout_session_ttl_seconds(t()) :: pos_integer()
How long a recorded back-channel-logout session lives before it is swept, in seconds.
@spec native_app_loopback_matching(t()) :: Attesto.RedirectURI.matching()
The redirect-URI matching mode a loopback-capable client gets: RFC 8252 §7.3
port flexibility for the IP literals, widened to the bare localhost name
iff the host opted in with native_apps: [loopback_include_localhost: true].
This resolves WHICH loopback mode applies, not WHETHER one does - the caller
(AttestoPhoenix.AuthorizationServer.RequestPolicy.redirect_uri_matching/2)
still gates on the client being native (or a CIMD document declaring a
loopback redirect URI) and on native_app_loopback_redirect?/1, and resolves
:exact when either gate refuses.
Returns true unless the host has forbidden RFC 8252 §7.3 loopback interface
redirection server-wide with native_apps: [loopback_redirect: false].
This is an opt-OUT: §7.3 states the port allowance as a MUST, so it follows
from a client being marked native (:client_native?, itself defaulting to
false) rather than from a second flag. Even enabled, the exception applies
only to a native client and only to http://127.0.0.1/... /
http://[::1]/... redirect URIs; see
AttestoPhoenix.AuthorizationServer.RequestPolicy.redirect_uri_matching/2 and
Attesto.RedirectURI.
Returns the merged, defaulted RFC 8252 native-app profile options, so every
recognized member (:loopback_redirect, :loopback_include_localhost,
:reject_embedded_user_agents) is always present.
Builds and validates a config from a keyword list or map.
Raises ArgumentError if a required key is missing or if a dependent key is
absent for an enabled feature (e.g. :register_client when
:registration_enabled, or :cert_der when :mtls_enabled).
Absolute URL of the OID4VCI nonce endpoint.
The resolved request path of the OID4VCI nonce endpoint.
Resolve the on_event callback. See resolve_callback/2.
Returns whether this authorization server is configured as an OpenID Provider.
Absolute URL of the pushed-authorization-request endpoint: the issuer merged
with par_path/1. Advertised as pushed_authorization_request_endpoint
(RFC 9126 §5).
The resolved request path of the pushed-authorization-request endpoint
(RFC 9126). See authorize_path/1.
The configured Attesto.PreAuthorizedCodeStore module, or nil.
Absolute URL of the OID4VP request-object endpoint.
The resolved request path of the OID4VP request-object endpoint.
Absolute URL of the OID4VP direct-post response endpoint.
The OID4VP direct-post response mode advertised to wallets.
The resolved request path of the OID4VP direct-post response endpoint.
The configured Attesto.PresentationSessionStore module, or nil.
Returns the RFC 9728 catalog without copying centrally added OIDC scopes.
The host's optional wrapper around the refresh grant's rotation and mint.
See the :refresh_completion option. When nil, the token endpoint rotates
and mints directly.
Declared persistence backend for refresh migration and Ecto configuration checks.
The direct Ecto store resolves automatically. Wrappers declare
refresh_store_backend: AttestoPhoenix.Store.EctoRefreshStore; token
operations continue to use the configured :refresh_store wrapper.
Resolve the register_client callback. See resolve_callback/2.
Absolute URL of an individual registered client's RFC 7592 management
endpoint: the registration endpoint URL with the URL-encoded client_id
appended. Returned as registration_client_uri in the RFC 7591 §3.2.1
client information response.
Application type used only for registration requests that omit the member.
The scope a dynamically registered client is assigned when its registration
request omits scope (RFC 7591 §2: the authorization server MAY register a
default scope). Resolves the :registration_default_scope setting to a
concrete list:
:scopes_supported— every scope in the effective authorization-server catalog.- a list of scope strings — that explicit default (the registration layer still rejects any member outside the effective catalog).
nil(the default) — no defaulting; a scopeless registration stays scopeless (fail-closed).
Returns the resolved list, or nil when no default applies.
Absolute URL of the dynamic client registration endpoint: the issuer merged
with registration_path/1. Advertised as registration_endpoint (RFC 7591
§3) only when registration is enabled.
The grant types a dynamic registration (RFC 7591 §2) may request.
Resolves :registration_grant_types: an explicit list is returned as
configured (validated at boot to be a subset of grant_types_supported/1);
nil (the default) resolves to the supported grants in which a resource
owner approves the client: authorization_code, refresh_token, and the
RFC 8628 device grant.
The resolved request path of the dynamic client registration endpoint
(RFC 7591). See authorize_path/1.
Returns true iff the authorization endpoint should refuse requests that
appear to come from an embedded user agent (RFC 8252 §8.12).
Off unless the host sets native_apps: [reject_embedded_user_agents: true].
The detection is a heuristic; see
AttestoPhoenix.RequestContext.embedded_user_agent?/1.
@spec request_config() :: t() | nil
Return the bounded operation's request config, or nil outside one.
Whether a credential proof MUST carry a verified key_attestation header.
@spec resolve!() :: t()
Resolves the validated config from the library's configured :otp_app.
This is the shared resolution path for controllers that read the global
application configuration. Configure the pointer with
config :attesto_phoenix, otp_app: :my_app; the Igniter installer writes it
together with the repo used by the bundled Ecto stores.
@spec resolve!(Plug.Conn.t()) :: t()
Resolves the validated config installed on a request connection.
Controllers must use this request-scoped value so a host can select a
validated configuration per request. A missing or malformed private value is
a pipeline wiring error and fails closed with ArgumentError; this function
never falls back to application configuration.
Resolve a configured callback by its flat key.
Precedence (see the "Behaviour-module Config keys" section): the explicit
flat key wins when set; otherwise the installed behaviour module wins when it
exports the corresponding behaviour callback; otherwise nil. The result is a
value an AttestoPhoenix.Callback.invoke/2,3 caller can run (an anonymous
function, a {module, function} pair, a {module, function, extra_args}
triple), or nil.
Resolve the resolve_jwt_bearer_subject callback. See resolve_callback/2.
Returns the merged, defaulted RFC 8707 Resource Indicators options
(:allowed_resources, :allowed_resources_for, :default_resources_for).
@spec resource_metadata_url(t(), Plug.Conn.t(), keyword()) :: String.t() | nil
Selects the RFC 9728 protected-resource metadata URL for conn.
A configured :resource_metadata_resolver is authoritative and may return
an absolute HTTPS URL or nil to omit the resource_metadata auth-param for
this request. Without a resolver, the static :resource_metadata value is
returned unchanged. Invalid resolver results are omitted so a challenge
never advertises an unusable or unsafe metadata URI. The resolver runs once
per protected-resource request, including requests that authenticate
successfully, because the selected URI must be in place before verification
renders any challenge. Resolver exceptions are deliberately not rescued:
trusted configuration that raises aborts the request - successful ones
included - instead of disguising a host failure as an authentication
response.
The optional third argument is a plug option list. When it contains
:resource_metadata, that explicit value (including nil) is authoritative,
is validated by the same rules, and the configured resolver is not invoked.
This keeps a per-plug override consistent across every error path.
Absolute URL of the revocation endpoint: the issuer merged with
revocation_path/1. Advertised as revocation_endpoint (RFC 8414 §2,
RFC 7009).
The resolved request path of the revocation endpoint (RFC 7009). See
authorize_path/1.
@spec schema_prefix() :: String.t() | nil
Resolve the public PostgreSQL schema prefix from a validated config.
@spec schema_prefix(t() | Plug.Conn.t()) :: String.t() | nil
The merged, defaulted OpenID Connect Session Management 1.0 options.
Returns true iff OpenID Connect Session Management 1.0 is enabled
(session_management: [enabled: true]). When enabled, the discovery document
advertises check_session_iframe, the authorization endpoint returns
session_state on authorization responses, and the OP browser-state cookie
is maintained. The host MUST ALSO pass session_management: true to
attesto_routes/1 to mount the iframe endpoint.
The configured default audience plus static RFC 8707 resource identifiers.
Unlike allowed_resources/2, this does not invoke the per-client issuance
callback. It is the safe fallback when no verified original OAuth client is
available, including malformed or legacy tokens during introspection.
Absolute URL of the Token Status List endpoint.
The resolved request path of the Token Status List endpoint.
The configured Attesto.StatusListStore module, or nil.
@spec table_prefix() :: String.t() | nil
Resolve the Ecto schema prefix for the current operation.
A request-local config installed by with_request_config/2 wins. Without
one, the fallback is the validated host AttestoPhoenix.Config read under
the configured :otp_app; this function deliberately does not consult a
separate config :attesto_phoenix, :table_prefix key. In 3.0 the public
option is :schema_prefix; :table_prefix is reserved for the internal
accessor retained for store compatibility.
@spec table_prefix(t() | Plug.Conn.t()) :: String.t() | nil
Resolve the prefix from an explicit config or connection.
@spec to_attesto_config(t(), keyword()) :: Attesto.Config.t()
Derives the Attesto.Config consumed by the protocol layer from this config.
The protocol layer owns only the claim-level policy (:issuer, :audience,
:keystore, the principal kinds, and the default access-token lifetime). The
refresh/code TTLs and the DPoP/mTLS feature toggles are read directly from
this struct by the controllers and plugs, so they are not duplicated into the
Attesto.Config.
During with_request_config/2, the configured :principal_kinds list or
callback and the resulting core config are resolved once and cached for that
request process. Outside a request scope, or when extra is non-empty, a
fresh core config is built. An explicit extra value still wins over the
derived values. Any other Attesto.Config.new/1 option may be supplied as
extra; those options are merged over the values derived here.
The client-authentication methods accepted at the token, PAR, and revocation endpoints. Endpoint-specific policies may narrow this catalog.
This is the single catalog used by endpoint enforcement, discovery, and
dynamic registration. Revocation advertises this effective catalog through
revocation_endpoint_auth_methods_supported. When no explicit catalog is configured, wallet
attestation is added only when trusted Wallet Provider keys are available.
An explicitly configured catalog is never widened. The wallet-attestation
method is omitted whenever its trusted verification keys are absent, including
from an explicit list.
Absolute URL of the token endpoint: the issuer merged with token_path/1.
Advertised as token_endpoint (RFC 8414 §2).
The resolved request path of the token endpoint. See authorize_path/1.
Trusted Wallet Provider keys for attestation-based client authentication.
Returns an RFC 7517 JWK Set, a single public JWK map, a list of public JWK
maps, or nil when attest_jwt_client_auth is disabled.
Resolve the unregister_client callback. See resolve_callback/2.
Resolve the update_client callback. See resolve_callback/2.
Absolute URL of the UserInfo endpoint: the issuer merged with
userinfo_path/1. This is the URL selected by
userinfo_endpoint: :derived; an explicit URL or nil remains
authoritative in Provider Metadata.
The resolved request path of the UserInfo endpoint (OpenID Connect Core
§5.3). See authorize_path/1.
The keystore used to sign issued Verifiable Credentials; defaults to
:keystore. Configure a separate EC/ES256 keystore here to issue
ES256-signed credentials (e.g. for HAIP) while ID tokens keep their own
signing key.
Returns the PEM used to sign issued Verifiable Credentials.
The VC keystore's raw X.509 certificate-chain callback value, or nil.
A list of base64 DER certificate strings stamped as the issued credential's
JOSE x5c header (HAIP), sourced from the VC keystore's optional x5c/0
callback. nil when the keystore does not provide one. Credential issuance
validates the callback value and rejects malformed chains.
Accepted credential issuer algorithms, forwarded to core as :accepted_algs.
The optional host policy applied after core certificate validation.
The verifier client identifier used as the OID4VP presentation audience.
The OID4VP verifier client-id scheme, or nil for the default behavior.
The configured DC API page origin; never derived from HTTP input.
The dNSName advertised by an x509_san_dns verifier.
The dedicated EC P-256 keystore for encrypted OID4VP responses, or nil.
Whether to enforce HAIP certificate restrictions (default true).
@spec verifier_issuer_trust(t()) :: {:issuer_jwks, map() | list()} | {:resolve_issuer, callback()} | nil
The default issuer keys or resolver used when no per-request trust is supplied.
The optional status-list fetch callback; nil selects the screened default fetcher.
The issuer trust anchors as DER certificates, or nil for key-based trust.
The verifier certificate chain as DER binaries, leaf first.
Resolve the verify_client_secret callback. See resolve_callback/2.
Resolve the verify_dummy_client_secret callback. See resolve_callback/2.
@spec with_request_config(t(), (-> result)) :: result when result: var
Run a conn-free callback with config as the request-local configuration.
The previous process-local value is restored even if fun raises. This is
useful to hosts that invoke a store outside the normal Plug request path.