fix: JwtClaims error message missplaced

This commit is contained in:
cduvray 2023-01-24 07:31:50 +01:00
parent 215bc173c6
commit 7b6f8fb4c5

View file

@ -26,11 +26,10 @@ where
type Rejection = StatusCode;
async fn from_request_parts(parts: &mut Parts, _: &S) -> Result<Self, Self::Rejection> {
tracing::error!("JwtClaims extractor must be behind a jwt-authoriser layer!");
if let Some(claims) = parts.extensions.get::<TokenData<T>>() {
Ok(JwtClaims(claims.claims.clone()))
} else {
tracing::error!("JwtClaims extractor must be behind a jwt-authoriser layer!");
Err(StatusCode::INTERNAL_SERVER_ERROR)
}
}