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: Arc<dyn Authenticator>,
) -> &'static Self
pub fn init( config: AuthConfig, authenticator: Arc<dyn Authenticator>, ) -> &'static Self
Initializes the global AuthPlugin once with config and authenticator.
§Arguments
AuthConfig- Path-exclusion and RBAC policy.Arc<dyn Authenticator>- 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) -> &Arc<dyn Authenticator> ⓘ
pub fn get_authenticator(&self) -> &Arc<dyn Authenticator> ⓘ
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 AuthPluginwhere
*const u8 is !null: Freeze,
PhantomData<String>: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<dyn Authenticator> is !null: Freeze,
PhantomData<ArcInner<dyn Authenticator>>: Freeze,
PhantomData<fn() -> XxHash3_64>: Freeze,
PhantomData<(String, ())>: Freeze,
impl Move for AuthPlugin
impl Send for AuthPlugin
impl Sync for AuthPlugin
impl Unpin for AuthPlugin
impl UnsafeUnpin for AuthPluginwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<dyn Authenticator> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Authenticator>>: UnsafeUnpin,
PhantomData<fn() -> XxHash3_64>: UnsafeUnpin,
PhantomData<(String, ())>: UnsafeUnpin,
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