tuwunel_service/oauth/token_response.rs
1use derive_more::Debug;
2use serde::Deserialize;
3use tuwunel_core::redacted_debug;
4
5/// Fields deserialized from an upstream provider's `/token` response.
6///
7/// This separate shape omits `expires_at`: some providers encode it as a Unix
8/// timestamp, while the persisted `Session` stores a `SystemTime` derived from
9/// `expires_in`.
10#[derive(Debug, Deserialize)]
11pub struct TokenResponse {
12 /// Token type (bearer, mac, etc).
13 pub token_type: Option<String>,
14
15 /// Access token granted by the provider.
16 #[debug("{}", redacted_debug!(access_token))]
17 pub access_token: Option<String>,
18
19 /// Duration in seconds the access_token is valid for.
20 pub expires_in: Option<u64>,
21
22 /// Token used to refresh the access_token.
23 #[debug("{}", redacted_debug!(refresh_token))]
24 pub refresh_token: Option<String>,
25
26 /// Duration in seconds the refresh_token is valid for.
27 pub refresh_token_expires_in: Option<u64>,
28
29 /// Access scope actually granted (if supported).
30 pub scope: Option<String>,
31
32 /// Signed JWT containing the user's identity claims (OIDC).
33 #[debug("{}", redacted_debug!(id_token))]
34 pub id_token: Option<String>,
35}