Skip to main content

Module middleware

Module middleware 

Source
Expand description

Session verification and the tower authentication middleware.

Structs§

Auth
The tower Service produced by AuthLayer.
AuthLayer
The tower Layer returned by auth and mcp.

Functions§

auth
Middleware that enforces authentication, for any tower stack — axum, tonic, or hyper.
logout
End the user’s access everywhere with a server-side call to Stackure, clear the app’s session cookie and redirect to Stackure.
mcp
Middleware that protects an MCP route, for any tower stack — axum, tonic, or hyper.
user_from_request
The user attached by auth or mcp, or None if the request was not authenticated. In axum you can also take an Extension<User> directly.
verify
Verify a request without returning an error.