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<Arc<dyn Fn(&AuthContext, Request<Vec<u8>>) -> Result<PluginRequestAction, OpenAuthError> + Send + Sync>>,
pub on_response: Option<Arc<dyn Fn(&AuthContext, &Request<Vec<u8>>, Response<Vec<u8>>) -> Result<Response<Vec<u8>>, OpenAuthError> + Send + Sync>>,
pub init: Option<Arc<dyn Fn(&AuthContext) -> Result<PluginInitOutput, OpenAuthError> + Send + Sync>>,
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<Arc<dyn Fn(&AuthContext, Request<Vec<u8>>) -> Result<PluginRequestAction, OpenAuthError> + Send + Sync>>§on_response: Option<Arc<dyn Fn(&AuthContext, &Request<Vec<u8>>, Response<Vec<u8>>) -> Result<Response<Vec<u8>>, OpenAuthError> + Send + Sync>>§init: Option<Arc<dyn Fn(&AuthContext) -> Result<PluginInitOutput, OpenAuthError> + Send + Sync>>§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>) -> AuthPlugin
pub fn with_version(self, version: impl Into<String>) -> AuthPlugin
pub fn with_options(self, options: Value) -> AuthPlugin
pub fn with_endpoint(self, endpoint: AsyncAuthEndpoint) -> AuthPlugin
pub fn with_init<F>(self, init: F) -> AuthPlugin
pub fn with_schema(self, contribution: PluginSchemaContribution) -> AuthPlugin
pub fn with_rate_limit(self, rule: PluginRateLimitRule) -> AuthPlugin
pub fn with_before_hook<F>(self, path: impl Into<String>, hook: F) -> AuthPluginwhere
F: Fn(&AuthContext, Request<Vec<u8>>) -> Result<PluginBeforeHookAction, OpenAuthError> + Send + Sync + 'static,
pub fn with_after_hook<F>(self, path: impl Into<String>, hook: F) -> AuthPluginwhere
F: Fn(&AuthContext, &Request<Vec<u8>>, Response<Vec<u8>>) -> Result<PluginAfterHookAction, OpenAuthError> + Send + Sync + 'static,
pub fn with_async_before_hook<F>(
self,
path: impl Into<String>,
hook: F,
) -> AuthPluginwhere
F: for<'a> Fn(&'a AuthContext, Request<Vec<u8>>) -> Pin<Box<dyn Future<Output = Result<PluginBeforeHookAction, OpenAuthError>> + Send + 'a>> + Send + Sync + 'static,
pub fn with_async_after_hook<F>( self, path: impl Into<String>, hook: F, ) -> AuthPlugin
pub fn with_error_code(self, error_code: PluginErrorCode) -> AuthPlugin
pub fn with_database_hook(self, hook: PluginDatabaseHook) -> AuthPlugin
pub fn with_migration(self, migration: PluginMigration) -> AuthPlugin
pub fn with_password_validator<F>(self, validator: F) -> AuthPluginwhere
F: for<'a> Fn(&'a AuthContext, PluginPasswordValidationInput) -> Pin<Box<dyn Future<Output = Result<(), PluginPasswordValidationRejection>> + Send + 'a>> + Send + Sync + 'static,
pub fn with_middleware<F>( self, path: impl Into<String>, middleware: F, ) -> AuthPlugin
pub fn with_async_middleware<F>( self, path: impl Into<String>, middleware: F, ) -> AuthPlugin
pub fn with_on_request<F>(self, hook: F) -> AuthPluginwhere
F: Fn(&AuthContext, Request<Vec<u8>>) -> Result<PluginRequestAction, OpenAuthError> + Send + Sync + 'static,
pub fn with_on_response<F>(self, hook: F) -> AuthPlugin
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 !RefUnwindSafe for AuthPlugin
impl !UnwindSafe for AuthPlugin
impl Freeze for AuthPlugin
impl Send for AuthPlugin
impl Sync for AuthPlugin
impl Unpin for AuthPlugin
impl UnsafeUnpin 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