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
54
55
56
57
58
59
60
61
62
63
64
65
//! 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 for your app.
//! // Typical pattern: one PasAdapter implements both; share a
//! // single Arc<PasAdapter>. AuthContext (returned from
//! // SessionStore::find) must impl SvAware.
//! // 2. Configure from environment, including the refresh-token cipher.
//! let cipher = TokenCipher::from_base64_key(&std::env::var("REFRESH_TOKEN_KEY")?)?;
//! let config = PasAuthConfig::from_env()?
//! .with_refresh_token_cipher(cipher);
//!
//! // 3. Bundle the router + a matching SessionValidator.
//! let pas_auth = PasAuth::new(
//! config,
//! Arc::clone(&adapter), // AccountResolver
//! Arc::clone(&adapter), // SessionStore (also returns ciphertext via get_refresh_ciphertext)
//! );
//! let validator = pas_auth.session_validator();
//!
//! // 4. Mount the router.
//! let app = axum::Router::new()
//! .merge(pas_auth.into_router());
//!
//! // 5. Use the validator in your own middleware.
//! match validator.validate(&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 SessionValidator;
pub use ;
pub use ;
pub use NewSession;
/// Re-export cookie key type for builder API.
pub use Key as CookieKey;