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:
44
GPClient/gatewayauthenticator.h
Normal file
44
GPClient/gatewayauthenticator.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#ifndef GATEWAYAUTHENTICATOR_H
|
||||
#define GATEWAYAUTHENTICATOR_H
|
||||
|
||||
#include "portalconfigresponse.h"
|
||||
#include "normalloginwindow.h"
|
||||
#include "loginparams.h"
|
||||
#include <QObject>
|
||||
|
||||
class GatewayAuthenticator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GatewayAuthenticator(const QString& gateway, const PortalConfigResponse& portalConfig);
|
||||
~GatewayAuthenticator();
|
||||
|
||||
void authenticate();
|
||||
|
||||
signals:
|
||||
void success(const QString& authCookie);
|
||||
void fail(const QString& msg = "");
|
||||
|
||||
private slots:
|
||||
void onLoginFinished();
|
||||
void onPreloginFinished();
|
||||
void onPerformNormalLogin(const QString &username, const QString &password);
|
||||
void onSAMLLoginFinished(const QMap<QString, QString> &samlResult);
|
||||
void onLoginWindowRejected();
|
||||
|
||||
private:
|
||||
QString gateway;
|
||||
QString preloginUrl;
|
||||
QString loginUrl;
|
||||
|
||||
const PortalConfigResponse& portalConfig;
|
||||
|
||||
NormalLoginWindow *normalLoginWindow{nullptr};
|
||||
|
||||
void login(const LoginParams& params);
|
||||
void doAuth();
|
||||
void normalAuth(QString labelUsername, QString labelPassword, QString authMessage);
|
||||
void samlAuth(QString samlMethod, QString samlRequest, QString preloginUrl = "");
|
||||
};
|
||||
|
||||
#endif // GATEWAYAUTHENTICATOR_H
|
Reference in New Issue
Block a user