Skip to main content

pas_external/
lib.rs

1#![doc = include_str!("../README.md")]
2
3pub mod audit;
4// Perimeter Bearer-auth Layer kit — Phase A Slice 4 lifted the kit to
5// `ppoppo_sdk_core::bearer::*`. pas-external 0.11.0 re-exports the
6// kit at `pas_external::bearer::*` (audit decision D — 1-level
7// role-named module, no `oidc::axum::*` nesting) for 3rd-party
8// consumers (RCW/CTW). 1st-party services (chat-auth) import direct
9// from sdk-core (audit decision B). The framework-dep visibility
10// (axum / tower) is signalled by the `axum` feature gate, not by a
11// nested `pas_external::oidc::axum::*` namespace.
12#[cfg(feature = "axum")]
13pub mod bearer {
14    pub use ::ppoppo_sdk_core::bearer::*;
15}
16// `epoch` re-exports the engine `EpochRevocation` port + ships the
17// canonical adapter set (Phase 11.Z, RFC_2026-05-09 §3.5). Gated on
18// `well-known-fetch` because the engine port itself needs `token` and
19// the original `UserinfoFetcher` (deleted in 0.10.0) required the HTTP
20// client (`oauth`) — both implied by the `well-known-fetch` flag.
21// `SharedCacheCache` (0.10.0, RFC_2026-05-08 §4.1) requires the
22// additional `shared-cache` feature for the `ppoppo-infra` adapter dep.
23#[cfg(feature = "well-known-fetch")]
24pub mod epoch;
25pub mod error;
26// `oauth` is the OAuth2 wire-DTO + AuthClient adapter used internally by
27// `oidc::RelyingParty`. As of 0.8.0 it is `pub(crate)` — consumers reach
28// the OIDC RP composition root (`oidc::RelyingParty<S>`) and never the
29// raw OAuth surface. See `oidc::RefreshOutcome` for the boundary type at
30// `RelyingParty::refresh`.
31#[cfg(feature = "oauth")]
32pub(crate) mod oauth;
33#[cfg(feature = "token")]
34pub mod oidc;
35#[cfg(feature = "oauth")]
36pub mod pas_port;
37// `pkce` primitives (`generate_state`, `generate_code_verifier`,
38// `generate_code_challenge`) are SDK plumbing — `oidc::RelyingParty::start`
39// consumes them internally and exposes the resulting state via
40// `AuthorizationRedirect`. As of 0.8.0 the module is `pub(crate)`.
41#[cfg(feature = "oauth")]
42pub(crate) mod pkce;
43// `session_liveness` is intentionally ungated at module level — the
44// 0.10.0 `SessionLiveness` port has no AES / OAuth deps and ships
45// regardless of feature configuration so the verifier slot
46// (`PasJwtVerifier::with_session_liveness`) can reference it under
47// just `feature = "well-known-fetch"`. Internal sub-modules
48// (`cipher`, `liveness`) remain gated on `feature = "session-liveness"`
49// for the AES wrapper + PAS refresh-token check.
50pub mod session_liveness;
51pub mod types;
52
53// Test-support helpers. `FakePasServer` is the SDK-owned wiremock-wrapped
54// fake PAS Authorization Server, replacing the 0.7.x
55// `RelyingParty::for_test_with_parts` escape hatch. Consumer integration
56// tests construct a real `RelyingParty::new(...)` against
57// `FakePasServer.issuer_url()` so production and test go through the same
58// public interface.
59#[cfg(feature = "test-support")]
60pub mod test_support;
61
62// Re-exports for convenient access
63pub use audit::{
64    AuditEvent, AuditSink, IdTokenFailureKind, MemoryRateLimiter, NoopAuditSink, RateLimitKey,
65    RateLimitedAuditSink, RateLimiter, VerifyErrorKind, compose_id_token_source_id,
66    compose_source_id,
67};
68#[cfg(any(test, feature = "test-support"))]
69pub use audit::MemoryAuditSink;
70pub use error::{Error, TokenError};
71// 0.10.0 — ungated L2 verifier-slot port (RFC_2026-05-08 §4.2 lock).
72pub use session_liveness::{SessionLiveness, SessionLivenessError};
73#[cfg(feature = "session-liveness")]
74pub use session_liveness::{
75    CipherError, EncryptedRefreshToken, LivenessFailure, LivenessOutcome, RevokeCause,
76    TokenCipher, TransientCause, attempt_liveness_refresh,
77};
78// γ port-and-adapter — Phase 6.1 (D-04 = γ, locked 2026-05-05).
79// Phase A (RFC `RFC_2026-05-08_app-credential-collapse.md`, audit
80// decisions E + G) lifted the cohesive verifier group to
81// `ppoppo_sdk_core::verifier::*`. pas-external re-exports at top level
82// (no `token::` namespace — audit decision E) so consumer code
83// reaches `pas_external::{BearerVerifier, JwtVerifier, ...}`. Renames:
84// `PasJwtVerifier` → `JwtVerifier`; `Expectations` → `VerifyConfig`;
85// `AuthSession` → `VerifiedClaims`. The `crypto-side` `VerifyError`
86// re-exports as `TokenVerifyError` (BREAKING) to make space for the
87// Layer-side `VerifyError` from `pas_external::bearer::*` (Slice 4
88// migration). Phase A 0.11.0 ships clean — no transitional alias.
89#[cfg(feature = "token")]
90pub use ::ppoppo_sdk_core::verifier::{
91    BearerVerifier, VerifiedClaims, VerifyConfig, VerifyError as TokenVerifyError,
92};
93#[cfg(feature = "well-known-fetch")]
94pub use ::ppoppo_sdk_core::verifier::{JwksCache, JwtVerifier};
95#[cfg(all(feature = "token", any(test, feature = "test-support")))]
96pub use ::ppoppo_sdk_core::verifier::MemoryBearerVerifier;
97// OIDC RP surface — composition root + post-verify shapes + ports.
98// `RelyingParty<S>` is the consumer-facing entry point; `RefreshOutcome`
99// is the typed boundary return for `RelyingParty::refresh` (replaces
100// the 0.7.x `oauth::TokenResponse` re-export).
101#[cfg(feature = "token")]
102pub use oidc::{Address, IdAssertion, IdTokenVerifier, IdVerifyError, Nonce, ScopePiiReader};
103#[cfg(all(feature = "token", any(test, feature = "test-support")))]
104pub use oidc::MemoryIdTokenVerifier;
105pub use types::{KeyId, Ppnum, PpnumId, SessionId, UserId};
106// `Url` is consumer-facing via `Config::new(client_id, redirect_uri: Url, ...)`
107// and `Discovery::for_test`. Re-exported so consumers reach the same `url`
108// crate version the SDK uses without separately tracking it in their
109// Cargo.toml.
110#[cfg(feature = "oauth")]
111pub use url::Url;