pub struct AuthPlugin { /* private fields */ }Expand description
Process-wide AuthPlugin singleton storing AuthConfig and the active Authenticator.
Implementations§
Source§impl AuthPlugin
Inherent implementation of AuthPlugin.
impl AuthPlugin
Inherent implementation of AuthPlugin.
Sourcepub fn init(
config: AuthConfig,
authenticator: SharedAuthenticator,
) -> &'static Self
pub fn init( config: AuthConfig, authenticator: SharedAuthenticator, ) -> &'static Self
Initializes the global AuthPlugin once with config and authenticator.
§Arguments
AuthConfig- Path-exclusion and RBAC policy.SharedAuthenticator- Pluggable authenticator implementation.
§Returns
&'static Self- Reference to the initialized global plugin.
Sourcepub fn get() -> Option<&'static Self>
pub fn get() -> Option<&'static Self>
Returns the initialized global AuthPlugin, if initialized.
§Returns
Option<&'static Self>- Reference to the global plugin, orNone.
Sourcepub fn get_config(&self) -> &AuthConfig
pub fn get_config(&self) -> &AuthConfig
Sourcepub fn get_authenticator(&self) -> &SharedAuthenticator
pub fn get_authenticator(&self) -> &SharedAuthenticator
Sourcepub fn principal(ctx: &Context) -> Option<AuthPrincipal>
pub fn principal(ctx: &Context) -> Option<AuthPrincipal>
Retrieves the verified AuthPrincipal previously stored in ctx by AuthHook.
§Arguments
&Context- Request context.
§Returns
Option<AuthPrincipal>- Verified caller principal, if authenticated.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AuthPlugin
impl !UnwindSafe for AuthPlugin
impl Forget for AuthPlugin
impl Freeze for AuthPlugin
impl Move for AuthPlugin
impl Send for AuthPlugin
impl Sync for AuthPlugin
impl Unpin for AuthPlugin
impl UnsafeUnpin for AuthPlugin
Blanket Implementations§
impl<T> AnySend for T
impl<T> AnySendClone for T
impl<T> AnySendSync for T
impl<T> AnySendSyncClone for T
impl<T> AnySync for T
impl<T> AnySyncClone for T
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
Mutably borrows from an owned value. Read more