pub struct RpIdVerifier<P> { /* private fields */ }
Expand description

Wrapper struct for verifying that a given RpId matches the request’s origin.

While most cases should not use this type directly and instead use Client, there are some cases that warrant the need for checking an RpId in the same way that the client does, but without the rest of pieces that the client needs.

Implementations§

source§

impl<P> RpIdVerifier<P>
where P: EffectiveTLDProvider + Sync + 'static,

source

pub fn new(tld_provider: P) -> Self

Create a new Verifier with a given TLD provider. Most cases should just use public_suffix::DEFAULT_PROVIDER.

source

pub fn allows_insecure_localhost(self, is_allowed: bool) -> Self

Allows RpIdVerifier::assert_domain to pass through requests from localhost

source

pub fn assert_domain<'a>( &self, origin: &'a Url, rp_id: Option<&'a str> ) -> Result<&'a str, WebauthnError>

Parse the given Relying Party Id and verify it against the origin url of the request.

This follows the steps defined in: https://html.spec.whatwg.org/multipage/browsers.html#is-a-registrable-domain-suffix-of-or-is-equal-to

Returns the effective domain on success or some WebauthnError

Auto Trait Implementations§

§

impl<P> RefUnwindSafe for RpIdVerifier<P>
where P: RefUnwindSafe,

§

impl<P> Send for RpIdVerifier<P>
where P: Send,

§

impl<P> Sync for RpIdVerifier<P>
where P: Sync,

§

impl<P> Unpin for RpIdVerifier<P>

§

impl<P> UnwindSafe for RpIdVerifier<P>
where P: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V