@ -58,28 +58,28 @@ fn decode_jwt<T: DeserializeOwned>(token: &str, issuer: String) -> Result<T, Err
. map_res ( "Error decoding JWT" )
}
pub fn decode_login ( token : & str ) -> Result < LoginJWT Claims , Error > {
pub fn decode_login ( token : & str ) -> Result < LoginJwt Claims , Error > {
decode_jwt ( token , JWT_LOGIN_ISSUER . to_string ( ) )
}
pub fn decode_invite ( token : & str ) -> Result < InviteJWT Claims , Error > {
pub fn decode_invite ( token : & str ) -> Result < InviteJwt Claims , Error > {
decode_jwt ( token , JWT_INVITE_ISSUER . to_string ( ) )
}
pub fn decode_delete ( token : & str ) -> Result < DeleteJWT Claims , Error > {
pub fn decode_delete ( token : & str ) -> Result < DeleteJwt Claims , Error > {
decode_jwt ( token , JWT_DELETE_ISSUER . to_string ( ) )
}
pub fn decode_verify_email ( token : & str ) -> Result < VerifyEmailJWT Claims , Error > {
pub fn decode_verify_email ( token : & str ) -> Result < VerifyEmailJwt Claims , Error > {
decode_jwt ( token , JWT_VERIFYEMAIL_ISSUER . to_string ( ) )
}
pub fn decode_admin ( token : & str ) -> Result < AdminJWT Claims , Error > {
pub fn decode_admin ( token : & str ) -> Result < AdminJwt Claims , Error > {
decode_jwt ( token , JWT_ADMIN_ISSUER . to_string ( ) )
}
#[ derive(Debug, Serialize, Deserialize) ]
pub struct LoginJWT Claims {
pub struct LoginJwt Claims {
// Not before
pub nbf : i64 ,
// Expiration time
@ -110,7 +110,7 @@ pub struct LoginJWTClaims {
}
#[ derive(Debug, Serialize, Deserialize) ]
pub struct InviteJWT Claims {
pub struct InviteJwt Claims {
// Not before
pub nbf : i64 ,
// Expiration time
@ -132,9 +132,9 @@ pub fn generate_invite_claims(
org_id : Option < String > ,
user_org_id : Option < String > ,
invited_by_email : Option < String > ,
) -> InviteJWT Claims {
) -> InviteJwt Claims {
let time_now = Utc ::now ( ) . naive_utc ( ) ;
InviteJWT Claims {
InviteJwt Claims {
nbf : time_now . timestamp ( ) ,
exp : ( time_now + Duration ::days ( 5 ) ) . timestamp ( ) ,
iss : JWT_INVITE_ISSUER . to_string ( ) ,
@ -147,7 +147,7 @@ pub fn generate_invite_claims(
}
#[ derive(Debug, Serialize, Deserialize) ]
pub struct DeleteJWT Claims {
pub struct DeleteJwt Claims {
// Not before
pub nbf : i64 ,
// Expiration time
@ -158,9 +158,9 @@ pub struct DeleteJWTClaims {
pub sub : String ,
}
pub fn generate_delete_claims ( uuid : String ) -> DeleteJWT Claims {
pub fn generate_delete_claims ( uuid : String ) -> DeleteJwt Claims {
let time_now = Utc ::now ( ) . naive_utc ( ) ;
DeleteJWT Claims {
DeleteJwt Claims {
nbf : time_now . timestamp ( ) ,
exp : ( time_now + Duration ::days ( 5 ) ) . timestamp ( ) ,
iss : JWT_DELETE_ISSUER . to_string ( ) ,
@ -169,7 +169,7 @@ pub fn generate_delete_claims(uuid: String) -> DeleteJWTClaims {
}
#[ derive(Debug, Serialize, Deserialize) ]
pub struct VerifyEmailJWT Claims {
pub struct VerifyEmailJwt Claims {
// Not before
pub nbf : i64 ,
// Expiration time
@ -180,9 +180,9 @@ pub struct VerifyEmailJWTClaims {
pub sub : String ,
}
pub fn generate_verify_email_claims ( uuid : String ) -> DeleteJWT Claims {
pub fn generate_verify_email_claims ( uuid : String ) -> DeleteJwt Claims {
let time_now = Utc ::now ( ) . naive_utc ( ) ;
DeleteJWT Claims {
DeleteJwt Claims {
nbf : time_now . timestamp ( ) ,
exp : ( time_now + Duration ::days ( 5 ) ) . timestamp ( ) ,
iss : JWT_VERIFYEMAIL_ISSUER . to_string ( ) ,
@ -191,7 +191,7 @@ pub fn generate_verify_email_claims(uuid: String) -> DeleteJWTClaims {
}
#[ derive(Debug, Serialize, Deserialize) ]
pub struct AdminJWT Claims {
pub struct AdminJwt Claims {
// Not before
pub nbf : i64 ,
// Expiration time
@ -202,9 +202,9 @@ pub struct AdminJWTClaims {
pub sub : String ,
}
pub fn generate_admin_claims ( ) -> AdminJWT Claims {
pub fn generate_admin_claims ( ) -> AdminJwt Claims {
let time_now = Utc ::now ( ) . naive_utc ( ) ;
AdminJWT Claims {
AdminJwt Claims {
nbf : time_now . timestamp ( ) ,
exp : ( time_now + Duration ::minutes ( 20 ) ) . timestamp ( ) ,
iss : JWT_ADMIN_ISSUER . to_string ( ) ,
@ -450,12 +450,12 @@ impl<'a, 'r> FromRequest<'a, 'r> for AdminHeaders {
}
}
impl Into < Headers > for Admin Headers {
fn into ( self ) -> Headers {
impl From < Admin Headers> for Headers {
fn from ( h : AdminHeaders ) -> Headers {
Headers {
host : self . host ,
device : self . device ,
user : self . user ,
host : h . host ,
device : h . device ,
user : h . user ,
}
}
}
@ -529,12 +529,12 @@ impl<'a, 'r> FromRequest<'a, 'r> for ManagerHeaders {
}
}
impl Into < Headers > for Manager Headers {
fn into ( self ) -> Headers {
impl From < Manager Headers> for Headers {
fn from ( h : ManagerHeaders ) -> Headers {
Headers {
host : self . host ,
device : self . device ,
user : self . user ,
host : h . host ,
device : h . device ,
user : h . user ,
}
}
}
@ -571,12 +571,12 @@ impl<'a, 'r> FromRequest<'a, 'r> for ManagerHeadersLoose {
}
}
impl Into < Headers > for Manager HeadersLoose {
fn into ( self ) -> Headers {
impl From < Manager HeadersLoose > for Headers {
fn from ( h : ManagerHeadersLoose ) -> Headers {
Headers {
host : self . host ,
device : self . device ,
user : self . user ,
host : h . host ,
device : h . device ,
user : h . user ,
}
}
}