Closed marcoow closed 1 year ago
A typical authorization mechanism for APIs is to identify the authenticated users based on a bearer token (and load the respective user for that token from the DB). Axum provides a way to register a middleware that does just that and makes the loaded user available to all handlers: https://docs.rs/axum/0.6.20/axum/middleware/index.html#passing-state-from-middleware-to-handlers.
A typical authorization mechanism for APIs is to identify the authenticated users based on a bearer token (and load the respective user for that token from the DB). Axum provides a way to register a middleware that does just that and makes the loaded user available to all handlers: https://docs.rs/axum/0.6.20/axum/middleware/index.html#passing-state-from-middleware-to-handlers.