pub struct AuthorizerSet { /* private fields */ }Expand description
A set of IDynamicAuthorizer instances collected from the DI container.
Created automatically in HostBuilder::build() when one or more
IDynamicAuthorizer implementations are registered. If none are registered,
this is None and no dynamic authorization checks run.
Implementations§
Source§impl AuthorizerSet
impl AuthorizerSet
Sourcepub fn new(authorizers: Vec<Arc<dyn IDynamicAuthorizer>>) -> Self
pub fn new(authorizers: Vec<Arc<dyn IDynamicAuthorizer>>) -> Self
Create a new set from a vector of authorizers.
Run all registered authorizers in sequence.
Returns Ok(()) if ALL authorizers pass. Returns the first Err if any denies.
1.1 compatibility — new code should call
AuthorizerSet::authorize_with_rules instead, which passes the
endpoint’s declared rules. This method is equivalent to that call with an
empty declaration.
Run all registered authorizers in sequence, handing them the matched
endpoint’s #[authorize] declaration.
Legacy since 1.3.0 — the host now calls
AuthorizerSet::authorize_with_declared_rules, which passes the raw
&'static [AuthorizeRule] slice. This wrapper stays for source
compatibility with 1.2.0 callers.
Returns Ok(()) if ALL authorizers pass. Returns the first Err if any denies.
Run all registered authorizers in sequence, handing them the matched
endpoint’s #[authorize] declaration as the raw slice the route
metadata owns (RouteEntry.authorization).
This is the 1.3.0 primary path — zero allocation, and the declaration is
the same &'static [AuthorizeRule] a dynamic endpoint delegates in full
(#[authorize(dynamic)]). Implementations that override only the legacy
authorize / authorize_with_rules methods keep working through the
trait’s default forwarding.
Returns Ok(()) if ALL authorizers pass. Returns the first Err if any denies.