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
sourcepub fn from_oidc(issuer: &str) -> JwtAuthorizer<C>
pub fn from_oidc(issuer: &str) -> JwtAuthorizer<C>
Builds Authorizer Layer from a OpenId Connect discover metadata
sourcepub fn from_jwks_url(url: &'static str) -> JwtAuthorizer<C>
pub fn from_jwks_url(url: &'static str) -> JwtAuthorizer<C>
Builds Authorizer Layer from a JWKS endpoint
sourcepub fn from_rsa_pem(path: &'static str) -> JwtAuthorizer<C>
pub fn from_rsa_pem(path: &'static str) -> JwtAuthorizer<C>
Builds Authorizer Layer from a RSA PEM file
sourcepub fn from_ec_pem(path: &'static str) -> JwtAuthorizer<C>
pub fn from_ec_pem(path: &'static str) -> JwtAuthorizer<C>
Builds Authorizer Layer from a EC PEM file
sourcepub fn from_ed_pem(path: &'static str) -> JwtAuthorizer<C>
pub fn from_ed_pem(path: &'static str) -> JwtAuthorizer<C>
Builds Authorizer Layer from a EC PEM file
sourcepub fn from_secret(secret: &'static str) -> JwtAuthorizer<C>
pub fn from_secret(secret: &'static str) -> JwtAuthorizer<C>
Builds Authorizer Layer from a secret phrase
sourcepub fn refresh(self, refresh: Refresh) -> JwtAuthorizer<C>
pub fn refresh(self, refresh: Refresh) -> JwtAuthorizer<C>
Refreshes configuration for jwk store
sourcepub fn no_refresh(self) -> JwtAuthorizer<C>
pub fn no_refresh(self) -> JwtAuthorizer<C>
no refresh, jwks will be loaded juste once
sourcepub fn check(self, checker_fn: fn(_: &C) -> bool) -> JwtAuthorizer<C>
pub fn check(self, checker_fn: fn(_: &C) -> bool) -> JwtAuthorizer<C>
configures token content check (custom function), if false a 403 will be sent. (AuthError::InvalidClaims())
sourcepub async fn layer(&self) -> Result<AsyncAuthorizationLayer<C>, InitError>
pub async fn layer(&self) -> Result<AsyncAuthorizationLayer<C>, InitError>
Build axum layer