Skip to main content

Gate

Trait Gate 

Source
pub trait Gate:
    Send
    + Sync
    + Debug {
    // Required method
    fn check(&self, req: &GateRequest) -> Result<GateDecision, GateError>;

    // Provided method
    fn impl_name(&self) -> &'static str { ... }
}
Expand description

Authorization gate consulted before each verb dispatch.

Implementations live downstream:

  • AllowAllGate (this crate) — permissive default
  • RegoGate (Apache-2.0 sibling crate khive-gate-rego) — regorus-backed Rego eval

Downstream crates may provide additional implementations, including wrappers that compose another Gate to add stronger enforcement guarantees.

Required Methods§

Source

fn check(&self, req: &GateRequest) -> Result<GateDecision, GateError>

Evaluates the authorization policy for req and returns a decision.

Provided Methods§

Source

fn impl_name(&self) -> &'static str

Short name of this backend — surfaced in audit events so downstream tooling can tell results from different gate implementations apart (including a wrapper from the gate it wraps) without parsing the type.

Defaults to std::any::type_name::<Self>().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§