Compare commits

..

4 Commits

Author SHA1 Message Date
Kevin Yue
edc13ed14d Merge pull request #265 from fftmp/master
fix link in Readme
2023-11-13 18:04:46 +08:00
fftmp
dd737bc8c5 fix link in Readme 2023-11-10 22:58:40 +04:00
Kevin Yue
939f2bd94a Merge pull request #263 from iamtalhaasghar/master
chores: update opensuse leap repo link
2023-11-06 09:31:14 +08:00
Talha Asghar
abffa21268 chores: update opensuse leap repo link
The old link is broken!
2023-11-04 09:55:26 +05:00
6 changed files with 8 additions and 39 deletions

View File

@@ -96,7 +96,6 @@ target_link_libraries(gpclient
Qt5::DBus
QtSignals
${QTKEYCHAIN_LIBRARIES}
inih
)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0 AND CMAKE_BUILD_TYPE STREQUAL Release)

View File

@@ -151,7 +151,7 @@ void GatewayAuthenticator::samlAuth(QString samlMethod, QString samlRequest, QSt
{
LOGI << "Trying to perform SAML login with saml-method " << samlMethod;
auto *loginWindow = new SAMLLoginWindow(gateway);
auto *loginWindow = new SAMLLoginWindow;
connect(loginWindow, &SAMLLoginWindow::success, [this, loginWindow](const QMap<QString, QString> &samlResult) {
this->onSAMLLoginSuccess(samlResult);

View File

@@ -118,7 +118,7 @@ void PortalAuthenticator::samlAuth()
{
LOGI << "Trying to perform SAML login with saml-method " << preloginResponse.samlMethod();
auto *loginWindow = new SAMLLoginWindow(this->portal);
auto *loginWindow = new SAMLLoginWindow;
connect(loginWindow, &SAMLLoginWindow::success, [this, loginWindow](const QMap<QString, QString> samlResult) {
this->onSAMLLoginSuccess(samlResult);

View File

@@ -4,10 +4,9 @@
#include <QWebEngineCookieStore>
#include <plog/Log.h>
#include "INIReader.h"
#include "samlloginwindow.h"
SAMLLoginWindow::SAMLLoginWindow(QString portal, QWidget *parent)
SAMLLoginWindow::SAMLLoginWindow(QWidget *parent)
: QDialog(parent)
, webView(new EnhancedWebView(this))
{
@@ -24,9 +23,6 @@ SAMLLoginWindow::SAMLLoginWindow(QString portal, QWidget *parent)
connect(webView, &EnhancedWebView::responseReceived, this, &SAMLLoginWindow::onResponseReceived);
connect(webView, &EnhancedWebView::loadFinished, this, &SAMLLoginWindow::onLoadFinished);
// Portal
this->portal = portal;
// Show the login window automatically when exceeds the MAX_WAIT_TIME
QTimer::singleShot(MAX_WAIT_TIME, this, [this]() {
if (failed) {
@@ -112,9 +108,6 @@ void SAMLLoginWindow::onLoadFinished()
{
LOGI << "Load finished " << webView->page()->url().toString();
webView->page()->toHtml([this] (const QString &html) { this->handleHtml(html); });
QMap<QString, QString> credentials = this->loadCredentials();
webView->page()->runJavaScript("document.getElementById('username').value='" + credentials["username"] + "';");
webView->page()->runJavaScript("document.getElementById('password').value='" + credentials["password"] + "';");
}
void SAMLLoginWindow::handleHtml(const QString &html)
@@ -141,25 +134,3 @@ QString SAMLLoginWindow::parseTag(const QString &tag, const QString &html) {
const QRegularExpression expression(QString("<%1>(.*)</%1>").arg(tag));
return expression.match(html).captured(1);
}
QMap<QString, QString> SAMLLoginWindow::loadCredentials()
{
std::string home = getenv("HOME");
std::string iniFile = home + "/.gpclient-credentials";
INIReader reader(iniFile);
QMap<QString, QString> credentials;
if (reader.ParseError() < 0) {
LOGE << "File '" << iniFile << "' not found.";
return credentials;
}
if (reader.HasSection(this->portal.toStdString())) {
credentials.insert(QString("username"), QString::fromStdString(reader.Get(this->portal.toStdString(), "username", "")));
credentials.insert(QString("password"), QString::fromStdString(reader.Get(this->portal.toStdString(), "password", "")));
} else {
LOGE << "No credentials found for '" << this->portal.toStdString() << "' in '" << iniFile << "'";
}
return credentials;
}

View File

@@ -12,10 +12,9 @@ class SAMLLoginWindow : public QDialog
Q_OBJECT
public:
explicit SAMLLoginWindow(QString portal, QWidget *parent = nullptr);
explicit SAMLLoginWindow(QWidget *parent = nullptr);
void login(const QString samlMethod, const QString samlRequest, const QString preloginUrl);
QMap<QString, QString> loadCredentials();
signals:
void success(QMap<QString, QString> samlResult);
@@ -32,7 +31,6 @@ private:
bool failed { false };
EnhancedWebView *webView { nullptr };
QMap<QString, QString> samlResult;
QString portal;
void closeEvent(QCloseEvent *event);
void handleHtml(const QString &html);

View File

@@ -23,7 +23,7 @@ A GlobalProtect VPN client (GUI) for Linux based on Openconnect and built with Q
|OS|Stable version | Development version|
|---|--------------|--------------------|
|Linux Mint, Ubuntu 18.04 or later|[ppa:yuezk/globalprotect-openconnect](https://launchpad.net/~yuezk/+archive/ubuntu/globalprotect-openconnect)|[ppa:yuezk/globalprotect-openconnect-snapshot](https://launchpad.net/~yuezk/+archive/ubuntu/globalprotect-openconnect-snapshot)|
|Arch, Manjaro|[globalprotect-openconnect](https://archlinux.org/packages/community/x86_64/globalprotect-openconnect/)|[AUR: globalprotect-openconnect-git](https://aur.archlinux.org/packages/globalprotect-openconnect-git/)|
|Arch, Manjaro|[globalprotect-openconnect](https://archlinux.org/packages/extra/x86_64/globalprotect-openconnect/)|[AUR: globalprotect-openconnect-git](https://aur.archlinux.org/packages/globalprotect-openconnect-git/)|
|Fedora|[copr: yuezk/globalprotect-openconnect](https://copr.fedorainfracloud.org/coprs/yuezk/globalprotect-openconnect/)|[copr: yuezk/globalprotect-openconnect](https://copr.fedorainfracloud.org/coprs/yuezk/globalprotect-openconnect/)|
|openSUSE, CentOS 8|[OBS: globalprotect-openconnect](https://build.opensuse.org/package/show/home:yuezk/globalprotect-openconnect)|[OBS: globalprotect-openconnect-snapshot](https://build.opensuse.org/package/show/home:yuezk/globalprotect-openconnect-snapshot)|
@@ -77,8 +77,9 @@ sudo dnf install globalprotect-openconnect
- openSUSE Leap
```sh
sudo zypper ar https://download.opensuse.org/repositories/home:/yuezk/openSUSE_Leap_15.2/home:yuezk.repo
```sh
sudo zypper ar https://download.opensuse.org/repositories/home:/yuezk/15.4/home:yuezk.repo
sudo zypper ref
sudo zypper install globalprotect-openconnect
```