sa-token-plugin-poem

Crates.iosa-token-plugin-poem
lib.rssa-token-plugin-poem
version0.1.12
created_at2025-10-11 02:53:46.534261+00
updated_at2025-12-17 04:50:17.016394+00
descriptionPoem framework integration for sa-token-rust - All-in-one package
homepagehttps://github.com/llc-993/sa-token-rust
repositoryhttps://github.com/llc-993/sa-token-rust
max_upload_size
id1877785
size78,517
(llc-993)

documentation

https://docs.rs/sa-token-rust

README

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.

Commit count: 0

cargo fmt