pub struct AuthInfo {
pub token_unique_id: String,
pub client_id: Option<String>,
pub user_id: Option<String>,
pub scopes: Option<Vec<String>>,
pub expires_at: Option<SystemTime>,
pub audience: Option<Audience>,
pub extra: Option<Map<String, Value>>,
}Expand description
Information about a validated access token, provided to request handlers.
Fields§
§token_unique_id: StringContains a unique id for jwt use jti claim if available, otherwise use token or a reliable hash of token
client_id: Option<String>The client ID associated with this token.
user_id: Option<String>Optional user identifier for the token
scopes: Option<Vec<String>>Scopes associated with this token.
expires_at: Option<SystemTime>When the token expires (in seconds since epoch). This field is optional, as the token may not have an expiration time.
audience: Option<Audience>The RFC 8707 resource server identifier for which this token is valid. If set, this MUST match the MCP server’s resource identifier (minus hash fragment).
extra: Option<Map<String, Value>>Additional data associated with the token. This field can be used to attach any extra data to the auth info.
Implementations§
Source§impl AuthInfo
impl AuthInfo
pub fn from_token_data( token: String, token_data: TokenData<AuthClaims>, extra: Option<Map<String, Value>>, ) -> Result<Self, AuthenticationError>
pub fn from_introspection_response( token: String, data: IntrospectionResponse, extra: Option<Map<String, Value>>, ) -> Result<Self, AuthenticationError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AuthInfo
impl<'de> Deserialize<'de> for AuthInfo
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
Auto Trait Implementations§
impl Freeze for AuthInfo
impl RefUnwindSafe for AuthInfo
impl Send for AuthInfo
impl Sync for AuthInfo
impl Unpin for AuthInfo
impl UnwindSafe for AuthInfo
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