75 lines
2.9 KiB
Diff
75 lines
2.9 KiB
Diff
From f32c0200d2bc9c537b45b37e9b4d246fd330f362 Mon Sep 17 00:00:00 2001
|
|
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
|
Date: Fri, 2 Jun 2023 15:03:46 +0800
|
|
Subject: [PATCH 7/9] fix(multi-factor): Multifactor authentication, handling
|
|
only password authentication
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
- 多因子认证,处理只有密码认证的情况
|
|
---
|
|
src/daemon/session.cpp | 17 +++++++++++------
|
|
1 file changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/src/daemon/session.cpp b/src/daemon/session.cpp
|
|
index e8c516b..291f9fc 100644
|
|
--- a/src/daemon/session.cpp
|
|
+++ b/src/daemon/session.cpp
|
|
@@ -132,7 +132,7 @@ void Session::StartAuth()
|
|
this->m_verifyInfo.m_inAuth = true;
|
|
this->m_verifyInfo.m_dbusMessage = this->message();
|
|
this->startPhaseAuth();
|
|
-}
|
|
+}
|
|
|
|
void Session::StopAuth()
|
|
{
|
|
@@ -230,7 +230,7 @@ void Session::onIdentifyStatus(const QString &bid, int result, const QString &me
|
|
{
|
|
Q_EMIT this->AuthMessage(verifyResultStr, KADMessageType::KAD_MESSAGE_TYPE_INFO);
|
|
}
|
|
- else if(result == IdentifyStatus::IDENTIFY_STATUS_NOT_MATCH)
|
|
+ else if (result == IdentifyStatus::IDENTIFY_STATUS_NOT_MATCH)
|
|
{
|
|
Q_EMIT this->AuthMessage(verifyResultStr, KADMessageType::KAD_MESSAGE_TYPE_ERROR);
|
|
}
|
|
@@ -283,9 +283,14 @@ void Session::startUkeyAuth()
|
|
void Session::startPasswdAuth()
|
|
{
|
|
KLOG_DEBUG() << "The authentication service does not take over password authentication,ignore!";
|
|
+
|
|
this->m_verifyInfo.m_inAuth = true;
|
|
- this->m_verifyInfo.m_authenticatedUserName = m_userName;
|
|
- this->finishPhaseAuth(true,false);
|
|
+ if (this->m_verifyInfo.m_authenticatedUserName.isEmpty())
|
|
+ {
|
|
+ this->m_verifyInfo.m_authenticatedUserName = m_userName;
|
|
+ }
|
|
+
|
|
+ this->finishPhaseAuth(true, false);
|
|
}
|
|
|
|
void Session::startGeneralAuth(const QString &extraInfo)
|
|
@@ -305,7 +310,7 @@ void Session::startGeneralAuth(const QString &extraInfo)
|
|
{
|
|
auto authTypeStr = Utils::authTypeEnum2Str(this->m_authType);
|
|
KLOG_WARNING() << m_sessionID << "start phase auth failed,can not find device,auth type:" << m_authType;
|
|
- Q_EMIT this->AuthMessage(QString(tr("can not find %1 device")).arg(Utils::authTypeEnum2LocaleStr(this->m_authType)),KADMessageType::KAD_MESSAGE_TYPE_ERROR);
|
|
+ Q_EMIT this->AuthMessage(QString(tr("can not find %1 device")).arg(Utils::authTypeEnum2LocaleStr(this->m_authType)), KADMessageType::KAD_MESSAGE_TYPE_ERROR);
|
|
|
|
this->finishPhaseAuth(false, false);
|
|
return;
|
|
@@ -359,7 +364,7 @@ void Session::finishPhaseAuth(bool isSuccess, bool recordFailure)
|
|
break;
|
|
case KADAuthMode::KAD_AUTH_MODE_AND:
|
|
{
|
|
- if( this->m_authOrderWaiting.size() > 0 )
|
|
+ if (this->m_authOrderWaiting.size() > 0)
|
|
{
|
|
this->m_authOrderWaiting.removeOne(this->m_authType);
|
|
}
|
|
--
|
|
2.33.0
|
|
|