Struct autoendpoint::headers::vapid::VapidHeader
source · pub struct VapidHeader {
pub scheme: String,
pub token: String,
pub version_data: VapidVersionData,
}
Expand description
Parses the VAPID authorization header
Fields§
§scheme: String
§token: String
§version_data: VapidVersionData
Implementations§
source§impl VapidHeader
impl VapidHeader
sourcepub fn parse(header: &str) -> Result<VapidHeader, VapidError>
pub fn parse(header: &str) -> Result<VapidHeader, VapidError>
Parse the VAPID authorization header. The public key is available if the version is 2 (“vapid” scheme).
sourcepub fn insecure_sub(&self) -> Result<String, VapidError>
pub fn insecure_sub(&self) -> Result<String, VapidError>
Return the claimed sub
after doing some minimal checks for validity.
WARNING: THIS FUNCTION DOES NOT VALIDATE THE VAPID HEADER AND SHOULD
ONLY BE USED FOR LOGGING AND METRIC REPORTING FUNCTIONS.
Proper validation should be done by [crate::extractors::subscription::validate_vapid_jwt()]
pub fn claims(&self) -> Result<VapidClaims, VapidError>
Trait Implementations§
source§impl Clone for VapidHeader
impl Clone for VapidHeader
source§fn clone(&self) -> VapidHeader
fn clone(&self) -> VapidHeader
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 VapidHeader
impl Debug for VapidHeader
source§impl PartialEq for VapidHeader
impl PartialEq for VapidHeader
source§impl TryFrom<VapidHeader> for VapidClaims
impl TryFrom<VapidHeader> for VapidClaims
source§type Error = VapidError
type Error = VapidError
The type returned in the event of a conversion error.
impl Eq for VapidHeader
impl StructuralPartialEq for VapidHeader
Auto Trait Implementations§
impl Freeze for VapidHeader
impl RefUnwindSafe for VapidHeader
impl Send for VapidHeader
impl Sync for VapidHeader
impl Unpin for VapidHeader
impl UnwindSafe for VapidHeader
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
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
Checks if this value is equivalent to the given key. Read more
§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.§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
Checks if this value is equivalent to the given key. Read more
§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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more