pub struct CompanyVerifier { /* private fields */ }Expand description
Verifier the composing service builds once (from its JWT secret) and clones into guarded routes.
Implementations§
Source§impl CompanyVerifier
impl CompanyVerifier
Sourcepub fn hs256(secret: &[u8]) -> CompanyVerifier
pub fn hs256(secret: &[u8]) -> CompanyVerifier
HS256 verifier over a shared secret (the common single-service deployment).
Sourcepub fn rs256(public_key_pem: &[u8]) -> Result<CompanyVerifier, Error>
pub fn rs256(public_key_pem: &[u8]) -> Result<CompanyVerifier, Error>
RS256 verifier over a PEM-encoded public key, for deployments where the issuer signs with a private key this service never holds.
§Errors
Returns an error if public_key_pem is not a valid PEM-encoded RSA public key.
Sourcepub fn verify(&self, token: &str) -> Option<CompanyContext>
pub fn verify(&self, token: &str) -> Option<CompanyContext>
Validate a raw access token → a company context, or None if the signature/expiry is
bad, the company_id claim is absent, or the token is not an access credential.
A typ claim of anything other than "access" fails verification: a refresh token is a
rotation credential, and presenting it to a guarded route must not open a scoped session.
Tokens minted before typ existed carry no claim and stay accepted.
Trait Implementations§
Source§impl Clone for CompanyVerifier
impl Clone for CompanyVerifier
Source§fn clone(&self) -> CompanyVerifier
fn clone(&self) -> CompanyVerifier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CompanyVerifier
impl RefUnwindSafe for CompanyVerifier
impl Send for CompanyVerifier
impl Sync for CompanyVerifier
impl Unpin for CompanyVerifier
impl UnsafeUnpin for CompanyVerifier
impl UnwindSafe for CompanyVerifier
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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