chore: import upstream snapshot with attribution
FreeBSD Smoke / FreeBSD Smoke (x86_64) (push) Has been cancelled
CI / Quality Guardrails (push) Has been cancelled
CI / Build & Test (macos-latest) (push) Has been cancelled
CI / Build & Test (ubuntu-latest) (push) Has been cancelled
CI / Build & Test (windows-latest) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / PowerShell Syntax (push) Has been cancelled
CI / Windows Cross-Target Check (Linux) (push) Has been cancelled
FreeBSD Smoke / FreeBSD Smoke (x86_64) (push) Has been cancelled
CI / Quality Guardrails (push) Has been cancelled
CI / Build & Test (macos-latest) (push) Has been cancelled
CI / Build & Test (ubuntu-latest) (push) Has been cancelled
CI / Build & Test (windows-latest) (push) Has been cancelled
CI / Format (push) Has been cancelled
CI / PowerShell Syntax (push) Has been cancelled
CI / Windows Cross-Target Check (Linux) (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "jcode-azure-auth"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
name = "jcode_azure_auth"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
# Use rustls instead of native-tls so the whole binary stays OpenSSL-free
|
||||
# (required for the BoringSSL-backed websearch client to link; see GH #270).
|
||||
# azure 1.0 makes the reqwest TLS backend selectable; 0.24 hardcoded native-tls.
|
||||
azure_core = { version = "1.0", default-features = false, features = ["reqwest_rustls", "reqwest_deflate", "reqwest_gzip", "tokio"] }
|
||||
azure_identity = { version = "1.0", default-features = false, features = ["tokio"] }
|
||||
@@ -0,0 +1,8 @@
|
||||
use anyhow::Result;
|
||||
use azure_core::credentials::TokenCredential;
|
||||
|
||||
pub async fn get_bearer_token(scope: &str) -> Result<String> {
|
||||
let credential = azure_identity::DeveloperToolsCredential::new(None)?;
|
||||
let token = credential.get_token(&[scope], None).await?;
|
||||
Ok(token.token.secret().to_string())
|
||||
}
|
||||
Reference in New Issue
Block a user