Struct jwt_authorizer::layer::JwtAuthorizer
source · pub struct JwtAuthorizer<C>where
C: Clone + DeserializeOwned,{ /* private fields */ }Expand description
Authorizer Layer builder
- initialisation of the Authorizer from jwks, rsa, ed, ec or secret
- can define a checker (jwt claims check)
Implementations§
source§impl<C> JwtAuthorizer<C>where
C: Clone + DeserializeOwned + Send + Sync,
impl<C> JwtAuthorizer<C>where
C: Clone + DeserializeOwned + Send + Sync,
authorization layer builder
pub fn new() -> Self
sourcepub fn from_jwks_url(self, url: &'static str) -> JwtAuthorizer<C>
pub fn from_jwks_url(self, url: &'static str) -> JwtAuthorizer<C>
Build Authorizer Layer from a JWKS endpoint
sourcepub fn from_rsa_pem(self, path: &'static str) -> JwtAuthorizer<C>
pub fn from_rsa_pem(self, path: &'static str) -> JwtAuthorizer<C>
Build Authorizer Layer from a RSA PEM file
sourcepub fn from_ec_pem(self, path: &'static str) -> JwtAuthorizer<C>
pub fn from_ec_pem(self, path: &'static str) -> JwtAuthorizer<C>
Build Authorizer Layer from a EC PEM file
sourcepub fn from_ed_pem(self, path: &'static str) -> JwtAuthorizer<C>
pub fn from_ed_pem(self, path: &'static str) -> JwtAuthorizer<C>
Build Authorizer Layer from a EC PEM file
sourcepub fn from_secret(self, secret: &'static str) -> JwtAuthorizer<C>
pub fn from_secret(self, secret: &'static str) -> JwtAuthorizer<C>
Build Authorizer Layer from a secret phrase
sourcepub fn with_check(self, checker_fn: fn(_: &C) -> bool) -> JwtAuthorizer<C>
pub fn with_check(self, checker_fn: fn(_: &C) -> bool) -> JwtAuthorizer<C>
layer that checks token validity and claim constraints (custom function)
sourcepub fn layer(&self) -> Result<AsyncAuthorizationLayer<C>, InitError>
pub fn layer(&self) -> Result<AsyncAuthorizationLayer<C>, InitError>
Build axum layer