Authorize Method • AI Agent SDK

authorize_method: Central, default-deny authorisation gate for a gateway method.

authorize_method

Function

</div>

This function is defined in the protocols module.

Central, default-deny authorisation gate for a gateway method.

Resolves the required scope from the single source of truth (:func:resolve_required_scope) — so an unclassified/plugin-registered method is `ADMIN-only by omission rather than reachable ungated — and raises :class:GatewayUnauthorized when client_scopes` do not satisfy it. Dispatch calls this once, centrally, instead of scattering per-endpoint checks that can drift from the registry.

Signature

python
def authorize_method(method: str, client_scopes: 'Set[OperatorScope]', params: Optional[Dict[str, Any]]) -> None

Parameters

ParamField str

No description available.

ParamField 'Set[OperatorScope]'

No description available.

ParamField Optional

No description available.

Uses

  • resolve_required_scope
  • GatewayUnauthorized

Source

View on GitHub

praisonaiagents/gateway/protocols.py at line 7899