mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bdad3ffe4d | ||
|
cc59f031b0 | ||
|
d31598eac3 | ||
|
86dd501506 |
@@ -40,7 +40,7 @@ FORMS += \
|
||||
DBUS_INTERFACES += ../GPService/gpservice.xml
|
||||
|
||||
# Default rules for deployment.
|
||||
target.path = /usr/local/bin
|
||||
target.path = /usr/bin
|
||||
INSTALLS += target
|
||||
|
||||
DISTFILES += \
|
||||
|
@@ -4,7 +4,7 @@ Type=Application
|
||||
Version=1.0.0
|
||||
Name=GlobalProtect VPN
|
||||
Comment=GlobalProtect VPN client, supports SAML auth mode
|
||||
Exec=/usr/local/bin/gpclient
|
||||
Exec=/usr/bin/gpclient
|
||||
Icon=com.yuezk.qt.GPClient
|
||||
Categories=Network;VPN;Utility;Qt;
|
||||
Keywords=GlobalProtect;Openconnect;SAML;connection;VPN;
|
||||
|
@@ -80,13 +80,13 @@ void GPClient::preloginResultFinished()
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray bytes = reply->readAll();
|
||||
QByteArray xmlBytes = reply->readAll();
|
||||
const QString tagMethod = "saml-auth-method";
|
||||
const QString tagRequest = "saml-request";
|
||||
QString samlMethod;
|
||||
QString samlRequest;
|
||||
|
||||
QXmlStreamReader xml(bytes);
|
||||
QXmlStreamReader xml(xmlBytes);
|
||||
while (!xml.atEnd()) {
|
||||
xml.readNext();
|
||||
if (xml.tokenType() == xml.StartElement) {
|
||||
@@ -105,11 +105,7 @@ void GPClient::preloginResultFinished()
|
||||
}
|
||||
|
||||
if (samlMethod == "POST") {
|
||||
// TODO
|
||||
emit connectFailed();
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("TODO: SAML method is POST");
|
||||
msgBox.exec();
|
||||
samlLogin(reply->url().toString(), samlRequest);
|
||||
} else if (samlMethod == "REDIRECT") {
|
||||
samlLogin(samlRequest);
|
||||
}
|
||||
@@ -214,14 +210,14 @@ void GPClient::doAuth(const QString portal)
|
||||
connect(reply, &QNetworkReply::finished, this, &GPClient::preloginResultFinished);
|
||||
}
|
||||
|
||||
void GPClient::samlLogin(const QString loginUrl)
|
||||
void GPClient::samlLogin(const QString loginUrl, const QString html)
|
||||
{
|
||||
SAMLLoginWindow *loginWindow = new SAMLLoginWindow(this);
|
||||
|
||||
QObject::connect(loginWindow, &SAMLLoginWindow::success, this, &GPClient::onLoginSuccess);
|
||||
QObject::connect(loginWindow, &SAMLLoginWindow::rejected, this, &GPClient::connectFailed);
|
||||
|
||||
loginWindow->login(loginUrl);
|
||||
loginWindow->login(loginUrl, html);
|
||||
loginWindow->exec();
|
||||
delete loginWindow;
|
||||
}
|
||||
|
@@ -42,6 +42,6 @@ private:
|
||||
void moveCenter();
|
||||
void updateConnectionStatus(QString status);
|
||||
void doAuth(const QString portal);
|
||||
void samlLogin(const QString loginUrl);
|
||||
void samlLogin(const QString loginUrl, const QString html = "");
|
||||
};
|
||||
#endif // GPCLIENT_H
|
||||
|
@@ -27,9 +27,13 @@ void SAMLLoginWindow::closeEvent(QCloseEvent *event)
|
||||
reject();
|
||||
}
|
||||
|
||||
void SAMLLoginWindow::login(QString url)
|
||||
void SAMLLoginWindow::login(QString url, QString html)
|
||||
{
|
||||
webView->load(QUrl(url));
|
||||
if (html == "") {
|
||||
webView->load(QUrl(url));
|
||||
} else {
|
||||
webView->setHtml(html, url);
|
||||
}
|
||||
}
|
||||
|
||||
void SAMLLoginWindow::onResponseReceived(QJsonObject params)
|
||||
|
@@ -15,7 +15,7 @@ public:
|
||||
explicit SAMLLoginWindow(QWidget *parent = nullptr);
|
||||
~SAMLLoginWindow();
|
||||
|
||||
void login(QString url);
|
||||
void login(QString url, QString html = "");
|
||||
|
||||
signals:
|
||||
void success(QJsonObject samlResult);
|
||||
|
@@ -32,7 +32,7 @@ SOURCES += \
|
||||
DBUS_ADAPTORS += gpservice.xml
|
||||
|
||||
# Default rules for deployment.
|
||||
target.path = /usr/local/bin
|
||||
target.path = /usr/bin
|
||||
INSTALLS += target
|
||||
|
||||
DISTFILES += \
|
||||
|
@@ -1,5 +1,5 @@
|
||||
[D-BUS Service]
|
||||
Name=com.yuezk.qt.GPService
|
||||
Exec=/usr/local/bin/gpservice
|
||||
Exec=/usr/bin/gpservice
|
||||
User=root
|
||||
SystemdService=gpservice.service
|
||||
|
@@ -4,7 +4,7 @@ Description=GlobalProtect openconnect DBus service
|
||||
[Service]
|
||||
Type=dbus
|
||||
BusName=com.yuezk.qt.GPService
|
||||
ExecStart=/usr/local/bin/gpservice
|
||||
ExecStart=/usr/bin/gpservice
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
@@ -19,10 +19,16 @@ A GlobalProtect VPN client (GUI) for Linux based on Openconnect and built with Q
|
||||
```
|
||||
## Install
|
||||
|
||||
### Install from AUR (Arch/Manjaro)
|
||||
|
||||
Install [globalprotect-openconnect](https://aur.archlinux.org/packages/globalprotect-openconnect/).
|
||||
|
||||
### Build from source code
|
||||
|
||||
```sh
|
||||
git clone https://github.com/yuezk/GlobalProtect-openconnect.git
|
||||
cd GlobalProtect-openconnect
|
||||
git submodule init && git submodule update
|
||||
git submodule update --init
|
||||
qmake CONFIG+=release
|
||||
make
|
||||
sudo make install
|
||||
|
Reference in New Issue
Block a user