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
//! Authentication: a self-contained, bring-your-own bearer token trait.
//!
//! # Auth burden
//!
//! The Python reference (`PurviewClient`) accepts an `azure-identity`
//! `TokenCredential` or `AsyncTokenCredential` directly, so it inherits
//! whatever credential chain the caller already has configured
//! (`DefaultAzureCredential`, `InteractiveBrowserCredential`, a managed
//! identity, ...). This crate has no `azure_identity`-equivalent dependency
//! to accept, and per this work package's brief is deliberately
//! **self-contained**: it defines its own minimal [`TokenProvider`] trait
//! rather than depending on `agent-framework-azure`'s `TokenCredential` (a
//! near-identical trait one layer up), so this crate has no dependency on
//! any other provider crate in this workspace.
//!
//! Bring a Microsoft Graph bearer token with the
//! `https://graph.microsoft.com/.default` scope (or the equivalent for a
//! custom [`PurviewSettings::graph_base_uri`](crate::settings::PurviewSettings::graph_base_uri) —
//! see [`PurviewSettings::get_scopes`](crate::settings::PurviewSettings::get_scopes)),
//! carrying the `dataSecurityAndGovernance` Graph permission described in
//! the Python package's README. [`StaticTokenProvider`] is provided for a
//! fixed/pre-fetched token (tests, short-lived scripts, or externally-managed
//! refresh).
use async_trait;
use Result;
/// Supplies bearer tokens for Microsoft Graph (Purview) requests. See the
/// module docs for why this trait exists instead of reusing another crate's.
/// A [`TokenProvider`] that always returns the same, pre-fetched token.