pub struct Credential {
pub token: String,
pub expires_at: String,
pub cached_at: String,
pub provider: String,
pub env: String,
pub realm: String,
pub identity: String,
pub sub: String,
pub account_type: String,
pub scopes: Vec<String>,
pub refreshable: bool,
}Expand description
Credential returned by an auth provider.
Field names and omission behavior match the provider JSON contract. Empty strings are accepted because some providers omit optional values.
Fields§
§token: StringAccess token used by transport injectors.
expires_at: StringExplicit expiration timestamp.
cached_at: StringCache creation timestamp. When present, CACHE_TTL determines expiry.
provider: StringProvider that produced this credential.
env: StringEnvironment this credential targets.
realm: StringEnvironment alias accepted from provider responses.
identity: StringHuman-readable identity.
sub: StringSubject identifier.
account_type: StringAccount type associated with the credential.
scopes: Vec<String>OAuth scopes granted to this credential’s token. Empty for providers that don’t expose scope data (e.g. PATs, whose scopes are opaque and enforced server-side).
refreshable: boolWhether a renewal mechanism (e.g. an OAuth refresh token) is present
for this credential, so an expired access token is expected to
renew without an interactive re-login. This reflects presence, not
verified validity — the mechanism itself may have been revoked or
expired server-side, which is only discoverable by attempting a
renewal. false for providers with no such mechanism (e.g. PATs) or
when the credential has none, even if the access token itself is
still valid.
Implementations§
Source§impl Credential
impl Credential
Sourcepub fn effective_expiry(&self) -> String
pub fn effective_expiry(&self) -> String
Returns the timestamp used for status display.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Reports whether the credential is expired.
Invalid expires_at values are treated as expired. Credentials without
either expires_at or cached_at are treated as not expired.
Trait Implementations§
Source§impl Clone for Credential
impl Clone for Credential
Source§fn clone(&self) -> Credential
fn clone(&self) -> Credential
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Credential
impl Debug for Credential
Source§impl Default for Credential
impl Default for Credential
Source§fn default() -> Credential
fn default() -> Credential
Source§impl<'de> Deserialize<'de> for Credential
impl<'de> Deserialize<'de> for Credential
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Credential
Source§impl PartialEq for Credential
impl PartialEq for Credential
Source§impl Serialize for Credential
impl Serialize for Credential
impl StructuralPartialEq for Credential
Auto Trait Implementations§
impl Freeze for Credential
impl RefUnwindSafe for Credential
impl Send for Credential
impl Sync for Credential
impl Unpin for Credential
impl UnsafeUnpin for Credential
impl UnwindSafe for Credential
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.