#[non_exhaustive]pub enum TokenType {
Bearer,
ProofOfPossession,
Other(i32),
}Expand description
The type of the token issued as described in section 7.1 of RFC 6749.
Token types are used in the AccessTokenResponse.
§Example
For example, if you wish to indicate in your response that the token is of the proof-of-possession type:
let request = AccessTokenResponse::builder()
.access_token(vec![1,2,3,4])
.token_type(TokenType::ProofOfPossession)
.cnf(ProofOfPossessionKey::KeyId(vec![0xDC, 0xAF]))
.build()?;It’s also possible to use your own value for a custom token type, as defined in section 8.7 of RFC 9200:
let request = AccessTokenResponse::builder()
.access_token(vec![1,2,3,4])
// values below -65536 marked for private use.
.token_type(TokenType::Other(-99999))
.build()?;Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Bearer
Bearer token type as defined in RFC 6750.
ProofOfPossession
Proof-of-possession token type, as specified in RFC 9201.
Other(i32)
An unspecified token type along with its representation in CBOR.
See section 8.7 of RFC 9200 for details.
Trait Implementations§
impl Copy for TokenType
impl Eq for TokenType
impl StructuralPartialEq for TokenType
Auto Trait Implementations§
impl Freeze for TokenType
impl RefUnwindSafe for TokenType
impl Send for TokenType
impl Sync for TokenType
impl Unpin for TokenType
impl UnwindSafe for TokenType
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