pub trait Plugin:
Send
+ Sync
+ 'static {
// Required method
fn name(&self) -> &'static str;
// Provided methods
fn dependencies(&self) -> Vec<&'static str> { ... }
fn setup<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn routes(&self) -> Option<Router> { ... }
fn on_user_created<'life0, 'life1, 'async_trait>(
&'life0 self,
_user: &'life1 User,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn extend_token_payload(&self, payload: &mut Value, _user: &User) { ... }
}Expand description
Every auth feature is a Plugin.
Plugins register routes, react to lifecycle events, and can extend the
JWT payload and resolved Identity. The setup method is called once
during Auth initialization — use it to validate config and wire event
subscriptions.