Skip to main content

impl_auth_plugin

Macro impl_auth_plugin 

Source
macro_rules! impl_auth_plugin {
    (@pat get) => { ... };
    (@pat post) => { ... };
    (@pat put) => { ... };
    (@pat delete) => { ... };
    (@pat patch) => { ... };
    (@pat head) => { ... };
    (@route get) => { ... };
    (@route post) => { ... };
    (@route put) => { ... };
    (@route delete) => { ... };
    (
        $plugin:ty, $name:expr;
        routes {
            $( $method:ident $path:literal => $handler:ident, $op_id:literal );* $(;)?
        }
        $( extra { $($extra:tt)* } )?
    ) => { ... };
}
Expand description

Generates the AuthPlugin<DB> impl for a plugin with static route dispatch.

Eliminates the dual declaration of routes in routes() and on_request() by generating both from a single route table.

§Exceptions (must keep manual impl)

  • OAuthPlugin — dynamic path matching for /callback/{provider}
  • SessionManagementPlugin — match guards and OR patterns
  • EmailPasswordPlugin — conditional routes based on config
  • UserManagementPlugin — conditional routes based on config
  • PasswordManagementPlugin — dynamic path matching for /reset-password/{token}
  • OrganizationPlugin — handlers accept extra &self.config argument