mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Code refactor, support multiple gateways and non-SAML authentication (#9)
* Code refactor * Update README.md
This commit is contained in:
@@ -2,9 +2,11 @@
|
||||
#define GPCLIENT_H
|
||||
|
||||
#include "gpservice_interface.h"
|
||||
#include "portalconfigresponse.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QMenu>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class GPClient; }
|
||||
@@ -17,31 +19,53 @@ class GPClient : public QMainWindow
|
||||
public:
|
||||
GPClient(QWidget *parent = nullptr);
|
||||
~GPClient();
|
||||
|
||||
signals:
|
||||
void connectFailed();
|
||||
void activiate();
|
||||
|
||||
private slots:
|
||||
void on_connectButton_clicked();
|
||||
void preloginResultFinished();
|
||||
void on_portalInput_returnPressed();
|
||||
|
||||
void onLoginSuccess(QJsonObject loginResult);
|
||||
void onPortalSuccess(const PortalConfigResponse &portalConfig, const GPGateway &gateway);
|
||||
void onPortalPreloginFail();
|
||||
void onPortalFail(const QString &msg);
|
||||
void onGatewaySuccess(const QString &authCookie);
|
||||
void onGatewayFail(const QString &msg);
|
||||
|
||||
void onVPNConnected();
|
||||
void onVPNDisconnected();
|
||||
void onVPNLogAvailable(QString log);
|
||||
|
||||
void onSystemTrayActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
|
||||
private:
|
||||
enum class VpnStatus
|
||||
{
|
||||
disconnected,
|
||||
pending,
|
||||
connected
|
||||
};
|
||||
|
||||
Ui::GPClient *ui;
|
||||
QNetworkAccessManager *networkManager;
|
||||
QNetworkReply *reply;
|
||||
com::yuezk::qt::GPService *vpn;
|
||||
QSettings *settings;
|
||||
|
||||
QSystemTrayIcon *systemTrayIcon;
|
||||
QMenu *contextMenu;
|
||||
QAction *openAction;
|
||||
QAction *connectAction;
|
||||
QAction *quitAction;
|
||||
|
||||
GPGateway gateway;
|
||||
PortalConfigResponse portalConfig;
|
||||
|
||||
QString portal() const;
|
||||
|
||||
void initVpnStatus();
|
||||
void moveCenter();
|
||||
void updateConnectionStatus(QString status);
|
||||
void doAuth(const QString portal);
|
||||
void samlLogin(const QString loginUrl, const QString html = "");
|
||||
void doConnect();
|
||||
void updateConnectionStatus(const VpnStatus &status);
|
||||
|
||||
void portalLogin(const QString& portal);
|
||||
void gatewayLogin() const;
|
||||
|
||||
void quit();
|
||||
};
|
||||
#endif // GPCLIENT_H
|
||||
|
Reference in New Issue
Block a user