Struct ProviderRegistry
pub struct ProviderRegistry { /* private fields */ }Expand description
The configured set of providers, consulted in order. Default-deny: if no
provider accepts-and-authenticates the credential, the outcome is
AuthOutcome::Denied. An empty registry rejects everything.
Implementations§
Source§impl ProviderRegistry
impl ProviderRegistry
pub fn new() -> Self
Sourcepub fn register(&mut self, provider: Arc<dyn AuthProvider>)
pub fn register(&mut self, provider: Arc<dyn AuthProvider>)
Register a provider (boot-time wiring).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
true if no provider is configured (default-deny will reject all).
Sourcepub fn advertised_methods(&self) -> Vec<AuthMethod>
pub fn advertised_methods(&self) -> Vec<AuthMethod>
The methods this registry advertises (for the handshake authMethods).
Sourcepub fn names(&self) -> Vec<&str>
pub fn names(&self) -> Vec<&str>
The configured provider names, in registration order — the enumeration surface exposes over RPC (no hardcoded provider lists).
Sourcepub async fn resolve(&self, credential: &Credential) -> AuthOutcome
pub async fn resolve(&self, credential: &Credential) -> AuthOutcome
Resolve a presented credential to an AuthOutcome, default-deny and
authoritative-deny.
The first accepting provider that authenticates wins. The key safety rule:
a provider that accepts a credential but rejects it with a specific
DenyReason (anything other than the generic DenyReason::BadCredential
— e.g. DenyReason::MfaRequired, DenyReason::TokenExpired,
DenyReason::Misconfigured, DenyReason::AliasNotEntitled) is
authoritative: that outcome is returned immediately so a later,
more broadly-accepting provider can NOT authenticate the same presented
credential past it (e.g. an OIDC provider returning MfaRequired for a
bearer token can’t be bypassed by a later catch-all bearer provider). Only
the generic BadCredential (“not my credential / wrong secret”) lets the
registry fall through to the next accepting provider. None is denied
before any provider runs. An empty registry denies everything.
Trait Implementations§
Source§impl Default for ProviderRegistry
impl Default for ProviderRegistry
Source§fn default() -> ProviderRegistry
fn default() -> ProviderRegistry
Auto Trait Implementations§
impl Freeze for ProviderRegistry
impl !RefUnwindSafe for ProviderRegistry
impl Send for ProviderRegistry
impl Sync for ProviderRegistry
impl Unpin for ProviderRegistry
impl UnsafeUnpin for ProviderRegistry
impl !UnwindSafe for ProviderRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more