PolicyEngine#
authx.policy.PolicyEngine #
Evaluate policy rules for AuthX-managed identities.
Initialize the policy engine.
| PARAMETER | DESCRIPTION |
|---|---|
rules | Initial policy rules. TYPE: |
evaluators | Global custom evaluators that must pass for matching rules. TYPE: |
default_allow | Whether to allow requests when no rule matches. TYPE: |
Source code in authx/policy.py
add_rule #
add_evaluator #
evaluate async #
Evaluate context against registered rules.
Explicit deny rules win over allow rules. If no rule matches, the configured default decision is returned.
Source code in authx/policy.py
PolicyRule#
authx.policy.PolicyRule dataclass #
PolicyRule(effect, actions, resources, conditions=list(), scopes=None, all_scopes_required=True, evaluators=list(), reason=None)
A single authorization rule.
matches_action #
Return whether the requested action matches this rule.
matches_resource #
Return whether the requested resource matches this rule.
matches_scopes #
Return whether token scopes satisfy this rule.
Source code in authx/policy.py
PolicyContext#
authx.policy.PolicyContext dataclass #
PolicyContext(login_type, action, resource, payload=None, request=None, subject=None, resource_attrs=None, environment=dict())
Context passed to policy evaluators.
get_source #
Return a named source for policy conditions.
Source code in authx/policy.py
PolicyDecision#
authx.policy.PolicyDecision dataclass #
PolicyEvaluator#
authx.policy.PolicyEvaluator #
Bases: Protocol
Protocol for custom policy evaluators.
PolicyCondition#
authx.policy.PolicyCondition dataclass #
A condition evaluated against a policy context source.
matches #
Return whether this condition matches the given context.