Spikard.AuthorizationConfig (spikard v0.17.0)

Copy Markdown

Per-route roles/scopes/permissions authorization requirement.

spikard_http::auth::Claims does not yet carry roles, scopes, or permissions, so nothing can enforce this today. This type only defines the requirement shape; a later phase must extend Claims (or an equivalent claims-decoding path) to populate them before enforcement is possible.

Deserialization goes through [AuthorizationConfigRepr] rather than a derive so the fixture's singular {"required_role": "admin"} shape (fixtures/problem_details.json's problem_details_403_forbidden) populates required_roles instead of being silently dropped as an unrecognized field — a config that parses to "no constraint" from real authorization data is a vacuous-pass bug, not a compatibility shim. deny_unknown_fields on the repr means any other unrecognized key is a loud deserialize error instead.

Summary

Types

t()

Per-route roles/scopes/permissions authorization requirement.

Types

t()

@type t() :: %Spikard.AuthorizationConfig{
  require_all: boolean(),
  required_permissions: [String.t()],
  required_roles: [String.t()],
  required_scopes: [String.t()]
}

Per-route roles/scopes/permissions authorization requirement.