pub struct AuthPlugin {Show 17 fields
pub id: String,
pub version: Option<String>,
pub options: Option<Value>,
pub endpoints: Vec<AsyncAuthEndpoint>,
pub middlewares: Vec<PluginMiddleware>,
pub async_middlewares: Vec<PluginAsyncMiddleware>,
pub on_request: Option<PluginOnRequest>,
pub on_response: Option<PluginOnResponse>,
pub init: Option<PluginInitHandler>,
pub schema: Vec<PluginSchemaContribution>,
pub rate_limit: Vec<PluginRateLimitRule>,
pub hooks: PluginEndpointHooks,
pub error_codes: Vec<PluginErrorCode>,
pub database_hooks: Vec<PluginDatabaseHook>,
pub migrations: Vec<PluginMigration>,
pub social_providers: Vec<Arc<dyn SocialOAuthProvider>>,
pub password_validators: Vec<PluginPasswordValidator>,
}Fields§
§id: String§version: Option<String>§options: Option<Value>§endpoints: Vec<AsyncAuthEndpoint>§middlewares: Vec<PluginMiddleware>§async_middlewares: Vec<PluginAsyncMiddleware>§on_request: Option<PluginOnRequest>§on_response: Option<PluginOnResponse>§init: Option<PluginInitHandler>§schema: Vec<PluginSchemaContribution>§rate_limit: Vec<PluginRateLimitRule>§hooks: PluginEndpointHooks§error_codes: Vec<PluginErrorCode>§database_hooks: Vec<PluginDatabaseHook>§migrations: Vec<PluginMigration>§password_validators: Vec<PluginPasswordValidator>Implementations§
Source§impl AuthPlugin
impl AuthPlugin
pub fn new(id: impl Into<String>) -> Self
pub fn with_version(self, version: impl Into<String>) -> Self
pub fn with_options(self, options: Value) -> Self
pub fn with_endpoint(self, endpoint: AsyncAuthEndpoint) -> Self
pub fn with_init<F>(self, init: F) -> Self
pub fn with_schema(self, contribution: PluginSchemaContribution) -> Self
pub fn with_rate_limit(self, rule: PluginRateLimitRule) -> Self
pub fn with_before_hook<F>(self, path: impl Into<String>, hook: F) -> Selfwhere
F: Fn(&AuthContext, PluginRequest) -> Result<PluginBeforeHookAction, OpenAuthError> + Send + Sync + 'static,
pub fn with_after_hook<F>(self, path: impl Into<String>, hook: F) -> Selfwhere
F: Fn(&AuthContext, &PluginRequest, PluginResponse) -> Result<PluginAfterHookAction, OpenAuthError> + Send + Sync + 'static,
pub fn with_async_before_hook<F>(self, path: impl Into<String>, hook: F) -> Selfwhere
F: for<'a> Fn(&'a AuthContext, PluginRequest) -> PluginBeforeHookFuture<'a> + Send + Sync + 'static,
pub fn with_async_after_hook<F>(self, path: impl Into<String>, hook: F) -> Selfwhere
F: for<'a> Fn(&'a AuthContext, &'a PluginRequest, PluginResponse) -> PluginAfterHookFuture<'a> + Send + Sync + 'static,
pub fn with_error_code(self, error_code: PluginErrorCode) -> Self
pub fn with_database_hook(self, hook: PluginDatabaseHook) -> Self
pub fn with_migration(self, migration: PluginMigration) -> Self
pub fn with_password_validator<F>(self, validator: F) -> Selfwhere
F: for<'a> Fn(&'a AuthContext, PluginPasswordValidationInput) -> PluginPasswordValidatorFuture<'a> + Send + Sync + 'static,
pub fn with_middleware<F>(self, path: impl Into<String>, middleware: F) -> Selfwhere
F: Fn(&AuthContext, &PluginRequest) -> Result<Option<PluginResponse>, OpenAuthError> + Send + Sync + 'static,
pub fn with_async_middleware<F>(
self,
path: impl Into<String>,
middleware: F,
) -> Selfwhere
F: for<'a> Fn(&'a AuthContext, &'a PluginRequest) -> PluginMiddlewareFuture<'a> + Send + Sync + 'static,
pub fn with_on_request<F>(self, hook: F) -> Selfwhere
F: Fn(&AuthContext, PluginRequest) -> Result<PluginRequestAction, OpenAuthError> + Send + Sync + 'static,
pub fn with_on_response<F>(self, hook: F) -> Selfwhere
F: Fn(&AuthContext, &PluginRequest, PluginResponse) -> Result<PluginResponse, OpenAuthError> + Send + Sync + 'static,
Trait Implementations§
Source§impl Clone for AuthPlugin
impl Clone for AuthPlugin
Source§fn clone(&self) -> AuthPlugin
fn clone(&self) -> AuthPlugin
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthPlugin
impl !RefUnwindSafe for AuthPlugin
impl Send for AuthPlugin
impl Sync for AuthPlugin
impl Unpin for AuthPlugin
impl UnsafeUnpin for AuthPlugin
impl !UnwindSafe for AuthPlugin
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
Mutably borrows from an owned value. Read more