pub struct Verifier { /* private fields */ }Expand description
What a verifier requires of a token.
Implementations§
Source§impl Verifier
impl Verifier
Sourcepub fn new(
trusted_keys: Vec<PublicKeyBytes>,
expected_issuer: impl Into<String>,
expected_audience: impl Into<String>,
) -> ActResult<Self>
pub fn new( trusted_keys: Vec<PublicKeyBytes>, expected_issuer: impl Into<String>, expected_audience: impl Into<String>, ) -> ActResult<Self>
Builds a verifier.
§Errors
Returns ActError::NoTrustedKeys if trusted_keys is empty, since no
token could then ever verify and the misconfiguration should surface at
construction rather than as a stream of signature failures.
Sourcepub fn requiring_scopes(self, scopes: impl IntoIterator<Item = Scope>) -> Self
pub fn requiring_scopes(self, scopes: impl IntoIterator<Item = Scope>) -> Self
Requires that the token grant every scope in scopes.
Sourcepub fn with_leeway_seconds(self, seconds: i64) -> Self
pub fn with_leeway_seconds(self, seconds: i64) -> Self
Allows seconds of clock skew on the nbf and exp checks.
Applied symmetrically. Callers running across hosts without tightly synchronized clocks need a small allowance here; leaving it at zero makes a token minted moments ago fail at a verifier whose clock trails the issuer’s.
Sourcepub fn with_clock(self, now_unix_seconds: i64) -> Self
pub fn with_clock(self, now_unix_seconds: i64) -> Self
Pins the time used for temporal checks, in seconds since the Unix epoch.
Intended for tests and for replaying a decision at a known instant.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Verifier
impl RefUnwindSafe for Verifier
impl Send for Verifier
impl Sync for Verifier
impl Unpin for Verifier
impl UnsafeUnpin for Verifier
impl UnwindSafe for Verifier
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