AttestoPhoenix.RouteControls (AttestoPhoenix v5.0.0)

Copy Markdown View Source

Which optional protocol routes attesto_routes/1 left unmounted.

par: false, revocation: false, introspection: false, registration_read: false and registration_update: false are compile-time router options, while the metadata documents are built at request time from AttestoPhoenix.Config. The macro records the omitted routes on the routes that need to know (both metadata documents and the authorization endpoint), and this module is the one place that reads the record back, so the RFC 8414 document and the OpenID Provider document cannot disagree about which endpoints exist.

Registration management routes also read this record when constructing their Allow header (RFC 9110 §10.2.1). Omitting read or update does not remove the registration endpoint from discovery.

Summary

Functions

Raise when the router omits the PAR endpoint while the configuration requires pushed authorization requests (RFC 9126 §5).

The route controls this module tracks.

Remove the metadata members of every omitted route from metadata.

The routes the macro that dispatched conn left unmounted.

The conn.private key the router macro records omitted routes under.

Types

control()

@type control() ::
  :par
  | :revocation
  | :introspection
  | :registration_read
  | :registration_update

Functions

check_par!(conn, config)

@spec check_par!(Plug.Conn.t(), AttestoPhoenix.Config.t()) :: :ok

Raise when the router omits the PAR endpoint while the configuration requires pushed authorization requests (RFC 9126 §5).

No client could complete an authorization request under that combination. The router options are compile-time and the configuration is resolved per request, so nothing sees both at boot; the check runs on the metadata and authorization routes instead.

controls()

@spec controls() :: [control()]

The route controls this module tracks.

drop_omitted(metadata, omitted)

@spec drop_omitted(map(), [control()]) :: map()

Remove the metadata members of every omitted route from metadata.

omitted(conn)

@spec omitted(Plug.Conn.t()) :: [control()]

The routes the macro that dispatched conn left unmounted.

private_key()

@spec private_key() :: atom()

The conn.private key the router macro records omitted routes under.