pub struct ClientCredentialsAuth { /* private fields */ }Expand description
Client-credentials-grant auth session.
Construct via ClientCredentialsAuth::builder.
Implementations§
Source§impl ClientCredentialsAuth
impl ClientCredentialsAuth
Sourcepub fn builder() -> ClientCredentialsAuthBuilder
pub fn builder() -> ClientCredentialsAuthBuilder
Begins constructing a ClientCredentialsAuth.
Client-credentials grant (RFC 6749 §4.4): server-to-server flow where the connected app’s consumer key + secret are exchanged directly for an access token, no user context. The connected app’s “Run As” user determines record-level visibility.
§Example
use cirrus_auth::ClientCredentialsAuth;
use std::sync::Arc;
let auth = ClientCredentialsAuth::builder()
.consumer_key("3MVG9...")
.consumer_secret("28A2...")
.login_url("https://my-org.my.salesforce.com")
.instance_url("https://my-org.my.salesforce.com")
.build()?;
// Wrap as Arc<dyn AuthSession> and hand to a Cirrus client.
let _shared = Arc::new(auth);Trait Implementations§
Source§impl AuthSession for ClientCredentialsAuth
impl AuthSession for ClientCredentialsAuth
Source§fn access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AuthResult<Cow<'_, str>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn access_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AuthResult<Cow<'_, str>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a valid bearer access token. Implementations may refresh
expired tokens transparently here; that is why the method is
async.Source§fn instance_url(&self) -> &str
fn instance_url(&self) -> &str
Returns the instance URL for REST requests, e.g.
https://my-org.my.salesforce.com. No trailing slash.Source§fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
stale_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn invalidate<'life0, 'life1, 'async_trait>(
&'life0 self,
stale_token: &'life1 str,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Invalidates a cached token that the SDK has determined is no
longer valid (typically because Salesforce returned 401
INVALID_SESSION_ID when it was used). Read moreAuto Trait Implementations§
impl !Freeze for ClientCredentialsAuth
impl !RefUnwindSafe for ClientCredentialsAuth
impl Send for ClientCredentialsAuth
impl Sync for ClientCredentialsAuth
impl Unpin for ClientCredentialsAuth
impl UnsafeUnpin for ClientCredentialsAuth
impl !UnwindSafe for ClientCredentialsAuth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more