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/Log.h>
|
||||||
#include <plog/Appenders/ColorConsoleAppender.h>
|
#include <plog/Appenders/ColorConsoleAppender.h>
|
||||||
|
|
||||||
|
static const QString version = "v1.2.2";
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
const QDir path = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/GlobalProtect-openconnect";
|
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;
|
static plog::ColorConsoleAppender<plog::TxtFormatter> consoleAppender;
|
||||||
plog::init(plog::debug, logFile.toUtf8()).addAppender(&consoleAppender);
|
plog::init(plog::debug, logFile.toUtf8()).addAppender(&consoleAppender);
|
||||||
|
|
||||||
|
PLOGI << "GlobalProtect started, version: " << version;
|
||||||
|
|
||||||
QString port = QString::fromLocal8Bit(qgetenv(ENV_CDP_PORT));
|
QString port = QString::fromLocal8Bit(qgetenv(ENV_CDP_PORT));
|
||||||
|
|
||||||
if (port == "") {
|
if (port == "") {
|
||||||
|
@ -61,29 +61,39 @@ void SAMLLoginWindow::onResponseReceived(QJsonObject params)
|
|||||||
const QString preloginCookie = headers.value("prelogin-cookie").toString();
|
const QString preloginCookie = headers.value("prelogin-cookie").toString();
|
||||||
const QString userAuthCookie = headers.value("portal-userauthcookie").toString();
|
const QString userAuthCookie = headers.value("portal-userauthcookie").toString();
|
||||||
|
|
||||||
|
LOGI << "Response received from " << response.value("url").toString();
|
||||||
|
|
||||||
if (!username.isEmpty()) {
|
if (!username.isEmpty()) {
|
||||||
|
LOGI << "Got username from SAML response headers " << username;
|
||||||
samlResult.insert("username", username);
|
samlResult.insert("username", username);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preloginCookie.isEmpty()) {
|
if (!preloginCookie.isEmpty()) {
|
||||||
|
LOGI << "Got prelogin-cookie from SAML response headers " << preloginCookie;
|
||||||
samlResult.insert("preloginCookie", preloginCookie);
|
samlResult.insert("preloginCookie", preloginCookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!userAuthCookie.isEmpty()) {
|
if (!userAuthCookie.isEmpty()) {
|
||||||
|
LOGI << "Got portal-userauthcookie from SAML response headers " << userAuthCookie;
|
||||||
samlResult.insert("userAuthCookie", userAuthCookie);
|
samlResult.insert("userAuthCookie", userAuthCookie);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void SAMLLoginWindow::onLoadFinished()
|
|
||||||
{
|
|
||||||
LOGI << "Load finished " << this->webView->page()->url().toString();
|
|
||||||
|
|
||||||
// Check the SAML result
|
// Check the SAML result
|
||||||
if (samlResult.contains("username")
|
if (samlResult.contains("username")
|
||||||
&& (samlResult.contains("preloginCookie") || samlResult.contains("userAuthCookie"))) {
|
&& (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);
|
emit success(samlResult);
|
||||||
accept();
|
accept();
|
||||||
} else {
|
} else {
|
||||||
this->show();
|
this->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SAMLLoginWindow::onLoadFinished()
|
||||||
|
{
|
||||||
|
LOGI << "Load finished " << this->webView->page()->url().toString();
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user