1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Plug-and-play PAS authentication middleware for Axum.
//!
//! This module eliminates OAuth2 boilerplate for Axum applications
//! integrating with [PAS](https://accounts.ppoppo.com) (Ppoppo Accounts System).
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use pas_external::middleware::{PasAuth, PasAuthConfig, SessionResolution};
//!
//! // 1. Implement AccountResolver and SessionStore traits for your app.
//! // 2. Configure from environment.
//! let config = PasAuthConfig::from_env()?;
//!
//! // 3. Bundle the router + a matching SessionResolver.
//! let pas_auth = PasAuth::new(config, account_resolver, session_store);
//! let resolver = pas_auth.resolver();
//!
//! // 4. Mount the router.
//! let app = axum::Router::new()
//! .merge(pas_auth.into_router());
//!
//! // 5. Use the resolver in your own middleware.
//! match resolver.resolve(&jar).await? {
//! SessionResolution::Authenticated(ctx) => { /* happy path */ }
//! SessionResolution::Expired => { /* cookie stale */ }
//! SessionResolution::NoCookie => { /* first visit */ }
//! }
//! ```
pub use PasAuth;
pub use PasAuthConfig;
pub use AuthError;
pub use AuthPpnum;
pub use ;
pub use SvAwareSessionResolver;
pub use ;
pub use NewSession;
/// Re-export cookie key type for builder API.
pub use Key as CookieKey;