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>

source

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>

source§

fn clone(&self) -> KeycloakAuth<PP>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

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>>

Responses produced by the service.
§

type Error = Error

Errors produced by the service.
§

type InitError = ()

Errors produced while building a transform service.
§

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>>

The future response value.
source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more