fn auth_publickey(mut self, _username: &str, key: &key::PublicKey) -> Self::FutureAuth {
        let span = self.span.clone();
        let public_key = key.public_key_bytes();

        Box::pin(
            async move {
                let (ssh_key, user) =
                    match chartered_db::users::User::find_by_ssh_key(self.db.clone(), public_key)
                        .await?
                    {
                        Some(user) => user,
                        None => return self.finished_auth(server::Auth::Reject).await,
                    };
                let ssh_key = Arc::new(ssh_key);

                if let Err(e) = ssh_key.clone().update_last_used(self.db.clone()).await {
                    warn!("Failed to update last used key: {:?}", e);
                }

                let auth_key = ssh_key
                    .clone()
                    .get_or_insert_session(self.db.clone(), self.ip.map(|v| v.to_string()))
                    .await?
                    .session_key;

                self.authed = Some(Authed { user, auth_key });

                self.finished_auth(server::Auth::Accept).await
            }
            .instrument(tracing::info_span!(parent: span, "auth pubkey")),
        )
    }
/// User is attempting to connect via pubkey, we'll lookup the key in the
/// user database and create a new session if it exists, otherwise we'll
/// reject the authentication attempt.
User is attempting to connect via pubkey, we'll lookup the key in the
user database and create a new session if it exists, otherwise we'll
reject the authentication attempt.
User is attempting to connect via pubkey we ' ll lookup the key in the user database and create a new session if it exists otherwise we ' ll reject the authentication attempt .
fn auth_publickey(mut self, _username: &str, key: &key::PublicKey) -> Self::FutureAuth {
        let span = self.span.clone();
        let public_key = key.public_key_bytes();
        Box::pin(
            async move {
                let (ssh_key, user) =
                    match chartered_db::users::User::find_by_ssh_key(self.db.clone(), public_key)
                        .await?
                    {
                        Some(user) => user,
                        None => return self.finished_auth(server::Auth::Reject).await,
                    };
                let ssh_key = Arc::new(ssh_key);
                if let Err(e) = ssh_key.clone().update_last_used(self.db.clone()).await {
                    warn!("Failed to update last used key: {:?}", e);
                }
                let auth_key = ssh_key
                    .clone()
                    .get_or_insert_session(self.db.clone(), self.ip.map(|v| v.to_string()))
                    .await?
                    .session_key;
                self.authed = Some(Authed { user, auth_key });
                self.finished_auth(server::Auth::Accept).await
            }
            .instrument(tracing::info_span!(parent: span, "auth pubkey")),
        )
    }
fn auth_publickey ( mut self , _username : & str , key : & key :: PublicKey ) -> Self :: FutureAuth { let span = self . span . clone ( ) ; let public_key = key . public_key_bytes ( ) ; Box :: pin ( async move { let ( ssh_key , user ) = match chartered_db :: users :: User :: find_by_ssh_key ( self . db . clone ( ) , public_key ) . await ? { Some ( user ) => user , None => return self . finished_auth ( server :: Auth :: Reject ) . await , } ; let ssh_key = Arc :: new ( ssh_key ) ; if let Err ( e ) = ssh_key . clone ( ) . update_last_used ( self . db . clone ( ) ) . await { warn ! ( " " e ) ; } let auth_key = ssh_key . clone ( ) . get_or_insert_session ( self . db . clone ( ) , self . ip . map ( | v | v . to_string ( ) ) ) . await ? . session_key ; self . authed = Some ( Authed { user , auth_key } ) ; self . finished_auth ( server :: Auth :: Accept ) . await } . instrument ( tracing :: info_span ! ( parent span " " ) ) , ) }
User is attempting to connect via pubkey, we'll lookup the key in the
user database and create a new session if it exists, otherwise we'll
reject the authentication attempt.
User is attempting to connect via pubkey we ' ll lookup the key in the user database and create a new session if it exists otherwise we ' ll reject the authentication attempt .
mut self
_username
&str
key
&key::PublicKey
mut self
_username
&str
key
&key::PublicKey