pub struct ClientSecretCredential { /* private fields */ }Expand description
Authenticates a confidential client via the OAuth2 client-credentials flow
(POST {authority}/{tenant}/oauth2/v2.0/token).
Implementations§
Source§impl ClientSecretCredential
impl ClientSecretCredential
Sourcepub fn new(
tenant_id: impl Into<String>,
client_id: impl Into<String>,
client_secret: impl Into<String>,
scope: impl Into<String>,
) -> Self
pub fn new( tenant_id: impl Into<String>, client_id: impl Into<String>, client_secret: impl Into<String>, scope: impl Into<String>, ) -> Self
Create a client-secret credential for the given tenant/app registration,
acquiring tokens for scope.
Override the Entra authority (default
DEFAULT_AUTHORITY) — e.g. a sovereign cloud, or a loopback in tests.
Trait Implementations§
Source§impl TokenCredential for ClientSecretCredential
impl TokenCredential for ClientSecretCredential
Source§fn get_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_token<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fetch a bearer token to send as
Authorization: Bearer <token>.Source§fn get_token_for_scope<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_token_for_scope<'life0, 'life1, 'async_trait>(
&'life0 self,
scope: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a bearer token for a specific
scope (audience), e.g.
"https://ai.azure.com/.default". Read moreAuto Trait Implementations§
impl !Freeze for ClientSecretCredential
impl !RefUnwindSafe for ClientSecretCredential
impl !UnwindSafe for ClientSecretCredential
impl Send for ClientSecretCredential
impl Sync for ClientSecretCredential
impl Unpin for ClientSecretCredential
impl UnsafeUnpin for ClientSecretCredential
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