Changeset View
Changeset View
Standalone View
Standalone View
src/authentication.h
Show All 17 Lines | |||||
18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | * | 20 | * | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #ifndef AUTHENTICATION_H | 23 | #ifndef AUTHENTICATION_H | ||
24 | #define AUTHENTICATION_H | 24 | #define AUTHENTICATION_H | ||
25 | 25 | | |||
26 | #include <QString> | 26 | #include <QString> | ||
27 | #include <QObject> | ||||
mlaurent: it's not a local include | |||||
27 | 28 | | |||
28 | class Authentication | 29 | class Authentication: public QObject | ||
mlaurent: no a qwidget for sure | |||||
mlaurent: We need to look at what we can autotest in this class | |||||
29 | { | 30 | { | ||
30 | public: | 31 | public: | ||
31 | Authentication(); | 32 | Authentication(); | ||
mlaurent: explicit ... (QObject *parent = nullptr) | |||||
32 | 33 | | |||
33 | /** | 34 | /** | ||
34 | * @brief Extract info from Google Json API | 35 | * @brief Extract info from Google Json API | ||
35 | */ | 36 | */ | ||
36 | void getDataFromJson(); | 37 | void getDataFromJson(); | ||
37 | 38 | | |||
38 | /** | 39 | /** | ||
39 | * @brief Call DDPClient's @method method with OAuth params | 40 | * @brief Call DDPClient's @method method with OAuth params | ||
40 | */ | 41 | */ | ||
41 | void OAuthLogin(); | 42 | void OAuthLogin(); | ||
mlaurent: move to private | |||||
velurimithun: no, we can't we are using it in DDPClient! | |||||
mlaurent: In private member | |||||
42 | 43 | | |||
43 | /** | 44 | /** | ||
44 | * @brief Make requests to Google on behalf of user using access token | 45 | * @brief Make requests to Google for getting Authorization Code | ||
45 | */ | 46 | */ | ||
46 | void sendApiRequest(); | 47 | void getAuthorizationCode(); | ||
48 | | ||||
49 | /** | ||||
50 | * @brief Make requests to Google API for getting Access Token | ||||
51 | */ | ||||
52 | void getAccessToken(); | ||||
47 | 53 | | |||
48 | private slots: | 54 | private slots: | ||
mlaurent: Q_SLOTS | |||||
49 | void onGranted(); | 55 | void slotOnGranted(); | ||
mlaurent: const'ref ? | |||||
mlaurent: it's still useful to use Q_SLOTS as you use new connect api §? | |||||
50 | 56 | | |||
51 | private: | 57 | private: | ||
52 | bool m_authGranted = false; | 58 | bool m_authGranted = false; | ||
59 | quint16 m_returnPort; | ||||
mlaurent: initialize to 0 ? | |||||
mlaurent: 0? | |||||
mlaurent: nullptr | |||||
53 | QString m_clientID; | 60 | QString m_clientID; | ||
54 | QString m_clientSecret; | 61 | QString m_clientSecret; | ||
62 | QUrl m_redirectUri; | ||||
63 | QUrl m_tokenUri; | ||||
64 | QUrl m_authUri; | ||||
55 | }; | 65 | }; | ||
mlaurent: use prefix member m_ | |||||
56 | 66 | | |||
57 | #endif // AUTHENTICATION_H | 67 | #endif // AUTHENTICATION_H |
it's not a local include