[−][src]Struct rowdy::token::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]
self,
secret: &Secret,
key: &JWK<Empty>,
signing_algorithm: SignatureAlgorithm,
cek_algorithm: KeyManagementAlgorithm,
enc_algorithm: ContentEncryptionAlgorithm
) -> Result<Self, Error>
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]
&self,
service: &str,
config: &Configuration,
options: Option<ValidationOptions>
) -> Result<(), Error>
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]
fn eq(&self, other: &RefreshToken) -> bool
[src]
fn ne(&self, other: &RefreshToken) -> bool
[src]
impl From<Compact<Compact<ClaimsSet<Value>, Empty>, Empty>> for RefreshToken
[src]
fn from(value: RefreshTokenJWE) -> Self
[src]
impl Clone for RefreshToken
[src]
fn clone(&self) -> 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]
fn borrow(&self) -> &RefreshTokenJWE
[src]
impl Serialize for RefreshToken
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for RefreshToken
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for RefreshToken
impl Sync for RefreshToken
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Typeable for T where
T: Any,
T: Any,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> IntoCollection for T
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
A: Array<Item = T>,
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
A: Array<Item = U>,
F: FnMut(T) -> U,
A: Array<Item = U>,
F: FnMut(T) -> U,
impl<T, I> AsResult for T where
I: Input,
I: Input,