[][src]Struct tokkit::parsers::GoogleV3TokenInfoParser

pub struct GoogleV3TokenInfoParser;

Parses a TokenInfo from JSON

Description

##Example

use tokkit::parsers::{GoogleV3TokenInfoParser, TokenInfoParser};
use tokkit::*;

let sample = br#"
{
"aud":"8819981768.apps.googleusercontent.com",
"user_id":"123456789",
"scope":"https://www.googleapis.com/auth/drive.metadata.readonly",
"expires_in":436
}
"#;

    let expected = TokenInfo {
        active: true,
        user_id: Some(UserId::new("123456789")),
        scope: vec![Scope::new(
            "https://www.googleapis.com/auth/drive.metadata.readonly",
    )],
    expires_in_seconds: Some(436),
};

let token_info = GoogleV3TokenInfoParser.parse(sample).unwrap();

assert_eq!(expected, token_info);

Trait Implementations

impl TokenInfoParser for GoogleV3TokenInfoParser[src]

impl Clone for GoogleV3TokenInfoParser[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err