Struct re_auth::RedapProvider
source · #[repr(transparent)]pub struct RedapProvider {
secret_key: Vec<u8>,
}
Expand description
A secret key that is used to generate and verify tokens.
This represents a symmetric authentication scheme, which means that the same key is used to both sign and verify the token. In the future, we will need to support asymmetric schemes too.
The key is stored unencrypted in memory.
Fields§
§secret_key: Vec<u8>
Implementations§
source§impl RedapProvider
impl RedapProvider
sourcepub fn from_base64(base64: impl AsRef<str>) -> Result<Self, Error>
pub fn from_base64(base64: impl AsRef<str>) -> Result<Self, Error>
Decodes a [base64
] encoded secret key.
sourcepub fn token(
&self,
duration: Duration,
issuer: impl Into<String>,
subject: impl Into<String>,
) -> Result<Jwt, Error>
pub fn token( &self, duration: Duration, issuer: impl Into<String>, subject: impl Into<String>, ) -> Result<Jwt, Error>
Generates a new JWT token that is valid for the given duration.
It is important to note that the token is not encrypted, but merely
signed by the RedapProvider
. This means that its contents are readable
by everyone.
If duration
is None
, the token will be valid forever. scope
can be
used to restrict the token to a specific context.
Trait Implementations§
source§impl Clone for RedapProvider
impl Clone for RedapProvider
source§fn clone(&self) -> RedapProvider
fn clone(&self) -> RedapProvider
Returns a copy of the value. Read more
1.0.0 · 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 RedapProvider
impl Debug for RedapProvider
source§impl PartialEq for RedapProvider
impl PartialEq for RedapProvider
source§fn eq(&self, other: &RedapProvider) -> bool
fn eq(&self, other: &RedapProvider) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for RedapProvider
impl StructuralPartialEq for RedapProvider
Auto Trait Implementations§
impl Freeze for RedapProvider
impl RefUnwindSafe for RedapProvider
impl Send for RedapProvider
impl Sync for RedapProvider
impl Unpin for RedapProvider
impl UnwindSafe for RedapProvider
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request