pub struct JWTMiddleware<T> { /* private fields */ }
Expand description

This middleware verifies that JSON Web Token credentials, provided via the HTTP Authorization header, are extracted, parsed, and validated according to best practices before passing control to middleware beneath this middleware for a given mount point.

Requests that lack the Authorization header are returned with the Status Code 400: Bad Request. Tokens that fail validation cause the middleware to return Status Code 401: Unauthorized.

Implementations

Creates a JWTMiddleware instance from the provided secret, which, by default, uses HS256 as the crypto scheme.

Create a new instance of the middleware by appending new validation constraints.

Trait Implementations

Entry point to the middleware. To pass the request on to the application, the middleware invokes the chain function with the provided state. Read more
The type of Middleware created by the NewMiddleware.
Create and return a new Middleware value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.