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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! Authentication abstractions for the Salesforce REST API.
//!
//! Salesforce supports several OAuth 2.0 flows, each producing the same two
//! pieces of information: a bearer access token and an `instance_url` that
//! becomes the base URL for subsequent REST calls. The rest of the SDK is
//! flow-agnostic — it only needs an [`AuthSession`] that can hand over those
//! two values on demand.
//!
//! Implementations live in submodules (one per flow). They are responsible
//! for their own token acquisition, refresh, and any caching. The trait
//! method is `async` so an implementation may transparently refresh an
//! expired token when called.
//!
//! ## Implementations
//!
//! - [`static_token`] — preset access token + instance URL. Useful for
//! tests, scripts, or callers that have already obtained credentials by
//! other means.
//! - [`jwt`] — OAuth 2.0 JWT Bearer flow for server-to-server auth.
//! - [`refresh`] — OAuth 2.0 Refresh Token grant. Long-lived sessions for
//! any flow that produces a refresh token.
//! - [`client_credentials`] — OAuth 2.0 Client Credentials grant for
//! server-to-server integrations that run as a pre-configured user.
//! - [`web_server`] — OAuth 2.0 Web Server flow with PKCE for
//! user-interactive authorization. Yields a [`RefreshTokenAuth`] once the
//! user comes back through the redirect URL.
//! - [`token_exchange`] — OAuth 2.0 Token Exchange (RFC 8693), including
//! Salesforce's hybrid grant.
//!
//! Flows Salesforce lists as legacy or deprecated are intentionally not
//! supported.
use crateCirrusResult;
use async_trait;
use Cow;
use Arc;
pub use ;
pub use ;
pub use ;
pub use StaticTokenAuth;
pub use ;
pub use ;
/// Abstraction over a Salesforce authentication session.
///
/// An implementation holds whatever credentials the chosen flow needs,
/// produces a bearer access token on demand (refreshing if necessary), and
/// reports the instance URL that REST requests should target.
///
/// The trait is `Send + Sync` and uses [`async_trait`](mod@async_trait) to remain
/// `dyn`-compatible — the client stores `Arc<dyn AuthSession>` so handlers
/// don't care which flow was configured.
/// `Arc<dyn AuthSession>` — the shape stored inside the client.
pub type SharedAuth = ;