Updated refresh token endpoint to enable rotation

This commit is contained in:
Benjamin Sherriff
2023-10-18 20:43:02 -04:00
parent c42ecd6591
commit 41522885b1
8 changed files with 318 additions and 104 deletions

View File

@@ -150,11 +150,10 @@ impl FromRequest for JwtAuth {
};
let user_email = match conn.get::<_, String>(access_token_uuid.clone().to_string()) {
Ok(result) => result,
Err(err) => {
error!("Failed to get access token from redis: {}", err);
Err(_) => {
return ready(Err(ActixError::from(ServiceError {
status: 500,
message: format!("Failed to get access token from redis: {}", err)
status: 404,
message: format!("Access token was not found")
})))
}
};
@@ -163,9 +162,9 @@ impl FromRequest for JwtAuth {
Ok(user) => {
ready(Ok(JwtAuth { token: access_token_uuid, user: user.into() }))
}
Err(err) => return ready(Err(ActixError::from(ServiceError {
status: 500,
message: format!("Failed to get user from db: {}", err)
Err(_) => return ready(Err(ActixError::from(ServiceError {
status: 404,
message: format!("User was not found")
})))
}
}