[−][src]Struct gotham_middleware_jwt::JWTMiddleware
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
.
Methods
impl<T> JWTMiddleware<T> where
T: for<'de> Deserialize<'de> + Send + Sync,
[src]
impl<T> JWTMiddleware<T> where
T: for<'de> Deserialize<'de> + Send + Sync,
pub fn new(secret: &'static str) -> Self
[src]
pub fn new(secret: &'static str) -> Self
Creates a JWTMiddleware instance from the provided secret, which, by default, uses HS256 as the crypto scheme.
Trait Implementations
impl<T> NewMiddleware for JWTMiddleware<T> where
T: for<'de> Deserialize<'de> + RefUnwindSafe + Send + Sync + 'static,
[src]
impl<T> NewMiddleware for JWTMiddleware<T> where
T: for<'de> Deserialize<'de> + RefUnwindSafe + Send + Sync + 'static,
type Instance = JWTMiddleware<T>
The type of Middleware
created by the NewMiddleware
.
fn new_middleware(&self) -> Result<Self::Instance>
[src]
fn new_middleware(&self) -> Result<Self::Instance>
Create and return a new Middleware
value.
impl<T> Middleware for JWTMiddleware<T> where
T: for<'de> Deserialize<'de> + Send + Sync + 'static,
[src]
impl<T> Middleware for JWTMiddleware<T> where
T: for<'de> Deserialize<'de> + Send + Sync + 'static,
fn call<Chain>(self, state: State, chain: Chain) -> Box<HandlerFuture> where
Chain: FnOnce(State) -> Box<HandlerFuture>,
[src]
fn call<Chain>(self, state: State, chain: Chain) -> Box<HandlerFuture> where
Chain: FnOnce(State) -> Box<HandlerFuture>,
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
Auto Trait Implementations
impl<T> Send for JWTMiddleware<T> where
T: Send,
impl<T> Send for JWTMiddleware<T> where
T: Send,
impl<T> Sync for JWTMiddleware<T> where
T: Sync,
impl<T> Sync for JWTMiddleware<T> where
T: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T> Erased for T
impl<T> Erased for T