[][src]Struct rowdy::token::RefreshToken

pub struct RefreshToken(_);

A Refresh Token containing the payload (called refresh payload) used by an authenticator to issue new access tokens without needing the user to re-authenticate.

Internally, this is a newtype struct wrapping an encrypted JWE containing the RefreshTokenPayload. In other words, this is an encrypted token (JWE) containing a payload. The payload is a signed token (JWS) which contains a set of values (JWT Claims Set).

Usually, the semantics and inner workings of the refresh token is, and should be, opaque to any user. Thus, some of the methods to manipulate the inner details of the refresh tokens are not public.

This struct is serialized and deserialized to a string, which is the Compact serialization of a JWE.

Before you can serialize the struct, you will need to call encrypt to first sign the embedded JWS, and then encrypt it. If you do not do so, serde will refuse to serialize.

Conversely, only an encrypted token can be deserialized. serde will refuse to deserialize a decrypted token similarly. You will need to call decrypt to decrypt the deserialized token.

Methods

impl RefreshToken[src]

pub fn new_encrypted(token: &str) -> Self[src]

Create a new decrypted struct based on the Base64 encoded token string

pub fn unwrap(self) -> RefreshTokenJWE[src]

Unwrap and consumes self, producing the wrapped JWE. You generally should not, and do not need to call this.

pub fn encrypted(&self) -> bool[src]

Returns whether the refresh token is already encrypted and signed

pub fn decrypted(&self) -> bool[src]

Returns whether the refresh token is already decrypted and verified

pub fn encrypt(self, secret: &Secret, key: &JWK<Empty>) -> Result<Self, Error>[src]

Consumes self, and sign and encrypt the refresh token. If the Refresh Token is already encrypted, this will return an error

pub fn decrypt(
    self,
    secret: &Secret,
    key: &JWK<Empty>,
    signing_algorithm: SignatureAlgorithm,
    cek_algorithm: KeyManagementAlgorithm,
    enc_algorithm: ContentEncryptionAlgorithm
) -> Result<Self, Error>
[src]

Consumes self, and decrypt and verify the signature of the refresh token If the refresh token is already decrypted, this will return an error

pub fn payload(&self) -> Result<&JsonValue, Error>[src]

Retrieve a reference to the decrypted payload

pub fn validate(
    &self,
    service: &str,
    config: &Configuration,
    options: Option<ValidationOptions>
) -> Result<(), Error>
[src]

Validate the times and claims of the refresh token

pub fn to_string(&self) -> Result<String, Error>[src]

Convenience function to convert a decrypted payload to string

Trait Implementations

impl PartialEq<RefreshToken> for RefreshToken[src]

impl From<Compact<Compact<ClaimsSet<Value>, Empty>, Empty>> for RefreshToken[src]

impl Clone for RefreshToken[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for RefreshToken[src]

impl Borrow<Compact<Compact<ClaimsSet<Value>, Empty>, Empty>> for RefreshToken[src]

impl Serialize for RefreshToken[src]

impl<'de> Deserialize<'de> for RefreshToken[src]

Auto Trait Implementations

Blanket Implementations

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

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

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> IntoCollection for T

impl<T, I> AsResult for T where
    I: Input, 

impl<T> Erased for T