refactor: code cleanup

This commit is contained in:
Sebastian Pravda 2022-10-26 10:28:19 +02:00
parent a2d1447c2d
commit 5d52cf7772
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57

View file

@ -21,8 +21,10 @@ impl<'r> FromRequest<'r> for TokenRequest {
let auth_string = auth.to_string();
if auth_string.starts_with("Bearer") {
let token = auth_string[6..auth_string.len()].trim();
if let Ok(token_data) = decode_candidate_token(token.to_string()) {
return Outcome::Success(TokenRequest(token_data.claims));
let token_data = decode_candidate_token(token.to_string());
if token_data.is_ok() {
return Outcome::Success(TokenRequest(token_data.ok().unwrap().claims));
}
}
}