mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
Try to fix saml hang (#14)
* Try to fix saml login hang * Add more logs * Add version number
This commit is contained in:
parent
86ad51b0ad
commit
e12613d9a4
@ -6,6 +6,8 @@
|
||||
#include <plog/Log.h>
|
||||
#include <plog/Appenders/ColorConsoleAppender.h>
|
||||
|
||||
static const QString version = "v1.2.2";
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const QDir path = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/GlobalProtect-openconnect";
|
||||
@ -17,6 +19,8 @@ int main(int argc, char *argv[])
|
||||
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
|
||||
plog::init(plog::debug, logFile.toUtf8()).addAppender(&consoleAppender);
|
||||
|
||||
PLOGI << "GlobalProtect started, version: " << version;
|
||||
|
||||
QString port = QString::fromLocal8Bit(qgetenv(ENV_CDP_PORT));
|
||||
|
||||
if (port == "") {
|
||||
|
@ -61,29 +61,39 @@ void SAMLLoginWindow::onResponseReceived(QJsonObject params)
|
||||
const QString preloginCookie = headers.value("prelogin-cookie").toString();
|
||||
const QString userAuthCookie = headers.value("portal-userauthcookie").toString();
|
||||
|
||||
LOGI << "Response received from " << response.value("url").toString();
|
||||
|
||||
if (!username.isEmpty()) {
|
||||
LOGI << "Got username from SAML response headers " << username;
|
||||
samlResult.insert("username", username);
|
||||
}
|
||||
|
||||
if (!preloginCookie.isEmpty()) {
|
||||
LOGI << "Got prelogin-cookie from SAML response headers " << preloginCookie;
|
||||
samlResult.insert("preloginCookie", preloginCookie);
|
||||
}
|
||||
|
||||
if (!userAuthCookie.isEmpty()) {
|
||||
LOGI << "Got portal-userauthcookie from SAML response headers " << userAuthCookie;
|
||||
samlResult.insert("userAuthCookie", userAuthCookie);
|
||||
}
|
||||
}
|
||||
|
||||
void SAMLLoginWindow::onLoadFinished()
|
||||
{
|
||||
LOGI << "Load finished " << this->webView->page()->url().toString();
|
||||
|
||||
// Check the SAML result
|
||||
if (samlResult.contains("username")
|
||||
&& (samlResult.contains("preloginCookie") || samlResult.contains("userAuthCookie"))) {
|
||||
LOGI << "Got the SAML authentication information successfully. "
|
||||
<< "username: " << samlResult.value("username")
|
||||
<< ", preloginCookie: " << samlResult.value("preloginCookie")
|
||||
<< ", userAuthCookie: " << samlResult.value("userAuthCookie");
|
||||
|
||||
emit success(samlResult);
|
||||
accept();
|
||||
} else {
|
||||
this->show();
|
||||
}
|
||||
}
|
||||
|
||||
void SAMLLoginWindow::onLoadFinished()
|
||||
{
|
||||
LOGI << "Load finished " << this->webView->page()->url().toString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user