13 releases
Uses new Rust 2024
| 0.1.12 | Dec 17, 2025 |
|---|---|
| 0.1.11 | Nov 22, 2025 |
| 0.1.4 | Oct 16, 2025 |
#2065 in Authentication
410KB
4.5K
SLoC
sa-token-plugin-poem
Poem framework integration for sa-token-rust.
Features
- ⚡ Modern Design: Built for Poem framework
- 🎯 Easy Integration: Middleware and extractors
- 🔧 Flexible: Comprehensive configuration options
- 🛡️ Complete: Full auth support
Installation
[dependencies]
sa-token-plugin-poem = { version = "0.1.12", features = ["redis"] }
poem = "3.1"
tokio = { version = "1", features = ["full"] }
Quick Start
use poem::{Route, Server, listener::TcpListener};
use sa_token_plugin_poem::{SaTokenState, SaTokenMiddleware};
use sa_token_storage_memory::MemoryStorage;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
let state = SaTokenState::builder()
.storage(Arc::new(MemoryStorage::new()))
.timeout(7200)
.build();
let app = Route::new()
.at("/api/user", poem::get(user_info))
.with(SaTokenMiddleware::new(state.manager.clone()));
Server::new(TcpListener::bind("127.0.0.1:3000"))
.run(app)
.await
}
Version History
0.1.12
- ✨ Added path-based authentication support for fine-grained access control
- 🔧 Optimized middleware implementation, reduced code duplication
0.1.11
- Initial release with basic features
Author
金书记
License
Licensed under either of Apache-2.0 or MIT.
Dependencies
~20–38MB
~512K SLoC