Cavoke  1.1.0
A Platform for creating and hosting multiplayer turn-based board games
Loading...
Searching...
No Matches
AuthenticationManager.h
1#ifndef CAVOKE_AUTHENTICATIONMANAGER_H
2#define CAVOKE_AUTHENTICATIONMANAGER_H
3
4#include <QOAuth2AuthorizationCodeFlow>
5#include <QSettings>
6
7namespace cavoke::auth {
10struct AuthenticationManager : public QObject {
11 Q_OBJECT
12public:
13 AuthenticationManager() = default;
14 QOAuth2AuthorizationCodeFlow oauth2;
17 static AuthenticationManager obj;
18 return obj;
19 }
20 bool checkAuthStatus();
21 void init();
22 void relogin();
23signals:
24 void authenticated();
25
26private:
27 void writeSecurePassword(const QString &profile, const QString &pass);
28 template <typename L>
29 void readSecurePassword(const QString &profile, L callback);
30 void deleteSecurePassword(const QString &profile);
31
32 QSettings settings{this}; // FIXME: move to qtkeychain
33
34 const static QString authorizationUrl;
35 const static QString accessTokenUrl;
36 const static QString logoutUrl;
37 const static QString clientId;
38 const static QString scope;
39 const static QString audience;
40
41 const static QString refresh_token_profile;
42};
43} // namespace cavoke::auth
44
45#endif // CAVOKE_AUTHENTICATIONMANAGER_H
static AuthenticationManager & getInstance()
Singleton wrapper.