pub struct JwtVerifier<C: Cache<String, Jwks>, H: HttpClient> {
pub issuer_map: HashMap<String, String>,
pub audience: String,
pub http: Arc<H>,
pub cache: Arc<C>,
pub clock_skew_sec: i64,
pub default_issuer: Option<String>,
}Available on crate feature
verifier only.Expand description
JWT Verifier for Resource Server
Fields§
§issuer_map: HashMap<String, String>Map of tenant/host to issuer URL
audience: StringExpected audience
http: Arc<H>HTTP client
cache: Arc<C>JWKS cache
clock_skew_sec: i64Clock skew tolerance in seconds
default_issuer: Option<String>Default issuer if no mapping found
Implementations§
Source§impl<C: Cache<String, Jwks>, H: HttpClient> JwtVerifier<C, H>
impl<C: Cache<String, Jwks>, H: HttpClient> JwtVerifier<C, H>
Sourcepub fn new(
issuer_map: HashMap<String, String>,
audience: String,
http: Arc<H>,
cache: Arc<C>,
) -> Self
pub fn new( issuer_map: HashMap<String, String>, audience: String, http: Arc<H>, cache: Arc<C>, ) -> Self
Create a new JWT verifier
Sourcepub async fn verify(&self, bearer: &str) -> Result<VerifiedClaims>
pub async fn verify(&self, bearer: &str) -> Result<VerifiedClaims>
Verify a bearer token
Sourcepub fn resolve_issuer_with_tenant(&self, tenant: &str) -> Result<String>
pub fn resolve_issuer_with_tenant(&self, tenant: &str) -> Result<String>
Resolve issuer with tenant context This method allows multi-tenant routing by selecting issuer based on tenant identifier
Auto Trait Implementations§
impl<C, H> Freeze for JwtVerifier<C, H>
impl<C, H> RefUnwindSafe for JwtVerifier<C, H>where
H: RefUnwindSafe,
C: RefUnwindSafe,
impl<C, H> Send for JwtVerifier<C, H>
impl<C, H> Sync for JwtVerifier<C, H>
impl<C, H> Unpin for JwtVerifier<C, H>
impl<C, H> UnwindSafe for JwtVerifier<C, H>where
H: RefUnwindSafe,
C: RefUnwindSafe,
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