FastestMCP.Authorization (fastest_mcp v0.3.0)

Copy Markdown View Source

Component-level authorization checks layered on top of authentication.

Checks run after authentication has resolved verified authorization evidence onto the shared context. Unauthorized components are filtered from list operations and rejected with :forbidden on direct access.

Summary

Functions

Applies authorization checks to a component for the current operation.

Normalizes input into the runtime shape expected by this module.

Builds a capability-based authorization rule.

Builds a scope-based authorization rule.

Builds a tag-based authorization rule.

Runs authorization checks against the current context.

Transforms input into the normalized runtime representation used by this module.

Types

check()

check_result()

@type check_result() :: boolean() | :ok | {:error, String.t()}

Functions

authorize_component(component, context, operation)

Applies authorization checks to a component for the current operation.

normalize(checks)

Normalizes input into the runtime shape expected by this module.

require_capabilities(capability)

Builds a capability-based authorization rule.

require_capabilities(first_capability, more_capabilities)

require_scopes(resolver)

Builds a scope-based authorization rule.

require_scopes(first_scope, more_scopes)

restrict_tag(tag, opts \\ [])

Builds a tag-based authorization rule.

run_checks(checks, context)

Runs authorization checks against the current context.

transform(checks, opts \\ [])

Transforms input into the normalized runtime representation used by this module.