pub struct AdminPlugin { /* private fields */ }Expand description
Admin plugin for user management operations.
Implementations§
Source§impl AdminPlugin
impl AdminPlugin
Sourcepub fn get_user_endpoint(
id: impl Into<String>,
) -> ServerEndpoint<AdminUserOutput>
pub fn get_user_endpoint( id: impl Into<String>, ) -> ServerEndpoint<AdminUserOutput>
Read a user through the installed admin policy and server endpoint hooks.
Sourcepub fn set_role_endpoint(
body: &AdminSetRoleRequest,
) -> AuthResult<ServerEndpoint<AdminUserResponse>>
pub fn set_role_endpoint( body: &AdminSetRoleRequest, ) -> AuthResult<ServerEndpoint<AdminUserResponse>>
Assign literal roles through installed server policy and hooks.
Sourcepub fn create_user_endpoint(
body: &AdminCreateUserRequest,
) -> AuthResult<ServerEndpoint<AdminUserResponse>>
pub fn create_user_endpoint( body: &AdminCreateUserRequest, ) -> AuthResult<ServerEndpoint<AdminUserResponse>>
Provision a user through installed server policy and hooks. Without a Request or headers, the call is trusted; supplying either requires a session.
Sourcepub fn user_has_permission_endpoint(
body: &AdminPermissionRequest,
) -> AuthResult<ServerEndpoint<AdminPermissionResponse>>
pub fn user_has_permission_endpoint( body: &AdminPermissionRequest, ) -> AuthResult<ServerEndpoint<AdminPermissionResponse>>
Evaluate permissions through the installed admin policy and server hooks. Trusted selectors apply only without a Request or headers; a session always wins.
Sourcepub fn admin_update_user_endpoint(
body: &AdminUpdateUserRequest,
) -> AuthResult<ServerEndpoint<AdminUserOutput>>
pub fn admin_update_user_endpoint( body: &AdminUpdateUserRequest, ) -> AuthResult<ServerEndpoint<AdminUserOutput>>
Update a user through authoritative admin policy and installed server hooks.
Sourcepub fn list_users_endpoint(
query: &AdminListUsersQuery,
) -> AuthResult<ServerEndpoint<AdminListUsersResponse>>
pub fn list_users_endpoint( query: &AdminListUsersQuery, ) -> AuthResult<ServerEndpoint<AdminListUsersResponse>>
List users through authoritative admin policy and installed server hooks.
Sourcepub fn list_user_sessions_endpoint(
user_id: impl Into<String>,
) -> ServerEndpoint<AdminUserSessionsResponse>
pub fn list_user_sessions_endpoint( user_id: impl Into<String>, ) -> ServerEndpoint<AdminUserSessionsResponse>
List a user’s stored sessions through authoritative admin policy and server hooks.
Sourcepub fn stop_impersonating_endpoint() -> ServerEndpoint<AdminImpersonationResponse>
pub fn stop_impersonating_endpoint() -> ServerEndpoint<AdminImpersonationResponse>
Restore the original session from a signed impersonation cookie.
Sourcepub fn impersonate_user_endpoint(
user_id: impl Into<String>,
) -> ServerEndpoint<AdminImpersonationResponse>
pub fn impersonate_user_endpoint( user_id: impl Into<String>, ) -> ServerEndpoint<AdminImpersonationResponse>
Create an impersonation session and publish cookies through authoritative admin policy.
Sourcepub fn set_user_password_endpoint(
input: &AdminSetUserPasswordRequest,
) -> AuthResult<ServerEndpoint<StatusResponse>>
pub fn set_user_password_endpoint( input: &AdminSetUserPasswordRequest, ) -> AuthResult<ServerEndpoint<StatusResponse>>
Replace or create a credential through authoritative admin policy and server hooks.
§Errors
Returns an error if the logical input cannot be serialized.
Sourcepub fn remove_user_endpoint(
user_id: impl Into<String>,
) -> ServerEndpoint<AdminSuccessResponse>
pub fn remove_user_endpoint( user_id: impl Into<String>, ) -> ServerEndpoint<AdminSuccessResponse>
Remove a stored user, their accounts and sessions through authoritative admin policy.
Sourcepub fn revoke_user_sessions_endpoint(
user_id: impl Into<String>,
) -> ServerEndpoint<AdminSuccessResponse>
pub fn revoke_user_sessions_endpoint( user_id: impl Into<String>, ) -> ServerEndpoint<AdminSuccessResponse>
Revoke all stored sessions for a user through authoritative administrative policy.
Sourcepub fn revoke_user_session_endpoint(
session_token: impl Into<String>,
) -> ServerEndpoint<AdminSuccessResponse>
pub fn revoke_user_session_endpoint( session_token: impl Into<String>, ) -> ServerEndpoint<AdminSuccessResponse>
Revoke one stored session token through authoritative administrative policy.
Sourcepub fn ban_user_endpoint(
input: &AdminBanUserRequest,
) -> AuthResult<ServerEndpoint<AdminUserResponse>>
pub fn ban_user_endpoint( input: &AdminBanUserRequest, ) -> AuthResult<ServerEndpoint<AdminUserResponse>>
Ban a stored user and revoke their sessions through authoritative admin policy.
§Errors
Returns an error if the logical input cannot be serialized.
Sourcepub fn unban_user_endpoint(
user_id: impl Into<String>,
) -> ServerEndpoint<AdminUserResponse>
pub fn unban_user_endpoint( user_id: impl Into<String>, ) -> ServerEndpoint<AdminUserResponse>
Clear a stored user’s ban through authoritative admin policy and server hooks.
Source§impl AdminPlugin
impl AdminPlugin
pub fn new() -> Self
pub fn with_config(config: AdminConfig) -> Self
pub fn default_role(self, val: impl Into<String>) -> Self
pub fn admin_roles(self, val: Vec<String>) -> Self
pub fn admin_user_ids(self, val: Vec<String>) -> Self
pub fn roles(self, val: HashMap<String, RolePermissions>) -> Self
pub fn default_ban_reason(self, val: String) -> Self
pub fn default_ban_expires_in(self, val: f64) -> Self
pub fn impersonation_session_duration(self, val: f64) -> Self
pub fn banned_user_message(self, val: impl Into<String>) -> Self
pub fn allow_impersonating_admins(self, val: bool) -> Self
Source§impl AdminPlugin
impl AdminPlugin
Sourcepub fn banned_user_message_callback<U: AuthUser, H: AdminBannedUserMessage<U>>(
self,
handler: H,
) -> Self
pub fn banned_user_message_callback<U: AuthUser, H: AdminBannedUserMessage<U>>( self, handler: H, ) -> Self
Configure an awaited message callback over the exact stored user entity.
Trait Implementations§
Source§impl<S: AuthSchema> AuthPlugin<S> for AdminPlugin
impl<S: AuthSchema> AuthPlugin<S> for AdminPlugin
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,
Source§fn static_openapi_metadata(&self) -> PluginOpenApiMetadata
fn static_openapi_metadata(&self) -> PluginOpenApiMetadata
Source§fn openapi_metadata(&self, ctx: &AuthInitContext<S>) -> PluginOpenApiMetadata
fn openapi_metadata(&self, ctx: &AuthInitContext<S>) -> PluginOpenApiMetadata
Source§fn server_endpoints(&self) -> Vec<EndpointDefinition>
fn server_endpoints(&self) -> Vec<EndpointDefinition>
Source§fn validate_endpoint(
&self,
call: &EndpointCall,
_: &AuthContext<S>,
) -> AuthResult<EndpointInput>
fn validate_endpoint( &self, call: &EndpointCall, _: &AuthContext<S>, ) -> AuthResult<EndpointInput>
Source§fn on_endpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 EndpointCall,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<EndpointResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_endpoint<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
call: &'life1 EndpointCall,
ctx: &'life2 AuthContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<EndpointResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn session_fields(&self) -> FieldConfigs
fn session_fields(&self) -> FieldConfigs
Source§fn on_init<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut AuthInitContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_init<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut AuthInitContext<S>,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn rate_limits(&self) -> Vec<PluginRateLimit>
fn rate_limits(&self) -> Vec<PluginRateLimit>
Source§fn endpoint_hooks(&self) -> Vec<&dyn EndpointHook<S>>
fn endpoint_hooks(&self) -> Vec<&dyn EndpointHook<S>>
Source§fn allowed_media_types(&self, _route: &AuthRoute) -> Vec<&'static str>
fn allowed_media_types(&self, _route: &AuthRoute) -> Vec<&'static str>
fn user_fields(&self) -> IndexMap<String, FieldConfig>
fn account_fields(&self) -> IndexMap<String, FieldConfig>
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,
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,
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,
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,
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,
on_request; plugins returning a native raw response can
override this method to bypass the endpoint after-hook pipeline.