pub struct KeycloakAuth<PP: PassthroughPolicy> {
pub detailed_responses: bool,
pub keycloak_oid_public_key: DecodingKey,
pub required_roles: Vec<Role>,
pub passthrough_policy: PP,
}
Expand description
Middleware configuration
Fields§
§detailed_responses: bool
If true, error responses will be more detailed to explain what went wrong
keycloak_oid_public_key: DecodingKey
Public key to use to verify JWT
required_roles: Vec<Role>
List of Keycloak roles that must be included in JWT
passthrough_policy: PP
Policy that defines whether or not the middleware should return a HTTP error or continue to the handler (depending on which error occurred)
Implementations§
source§impl KeycloakAuth<AlwaysReturnPolicy>
impl KeycloakAuth<AlwaysReturnPolicy>
sourcepub fn default_with_pk(keycloak_oid_public_key: DecodingKey) -> Self
pub fn default_with_pk(keycloak_oid_public_key: DecodingKey) -> Self
Create a middleware with the provided public key and the default config
Trait Implementations§
source§impl<PP: Clone + PassthroughPolicy> Clone for KeycloakAuth<PP>
impl<PP: Clone + PassthroughPolicy> Clone for KeycloakAuth<PP>
source§fn clone(&self) -> KeycloakAuth<PP>
fn clone(&self) -> KeycloakAuth<PP>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<PP: PassthroughPolicy, S, B> Transform<S, ServiceRequest> for KeycloakAuth<PP>where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: 'static,
impl<PP: PassthroughPolicy, S, B> Transform<S, ServiceRequest> for KeycloakAuth<PP>where
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
S::Future: 'static,
B: 'static,
§type Response = ServiceResponse<EitherBody<B>>
type Response = ServiceResponse<EitherBody<B>>
Responses produced by the service.
§type Transform = KeycloakAuthMiddleware<PP, S>
type Transform = KeycloakAuthMiddleware<PP, S>
The
TransformService
value created by this factory§type Future = Ready<Result<<KeycloakAuth<PP> as Transform<S, ServiceRequest>>::Transform, <KeycloakAuth<PP> as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<KeycloakAuth<PP> as Transform<S, ServiceRequest>>::Transform, <KeycloakAuth<PP> as Transform<S, ServiceRequest>>::InitError>>
The future response value.
source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations§
impl<PP> RefUnwindSafe for KeycloakAuth<PP>where
PP: RefUnwindSafe,
impl<PP> Send for KeycloakAuth<PP>where
PP: Send,
impl<PP> Sync for KeycloakAuth<PP>where
PP: Sync,
impl<PP> Unpin for KeycloakAuth<PP>where
PP: Unpin,
impl<PP> UnwindSafe for KeycloakAuth<PP>where
PP: UnwindSafe,
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