pub struct AuthSession {
pub access_token: String,
pub refresh_token: Option<String>,
pub expires_at: Option<DateTime<Utc>>,
pub token_type: String,
pub scopes: Vec<String>,
}Expand description
OAuth2 authentication session - only contains OAuth tokens
Fields§
§access_token: StringAccess token
refresh_token: Option<String>Optional refresh token
expires_at: Option<DateTime<Utc>>Token expiry time
token_type: StringToken type (usually “Bearer”)
scopes: Vec<String>Granted scopes
Implementations§
Source§impl AuthSession
impl AuthSession
Sourcepub fn new(
access_token: String,
token_type: Option<String>,
expires_in: Option<i64>,
refresh_token: Option<String>,
scopes: Vec<String>,
) -> Self
pub fn new( access_token: String, token_type: Option<String>, expires_in: Option<i64>, refresh_token: Option<String>, scopes: Vec<String>, ) -> Self
Create a new OAuth auth session
Sourcepub fn is_expired(&self, buffer_seconds: i64) -> bool
pub fn is_expired(&self, buffer_seconds: i64) -> bool
Check if the OAuth token is expired or will expire within the given buffer
Sourcepub fn needs_refresh(&self) -> bool
pub fn needs_refresh(&self) -> bool
Check if the OAuth token needs refreshing (expired with 5 minute buffer)
Sourcepub fn get_access_token(&self) -> &str
pub fn get_access_token(&self) -> &str
Get access token for OAuth sessions
Trait Implementations§
Source§impl Clone for AuthSession
impl Clone for AuthSession
Source§fn clone(&self) -> AuthSession
fn clone(&self) -> AuthSession
Returns a duplicate of the value. Read more
1.0.0 · 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 AuthSession
impl Debug for AuthSession
Source§impl<'de> Deserialize<'de> for AuthSession
impl<'de> Deserialize<'de> for AuthSession
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Into<McpSession> for AuthSession
impl Into<McpSession> for AuthSession
Source§fn into(self) -> McpSession
fn into(self) -> McpSession
Converts this type into the (usually inferred) input type.
Auto Trait Implementations§
impl Freeze for AuthSession
impl RefUnwindSafe for AuthSession
impl Send for AuthSession
impl Sync for AuthSession
impl Unpin for AuthSession
impl UnsafeUnpin for AuthSession
impl UnwindSafe for AuthSession
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