Trait cataclysm_jwt::jwt_session::JWTSession
source · pub trait JWTSession: Clone + SessionCreator {
// Required methods
fn initial_validation(&self, jwt: &JWT) -> Result<(), Error>;
fn build_from_req(
&self,
req: &Request
) -> Result<HashMap<String, String>, Error>;
// Provided method
fn obtain_token_from_req(req: &Request) -> Result<JWT, Error> { ... }
}
Expand description
Ussage
Trait employed for HS256 and RS256 session to avoid code repetition and specify what needs to be done to verify JWT correctly
The obtain_token_from_req
function is the same in both cases, since it returns a JWT
instance
This trait is made public in case someone finds it useful.
Required Methods§
Provided Methods§
sourcefn obtain_token_from_req(req: &Request) -> Result<JWT, Error>
fn obtain_token_from_req(req: &Request) -> Result<JWT, Error>
From request extract JWT to manipulate it easier later on