Debian Codegraph @

src/librssguard/network-web/oauth2service.h

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.cxx . . $ `<file>/src/librssguard/network-web/oauth2service.h`/
2
3 ////////////////////////////////////////////////////////////////////////////////
4
5 // //
6 // This file is part of QOAuth2. //
7 // Copyright (c) 2014 Jacob Dawid <[email protected]> //
8 // //
9 // QOAuth2 is free software: you can redistribute it and/or modify //
10 // it under the terms of the GNU Affero General Public License as //
11 // published by the Free Software Foundation, either version 3 of the //
12 // License, or (at your option) any later version. //
13 // //
14 // QOAuth2 is distributed in the hope that it will be useful, //
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
17 // GNU Affero General Public License for more details. //
18 // //
19 // You should have received a copy of the GNU Affero General Public //
20 // License along with QOAuth2. //
21 // If not, see <http://www.gnu.org/licenses/>. //
22 // //
23 ////////////////////////////////////////////////////////////////////////////////
24
25 #ifndef OAUTH2SERVICE_H
26 #define OAUTH2SERVICE_Hcxx . . $ `src/librssguard/network-web/oauth2service.h:26:9`!
27
28 #include "network-web/oauthhttphandler.h"cxx . . $ `<file>/src/librssguard/network-web/oauthhttphandler.h`/
29 #include "network-web/silentnetworkaccessmanager.h"cxx . . $ `<file>/src/librssguard/network-web/silentnetworkaccessmanager.h`/
30
31 #include <functional>
32
33 #include <QObject>
34 #include <QUrl>
35
36 class RSSGUARD_DLLSPECcxx . . $ `<built-in>:525:9`! OAuth2Servicecxx . . $ OAuth2Service# : public QObjectcxx . . $ QObject# {
37 Q_OBJECTcxx . . $ OAuth2Service#QPrivateSignal#QPrivateSignal(49f6e7a06ebc5aa8).
38
39 public:
40 explicit OAuth2Servicecxx . . $ OAuth2Service#OAuth2Service(1fb840df4dfd8c1).(const QStringcxx . . $ QString#& auth_url,
41 const QStringcxx . . $ QString#& token_url,
42 const QStringcxx . . $ QString#& client_id,
43 const QStringcxx . . $ QString#& client_secret,
44 const QStringcxx . . $ QString#& scope,
45 QObjectcxx . . $ QObject#* parent = nullptr);
46 virtual ~cxx . . $ OAuth2Service#`~OAuth2Service`(ced63f7c635d850d).OAuth2Servicecxx . . $ OAuth2Service#();
47
48 // Returns bearer HTTP header value.
49 // NOTE: If on working thread, then call this only if isFullyLoggedIn()
50 // returns true. If isFullyLoggedIn() returns false, then you must call login() on
51 // main GUI thread first.
52 QStringcxx . . $ QString# bearercxx . . $ OAuth2Service#bearer(4365c3963150523e).();
53 bool isFullyLoggedIncxx . . $ OAuth2Service#isFullyLoggedIn(50ce9a9e25b4a850).() const;
54
55 void setOAuthTokenGrantTypecxx . . $ OAuth2Service#setOAuthTokenGrantType(7df51288a9ebd664).(QStringcxx . . $ QString# grant_type);
56 QStringcxx . . $ QString# oAuthTokenGrantTypecxx . . $ OAuth2Service#oAuthTokenGrantType(4365c3963150523e).();
57
58 QStringcxx . . $ QString# refreshTokencxx . . $ OAuth2Service#refreshToken(6ef7b6c27b00b43d).() const;
59 void setRefreshTokencxx . . $ OAuth2Service#setRefreshToken(3520e46b33348bf6).(const QStringcxx . . $ QString#& refresh_token);
60
61 QStringcxx . . $ QString# redirectUrlcxx . . $ OAuth2Service#redirectUrl(6ef7b6c27b00b43d).() const;
62 void setRedirectUrlcxx . . $ OAuth2Service#setRedirectUrl(37c160c81b6367f7).(const QStringcxx . . $ QString#& redirect_url, bool start_handler);
63
64 QStringcxx . . $ QString# clientIdcxx . . $ OAuth2Service#clientId(6ef7b6c27b00b43d).() const;
65 void setClientIdcxx . . $ OAuth2Service#setClientId(3520e46b33348bf6).(const QStringcxx . . $ QString#& client_id);
66
67 QStringcxx . . $ QString# clientSecretcxx . . $ OAuth2Service#clientSecret(6ef7b6c27b00b43d).() const;
68 void setClientSecretcxx . . $ OAuth2Service#setClientSecret(3520e46b33348bf6).(const QStringcxx . . $ QString#& client_secret);
69
70 QDateTimecxx . . $ QDateTime# tokensExpireIncxx . . $ OAuth2Service#tokensExpireIn(4e062b5c490497ac).() const;
71 void setTokensExpireIncxx . . $ OAuth2Service#setTokensExpireIn(3672ecc950120406).(const QDateTimecxx . . $ QDateTime#& tokens_expire_in);
72
73 QStringcxx . . $ QString# accessTokencxx . . $ OAuth2Service#accessToken(6ef7b6c27b00b43d).() const;
74 void setAccessTokencxx . . $ OAuth2Service#setAccessToken(3520e46b33348bf6).(const QStringcxx . . $ QString#& access_token);
75
76 QStringcxx . . $ QString# idcxx . . $ OAuth2Service#id(6ef7b6c27b00b43d).() const;
77 void setIdcxx . . $ OAuth2Service#setId(3520e46b33348bf6).(const QStringcxx . . $ QString#& id);
78
79 // Super secret fallback client ID/SECRET.
80 QStringcxx . . $ QString# clientSecretIdcxx . . $ OAuth2Service#clientSecretId(6ef7b6c27b00b43d).() const;
81 void setClientSecretIdcxx . . $ OAuth2Service#setClientSecretId(3520e46b33348bf6).(const QStringcxx . . $ QString#& client_secret_id);
82
83 QStringcxx . . $ QString# clientSecretSecretcxx . . $ OAuth2Service#clientSecretSecret(6ef7b6c27b00b43d).() const;
84 void setClientSecretSecretcxx . . $ OAuth2Service#setClientSecretSecret(3520e46b33348bf6).(const QStringcxx . . $ QString#& client_secret_secret);
85
86 bool useHttpBasicAuthWithClientDatacxx . . $ OAuth2Service#useHttpBasicAuthWithClientData(50ce9a9e25b4a850).() const;
87 void setUseHttpBasicAuthWithClientDatacxx . . $ OAuth2Service#setUseHttpBasicAuthWithClientData(b45ddcbc8423892c).(bool use_auth);
88
89 signalscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:43:14`!:
90 void tokensRetrievedcxx . . $ OAuth2Service#tokensRetrieved(4d9302a59065db7a).(QStringcxx . . $ QString# access_token, QStringcxx . . $ QString# refresh_token, int expires_in);
91 void tokensRetrieveErrorcxx . . $ OAuth2Service#tokensRetrieveError(3458fe3960d5051).(QStringcxx . . $ QString# error, QStringcxx . . $ QString# error_description);
92
93 // User failed to authenticate or rejected it.
94 void authFailedcxx . . $ OAuth2Service#authFailed(49f6e7a06ebc5aa8).();
95
96 public slotscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:42:14`!:
97 void retrieveAuthCodecxx . . $ OAuth2Service#retrieveAuthCode(49f6e7a06ebc5aa8).();
98 void retrieveAccessTokencxx . . $ OAuth2Service#retrieveAccessToken(3520e46b33348bf6).(const QStringcxx . . $ QString#& auth_code);
99 void refreshAccessTokencxx . . $ OAuth2Service#refreshAccessToken(3520e46b33348bf6).(const QStringcxx . . $ QString#& refresh_token = QStringcxx . . $ QString#QString(ced63f7c635d850d).());
100
101 // Performs login if needed. If some refresh token is set, then
102 // the initial "auth" step is skipped and attempt to refresh
103 // access token is made.
104 //
105 // Returns true, if user is already logged in (final state).
106 // Returns false, if user is NOT logged in (asynchronous flow).
107 bool logincxx . . $ OAuth2Service#login(c237ffba337c8e2a).(const stdcxx . . $ std/::functioncxx . . $ std/function#<void()>& functor_when_logged_in = stdcxx . . $ std/::functioncxx . . $ std/function#<void()>());
108
109 // Removes all state data and stops redirection handler.
110 void logoutcxx . . $ OAuth2Service#logout(b45ddcbc8423892c).(bool stop_redirection_handler = true);
111
112 private slotscxx . . $ `<external>/4830994369567095248/qtmetamacros.h:42:14`!:
113 void startRefreshTimercxx . . $ OAuth2Service#startRefreshTimer(49f6e7a06ebc5aa8).();
114 void killRefreshTimercxx . . $ OAuth2Service#killRefreshTimer(49f6e7a06ebc5aa8).();
115 void tokenRequestFinishedcxx . . $ OAuth2Service#tokenRequestFinished(a14709ced3df193c).(QNetworkReplycxx . . $ QNetworkReply#* network_reply);
116
117 private:
118 QStringcxx . . $ QString# properClientIdcxx . . $ OAuth2Service#properClientId(6ef7b6c27b00b43d).() const;
119 QStringcxx . . $ QString# properClientSecretcxx . . $ OAuth2Service#properClientSecret(6ef7b6c27b00b43d).() const;
120
121 void timerEventcxx . . $ OAuth2Service#timerEvent(b9e57d1150f23bf5).(QTimerEventcxx . . $ QTimerEvent#* event);
122
123 private:
124 QStringcxx . . $ QString# m_idcxx . . $ OAuth2Service#m_id.;
125 int m_timerIdcxx . . $ OAuth2Service#m_timerId.;
126 QDateTimecxx . . $ QDateTime# m_tokensExpireIncxx . . $ OAuth2Service#m_tokensExpireIn.;
127 QStringcxx . . $ QString# m_accessTokencxx . . $ OAuth2Service#m_accessToken.;
128 QStringcxx . . $ QString# m_refreshTokencxx . . $ OAuth2Service#m_refreshToken.;
129 QStringcxx . . $ QString# m_tokenGrantTypecxx . . $ OAuth2Service#m_tokenGrantType.;
130 QStringcxx . . $ QString# m_clientIdcxx . . $ OAuth2Service#m_clientId.;
131 QStringcxx . . $ QString# m_clientSecretcxx . . $ OAuth2Service#m_clientSecret.;
132 QStringcxx . . $ QString# m_clientSecretIdcxx . . $ OAuth2Service#m_clientSecretId.;
133 QStringcxx . . $ QString# m_clientSecretSecretcxx . . $ OAuth2Service#m_clientSecretSecret.;
134 QUrlcxx . . $ QUrl# m_tokenUrlcxx . . $ OAuth2Service#m_tokenUrl.;
135 QStringcxx . . $ QString# m_authUrlcxx . . $ OAuth2Service#m_authUrl.;
136 QStringcxx . . $ QString# m_scopecxx . . $ OAuth2Service#m_scope.;
137 bool m_useHttpBasicAuthWithClientDatacxx . . $ OAuth2Service#m_useHttpBasicAuthWithClientData.;
138 SilentNetworkAccessManagercxx . . $ SilentNetworkAccessManager# m_networkManagercxx . . $ OAuth2Service#m_networkManager.;
139 OAuthHttpHandlercxx . . $ OAuthHttpHandler#* m_redirectionHandlercxx . . $ OAuth2Service#m_redirectionHandler.;
140 stdcxx . . $ std/::functioncxx . . $ std/function#<void()> m_functorOnLogincxx . . $ OAuth2Service#m_functorOnLogin.;
141 };
142
143 #endif // OAUTH2SERVICE_H