pub struct FileMcpCredentialProvider { /* private fields */ }Expand description
File-backed credential provider. Constructed once in the bootstrap
and shared with McpManager via Arc<dyn McpCredentialProvider>.
Implementations§
Source§impl FileMcpCredentialProvider
impl FileMcpCredentialProvider
Sourcepub fn new(
oauth: HashMap<String, OAuthConfig>,
config_dir: PathBuf,
) -> Result<Arc<Self>>
pub fn new( oauth: HashMap<String, OAuthConfig>, config_dir: PathBuf, ) -> Result<Arc<Self>>
Create a new file-backed credential provider.
Loads any cached tokens from config_dir (or starts with an empty
store) and configures a 15-second-timeout HTTP client for refreshes.
Sourcepub async fn force_refresh(&self, server: &str) -> Result<()>
pub async fn force_refresh(&self, server: &str) -> Result<()>
Force a refresh for server and persist the new token. Used by
/mcp reauth <server>.
Trait Implementations§
Source§impl McpCredentialProvider for FileMcpCredentialProvider
impl McpCredentialProvider for FileMcpCredentialProvider
Source§fn access_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
server: &'life1 str,
_url: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<Credential>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn access_token<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
server: &'life1 str,
_url: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<Credential>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Return a credential for
server/url if one is known.
Returning None means “no auth” — the transport connects
without an Authorization header.Source§fn refresh<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
server: &'life1 str,
_url: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<Credential>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn refresh<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
server: &'life1 str,
_url: &'life2 str,
) -> Pin<Box<dyn Future<Output = Option<Credential>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Refresh the credential for
server/url and return the new
value. Called by the HTTP transport after a 401/403
response. Returning None means refresh failed; the transport
surfaces the original error to the caller.Auto Trait Implementations§
impl !Freeze for FileMcpCredentialProvider
impl !RefUnwindSafe for FileMcpCredentialProvider
impl !UnwindSafe for FileMcpCredentialProvider
impl Send for FileMcpCredentialProvider
impl Sync for FileMcpCredentialProvider
impl Unpin for FileMcpCredentialProvider
impl UnsafeUnpin for FileMcpCredentialProvider
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: Sized + AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more