pub struct BotGatewayTokenProvider { /* private fields */ }Expand description
AI Bot CLI 网关 Token Provider:botid+secret 签名调用
/cgi-bin/aibot/cli/get_cli_config 换取 Bearer token。
- token 读取 / 刷新均经
CredentialStore(刷新结果写回存储); - 并发刷新合并:存储中的 token 已不同于
stale_token时直接复用; - 引导请求复用触发请求的
options(剥离失效 Authorization 头), 经内部原始 HTTP 后端发出(端点 URL 为绝对地址,已挂扁平信封与SuppressAuth抑制标记)。
Implementations§
Source§impl BotGatewayTokenProvider
impl BotGatewayTokenProvider
Sourcepub fn new(
bot_id: impl Into<String>,
secret: impl Into<String>,
store: Arc<dyn CredentialStore>,
) -> BotGatewayTokenProvider
pub fn new( bot_id: impl Into<String>, secret: impl Into<String>, store: Arc<dyn CredentialStore>, ) -> BotGatewayTokenProvider
用直接给定的 bot 凭据创建 Provider(默认引导端点)。
Sourcepub fn from_store(store: Arc<dyn CredentialStore>) -> BotGatewayTokenProvider
pub fn from_store(store: Arc<dyn CredentialStore>) -> BotGatewayTokenProvider
用凭据存储创建 Provider(bot 凭据每次刷新时从存储读取; 引导端点默认指向 product/正式环境)。
Sourcepub fn with_auth_endpoint(self, endpoint: Endpoint) -> BotGatewayTokenProvider
pub fn with_auth_endpoint(self, endpoint: Endpoint) -> BotGatewayTokenProvider
覆写鉴权引导端点(如测试注入 mock URL、custom-endpoint 环境)。
Sourcepub fn with_backend(
self,
backend: Arc<dyn TransportBackend>,
) -> BotGatewayTokenProvider
pub fn with_backend( self, backend: Arc<dyn TransportBackend>, ) -> BotGatewayTokenProvider
覆写引导请求的原始 HTTP 后端(测试注入)。
Sourcepub fn with_bot(self, bot: BotCredential) -> BotGatewayTokenProvider
pub fn with_bot(self, bot: BotCredential) -> BotGatewayTokenProvider
覆写 bot 凭据(固定值,优先于存储中的 bot)。
Sourcepub fn with_bind_source(
self,
bind_source: BindSource,
) -> BotGatewayTokenProvider
pub fn with_bind_source( self, bind_source: BindSource, ) -> BotGatewayTokenProvider
覆写绑定来源(默认 BindSource::Interactive)。
Trait Implementations§
Source§impl Clone for BotGatewayTokenProvider
impl Clone for BotGatewayTokenProvider
Source§fn clone(&self) -> BotGatewayTokenProvider
fn clone(&self) -> BotGatewayTokenProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BotGatewayTokenProvider
impl Debug for BotGatewayTokenProvider
Source§impl TokenProvider for BotGatewayTokenProvider
impl TokenProvider for BotGatewayTokenProvider
Auto Trait Implementations§
impl !RefUnwindSafe for BotGatewayTokenProvider
impl !UnwindSafe for BotGatewayTokenProvider
impl Freeze for BotGatewayTokenProvider
impl Send for BotGatewayTokenProvider
impl Sync for BotGatewayTokenProvider
impl Unpin for BotGatewayTokenProvider
impl UnsafeUnpin for BotGatewayTokenProvider
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