mirror of
https://github.com/NLnetLabs/krill.git
synced 2026-09-26 03:14:53 +02:00
Clippy goodness.
This commit is contained in:
@@ -168,7 +168,7 @@ impl Authorizer {
|
||||
/// Submit credentials directly to the configured provider to establish a
|
||||
/// login session, if supported by the configured provider.
|
||||
pub fn login(&self, request: &hyper::Request<hyper::Body>) -> KrillResult<LoggedInUser> {
|
||||
self.primary_provider.login(request).and_then(|user| {
|
||||
self.primary_provider.login(request).map(|user| {
|
||||
let visible_attributes = user
|
||||
.attributes
|
||||
.clone()
|
||||
@@ -188,7 +188,7 @@ impl Authorizer {
|
||||
info!("User logged in: {}", &user.id);
|
||||
}
|
||||
|
||||
Ok(user)
|
||||
user
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
io,
|
||||
sync::RwLock,
|
||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
|
||||
@@ -92,7 +92,7 @@ impl AuthProvider for ConfigFileAuthProvider {
|
||||
Some(token) => {
|
||||
// see if we can decode, decrypt and deserialize the users token
|
||||
// into a login session structure
|
||||
let session = self.session_cache.decode(token.clone(), &self.key)?;
|
||||
let session = self.session_cache.decode(token, &self.key)?;
|
||||
|
||||
trace!("id={}, attributes={:?}", &session.id, &session.attributes);
|
||||
|
||||
@@ -113,11 +113,11 @@ impl AuthProvider for ConfigFileAuthProvider {
|
||||
if user.password_hash == password_hash {
|
||||
let api_token = self.session_cache.encode(&id, &user.attributes, &[], &self.key, None)?;
|
||||
|
||||
return Ok(LoggedInUser {
|
||||
Ok(LoggedInUser {
|
||||
token: api_token,
|
||||
id: id.to_string(),
|
||||
attributes: user.attributes.clone(),
|
||||
});
|
||||
})
|
||||
} else {
|
||||
Err(Error::ApiInvalidCredentials("Incorrect password".to_string()))
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ impl AuthProvider for OpenIDConnectAuthProvider {
|
||||
Some(token) => {
|
||||
// see if we can decode, decrypt and deserialize the users token
|
||||
// into a login session structure
|
||||
let session = self.session_cache.decode(token.clone(), &self.session_key)?;
|
||||
let session = self.session_cache.decode(token, &self.session_key)?;
|
||||
|
||||
let status = session.status();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user