#[non_exhaustive]pub struct TokenExchangeBody {
pub access_token: String,
pub token_type: String,
pub expires_in: Option<u64>,
pub refresh_token: Option<String>,
pub id_token: Option<String>,
}Expand description
JSON body for FakePasServer::expect_token_exchange.
Mirrors the OAuth 2.0 token-endpoint response shape (RFC 6749 §5.1 +
OIDC Core §3.1.3.3). Use Self::bearer for the minimal-success
shape and chain with_* builders to add optional fields.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.access_token: String§token_type: String§expires_in: Option<u64>§refresh_token: Option<String>§id_token: Option<String>Implementations§
Source§impl TokenExchangeBody
impl TokenExchangeBody
Sourcepub fn bearer(access_token: impl Into<String>) -> Self
pub fn bearer(access_token: impl Into<String>) -> Self
Minimal Bearer-typed token response with expires_in = 3600.
Sourcepub fn with_refresh_token(self, rt: impl Into<String>) -> Self
pub fn with_refresh_token(self, rt: impl Into<String>) -> Self
Set the refresh_token field (PAS rotated the credential).
Sourcepub fn with_id_token(self, id_token: impl Into<String>) -> Self
pub fn with_id_token(self, id_token: impl Into<String>) -> Self
Set the id_token field (OIDC scope flows). Use
FakePasServer::sign_id_token to produce the value.
Sourcepub fn with_expires_in(self, secs: u64) -> Self
pub fn with_expires_in(self, secs: u64) -> Self
Override the expires_in hint.
Trait Implementations§
Source§impl Clone for TokenExchangeBody
impl Clone for TokenExchangeBody
Source§fn clone(&self) -> TokenExchangeBody
fn clone(&self) -> TokenExchangeBody
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TokenExchangeBody
impl Debug for TokenExchangeBody
Auto Trait Implementations§
impl Freeze for TokenExchangeBody
impl RefUnwindSafe for TokenExchangeBody
impl Send for TokenExchangeBody
impl Sync for TokenExchangeBody
impl Unpin for TokenExchangeBody
impl UnsafeUnpin for TokenExchangeBody
impl UnwindSafe for TokenExchangeBody
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