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:
52
GPClient/portalauthenticator.h
Normal file
52
GPClient/portalauthenticator.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef PORTALAUTHENTICATOR_H
|
||||
#define PORTALAUTHENTICATOR_H
|
||||
|
||||
#include "portalconfigresponse.h"
|
||||
#include "normalloginwindow.h"
|
||||
#include "samlloginwindow.h"
|
||||
#include "preloginresponse.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class PortalAuthenticator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PortalAuthenticator(const QString& portal);
|
||||
~PortalAuthenticator();
|
||||
|
||||
void authenticate();
|
||||
|
||||
signals:
|
||||
void success(const PortalConfigResponse&, const GPGateway&);
|
||||
void fail(const QString& msg);
|
||||
void preloginFailed(const QString& msg);
|
||||
|
||||
private slots:
|
||||
void onPreloginFinished();
|
||||
void onPerformNormalLogin(const QString &username, const QString &password);
|
||||
void onLoginWindowRejected();
|
||||
void onSAMLLoginSuccess(const QMap<QString, QString> &samlResult);
|
||||
void onFetchConfigFinished();
|
||||
|
||||
private:
|
||||
QString portal;
|
||||
QString preloginUrl;
|
||||
QString configUrl;
|
||||
QString username;
|
||||
QString password;
|
||||
|
||||
PreloginResponse preloginResponse;
|
||||
|
||||
bool isAutoLogin { false };
|
||||
|
||||
NormalLoginWindow *normalLoginWindow{ nullptr };
|
||||
|
||||
void tryAutoLogin();
|
||||
void normalAuth();
|
||||
void samlAuth();
|
||||
void fetchConfig(QString username, QString password, QString preloginCookie = "");
|
||||
void emitFail(const QString& msg = "");
|
||||
};
|
||||
|
||||
#endif // PORTALAUTHENTICATOR_H
|
Reference in New Issue
Block a user