Fix cargo clippy issues
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -156,8 +156,7 @@ impl Action<'_> {
|
||||
.to_string()
|
||||
}
|
||||
Action::ProviderFailedGetToken { state, code } => format!(
|
||||
"could not complete login from provider because the id_token could not be retrieved! (state={:?} code = {code})",
|
||||
state
|
||||
"could not complete login from provider because the id_token could not be retrieved! (state={state:?} code = {code})"
|
||||
),
|
||||
Action::ProviderFailedGetUserInfo { provider } => format!(
|
||||
"could not get user information from userinfo endpoint of provider {}!",
|
||||
|
@ -22,7 +22,7 @@ impl CodeChallenge {
|
||||
encoded.eq(&self.code_challenge)
|
||||
}
|
||||
s => {
|
||||
log::error!("Unknown code challenge method: {}", s);
|
||||
log::error!("Unknown code challenge method: {s}");
|
||||
false
|
||||
}
|
||||
}
|
||||
@ -40,8 +40,8 @@ mod test {
|
||||
code_challenge: "text1".to_string(),
|
||||
};
|
||||
|
||||
assert_eq!(true, chal.verify_code("text1"));
|
||||
assert_eq!(false, chal.verify_code("text2"));
|
||||
assert!(chal.verify_code("text1"));
|
||||
assert!(!chal.verify_code("text2"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -51,8 +51,8 @@ mod test {
|
||||
code_challenge: "uSOvC48D8TMh6RgW-36XppMlMgys-6KAE_wEIev9W2g".to_string(),
|
||||
};
|
||||
|
||||
assert_eq!(true, chal.verify_code("HIwht3lCHfnsruA+7Sq8NP2mPj5cBZe0Ewf23eK9UQhK4TdCIt3SK7Fr/giCdnfjxYQILOPG2D562emggAa2lA=="));
|
||||
assert_eq!(false, chal.verify_code("text1"));
|
||||
assert!(chal.verify_code("HIwht3lCHfnsruA+7Sq8NP2mPj5cBZe0Ewf23eK9UQhK4TdCIt3SK7Fr/giCdnfjxYQILOPG2D562emggAa2lA=="));
|
||||
assert!(!chal.verify_code("text1"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -62,10 +62,7 @@ mod test {
|
||||
code_challenge: "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM".to_string(),
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
true,
|
||||
chal.verify_code("dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")
|
||||
);
|
||||
assert_eq!(false, chal.verify_code("text1"));
|
||||
assert!(chal.verify_code("dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"));
|
||||
assert!(!chal.verify_code("text1"));
|
||||
}
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ impl SessionIdentity<'_> {
|
||||
.map(|f| match f {
|
||||
Ok(d) => Some(d),
|
||||
Err(e) => {
|
||||
log::warn!("Failed to deserialize session data! {:?}", e);
|
||||
log::warn!("Failed to deserialize session data! {e:?}");
|
||||
None
|
||||
}
|
||||
})
|
||||
@ -65,7 +65,7 @@ impl SessionIdentity<'_> {
|
||||
|
||||
log::debug!("Will set user session data.");
|
||||
if let Err(e) = Identity::login(&req.extensions(), s) {
|
||||
log::error!("Failed to set session data! {}", e);
|
||||
log::error!("Failed to set session data! {e}");
|
||||
}
|
||||
log::debug!("Did set user session data.");
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ impl EntityManager<User> {
|
||||
};
|
||||
|
||||
if let Err(e) = self.replace_entries(|u| u.uid.eq(id), &update(user)) {
|
||||
log::error!("Failed to update user information! {:?}", e);
|
||||
log::error!("Failed to update user information! {e:?}");
|
||||
return Err(e);
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ fn verify_password<P: AsRef<[u8]>>(pwd: P, hash: &str) -> bool {
|
||||
match bcrypt::verify(pwd, hash) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
log::warn!("Failed to verify password! {:?}", e);
|
||||
log::warn!("Failed to verify password! {e:?}");
|
||||
false
|
||||
}
|
||||
}
|
||||
|
@ -108,15 +108,11 @@ impl WebAuthManager {
|
||||
) -> Res<WebauthnPubKey> {
|
||||
let state: RegisterKeyOpaqueData = self.crypto_wrapper.decrypt(opaque_state)?;
|
||||
if state.user_id != user.uid {
|
||||
return Err(Box::new(std::io::Error::other(
|
||||
"Invalid user for pubkey!",
|
||||
)));
|
||||
return Err(Box::new(std::io::Error::other("Invalid user for pubkey!")));
|
||||
}
|
||||
|
||||
if state.expire < time() {
|
||||
return Err(Box::new(std::io::Error::other(
|
||||
"Challenge has expired!",
|
||||
)));
|
||||
return Err(Box::new(std::io::Error::other("Challenge has expired!")));
|
||||
}
|
||||
|
||||
let res = self.core.finish_passkey_registration(
|
||||
@ -154,15 +150,11 @@ impl WebAuthManager {
|
||||
) -> Res {
|
||||
let state: AuthStateOpaqueData = self.crypto_wrapper.decrypt(opaque_state)?;
|
||||
if &state.user_id != user_id {
|
||||
return Err(Box::new(std::io::Error::other(
|
||||
"Invalid user for pubkey!",
|
||||
)));
|
||||
return Err(Box::new(std::io::Error::other("Invalid user for pubkey!")));
|
||||
}
|
||||
|
||||
if state.expire < time() {
|
||||
return Err(Box::new(std::io::Error::other(
|
||||
"Challenge has expired!",
|
||||
)));
|
||||
return Err(Box::new(std::io::Error::other("Challenge has expired!")));
|
||||
}
|
||||
|
||||
self.core.finish_passkey_authentication(
|
||||
|
Reference in New Issue
Block a user