pub struct SessionManagementPlugin { /* private fields */ }Expand description
Session management plugin for handling session operations
Implementations§
Source§impl SessionManagementPlugin
impl SessionManagementPlugin
pub fn new() -> Self
pub fn with_config(config: SessionManagementConfig) -> Self
pub fn enable_session_listing(self, val: bool) -> Self
pub fn enable_session_revocation(self, val: bool) -> Self
pub fn require_authentication(self, val: bool) -> Self
Trait Implementations§
Source§impl<S: AuthSchema> AuthPlugin<S> for SessionManagementPlugin
impl<S: AuthSchema> AuthPlugin<S> for SessionManagementPlugin
Source§fn static_openapi_metadata(&self) -> PluginOpenApiMetadata
fn static_openapi_metadata(&self) -> PluginOpenApiMetadata
Base declarations for documentation without an initialized auth instance.
Source§fn openapi_metadata(&self, ctx: &AuthInitContext<S>) -> PluginOpenApiMetadata
fn openapi_metadata(&self, ctx: &AuthInitContext<S>) -> PluginOpenApiMetadata
Documentation annotations collected after all plugins initialize.
Override this hook for custom endpoints and model field policies.
Source§fn on_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<AuthResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<AuthResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called for each request - return Some(response) to handle, None to pass through
Source§fn rate_limits(&self) -> Vec<PluginRateLimit>
fn rate_limits(&self) -> Vec<PluginRateLimit>
Ordered rate-limit policies supplied by this installed plugin.
Source§fn server_endpoints(&self) -> Vec<EndpointDefinition>
fn server_endpoints(&self) -> Vec<EndpointDefinition>
Trusted operations available through host dispatch, independently of HTTP visibility.
Source§fn endpoint_hooks(&self) -> Vec<&dyn EndpointHook<S>>
fn endpoint_hooks(&self) -> Vec<&dyn EndpointHook<S>>
Installed logical-call hooks, in this plugin’s registration order.
Source§fn validate_endpoint(
&self,
call: &EndpointCall,
_ctx: &AuthContext<S>,
) -> Result<EndpointInput, AuthError>
fn validate_endpoint( &self, call: &EndpointCall, _ctx: &AuthContext<S>, ) -> Result<EndpointInput, AuthError>
Validate actual input after all before-hook patches have been applied. Read more
Source§fn on_endpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_call: &'life1 EndpointCall,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<EndpointResponse, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_endpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_call: &'life1 EndpointCall,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<EndpointResponse, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Execute a registered operation with validated handler-phase context. Read more
Source§fn allowed_media_types(&self, _route: &AuthRoute) -> Vec<&'static str>
fn allowed_media_types(&self, _route: &AuthRoute) -> Vec<&'static str>
Media types accepted before request hooks and endpoint dispatch. An empty
list disables the media restriction for an application-owned endpoint.
Source§fn session_fields(&self) -> IndexMap<String, FieldConfig>
fn session_fields(&self) -> IndexMap<String, FieldConfig>
Session field policies contributed by this registered plugin.
fn user_fields(&self) -> IndexMap<String, FieldConfig>
fn account_fields(&self) -> IndexMap<String, FieldConfig>
Source§fn on_init<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut AuthInitContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn on_init<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 mut AuthInitContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Called when the plugin is initialized
Source§fn on_http_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_http_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Inspect the original physical HTTP request before routing, body parsing,
origin validation and endpoint hooks. Disabled paths and transport/rate
limiting middleware run first. Returning a response stops dispatch and
later plugin hooks. Server-only endpoint calls do not invoke this hook.
Source§fn on_http_request_action<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<HttpRequestAction>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_http_request_action<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<HttpRequestAction>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Inspect or replace the physical request. The default preserves existing
on_http_request implementations. Request-local configuration has already
been resolved from the incoming request, matching the Source HTTP handler.Source§fn on_http_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
_response: &'life3 AuthResponse,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn on_http_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
_response: &'life3 AuthResponse,
) -> Pin<Box<dyn Future<Output = Result<Option<AuthResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Observe the routed HTTP response before transport middleware (including CORS).
Hooks run in registration order; the first replacement stops this chain.
Early HTTP request-hook responses skip this stage. Errors escape dispatch;
they cannot reverse writes already committed by an endpoint.
Source§fn before_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<BeforeRequestAction>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn before_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<BeforeRequestAction>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Called after route matching and before endpoint dispatch. Read more
Source§fn on_http_endpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<HttpEndpointResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_http_endpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 AuthRequest,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<Option<HttpEndpointResponse>, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Dispatch the resolved HTTP endpoint. Existing plugins return logical
values through
on_request; plugins returning a native raw response can
override this method to bypass the endpoint after-hook pipeline.Source§fn after_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
response: AuthResponse,
) -> Pin<Box<dyn Future<Output = Result<AuthResponse, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn after_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_req: &'life1 AuthRequest,
_ctx: &'life2 AuthContext<S>,
response: AuthResponse,
) -> Pin<Box<dyn Future<Output = Result<AuthResponse, AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Transform a completed response, including redirects and rejections. Read more
Source§fn on_user_created<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_user: &'life1 <S as AuthSchema>::User,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_user_created<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_user: &'life1 <S as AuthSchema>::User,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Called after a user is created
Source§fn on_session_created<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session: &'life1 <S as AuthSchema>::Session,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_session_created<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session: &'life1 <S as AuthSchema>::Session,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Called after a session is created
Source§fn on_user_deleted<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_user_id: &'life1 str,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_user_deleted<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_user_id: &'life1 str,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Called before a user is deleted
Source§fn on_session_deleted<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session_token: &'life1 str,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn on_session_deleted<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session_token: &'life1 str,
_ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = Result<(), AuthError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Called before a session is deleted
Source§impl Debug for SessionManagementPlugin
impl Debug for SessionManagementPlugin
Auto Trait Implementations§
impl Freeze for SessionManagementPlugin
impl RefUnwindSafe for SessionManagementPlugin
impl Send for SessionManagementPlugin
impl Sync for SessionManagementPlugin
impl Unpin for SessionManagementPlugin
impl UnsafeUnpin for SessionManagementPlugin
impl UnwindSafe for SessionManagementPlugin
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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