Skip to main content

CredentialProvider

Trait CredentialProvider 

Source
pub trait CredentialProvider: Send + Sync {
    // Required methods
    fn get_credential(
        &self,
        provider: String,
    ) -> Result<CredentialRecord, GraphrtError>;
    fn invalidate(&self, provider: String);
}
Expand description

Supplies model credentials. Implemented in the host language.

get_credential may block (Keychain, IPC, a network call to your backend); it is invoked on a background thread. Results are cached until expires_at_ms (minus a refresh margin) or until the provider rejects the credential, in which case invalidate is called and get_credential is asked once more. The provider name token_broker is used for the app’s own session token when a token broker entry sets "app_auth": "external".

Required Methods§

Source

fn get_credential( &self, provider: String, ) -> Result<CredentialRecord, GraphrtError>

Credential for provider (the provider name from the runtime config).

Source

fn invalidate(&self, provider: String)

The last credential for provider was rejected; drop any cached copy.

Trait Implementations§

Source§

impl<T> FfiConverterArc<T> for dyn CredentialProvider

Source§

const TYPE_ID_META: MetadataBuffer

Source§

type FfiType = Handle

Source§

fn lower(obj: Arc<Self>) -> Self::FfiType

Source§

fn try_lift(handle: Self::FfiType) -> Result<Arc<Self>>

Source§

fn write(obj: Arc<Self>, buf: &mut Vec<u8>)

Source§

fn try_read(buf: &mut &[u8]) -> Result<Arc<Self>>

Source§

impl<T> LiftRef<T> for dyn CredentialProvider

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§