| 1 | /* |
| 2 | * This file is part of lomiri-online-accounts-service |
| 3 | * |
| 4 | * Copyright (C) 2012 Canonical Ltd. |
| 5 | * |
| 6 | * Contact: Alberto Mardegan <[email protected]> |
| 7 | * |
| 8 | * This program is free software: you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License version 3, as published |
| 10 | * by the Free Software Foundation. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranties of |
| 14 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
| 15 | * PURPOSE. See the GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include "reauthenticator.h"cxx . . $ `<file>/online-accounts-service/src/reauthenticator.h`/ |
| 22 | |
| 23 | #include <online-accounts-common/debug.h>cxx . . $ `<file>/online-accounts-common/debug.h`/ |
| 24 | |
| 25 | #include <SignOn/AuthSession> |
| 26 | #include <SignOn/Identity> |
| 27 | |
| 28 | using namespace SignOnUi; |
| 29 | using namespace SignOn; |
| 30 | |
| 31 | namespace SignOnUicxx . . $ SignOnUi/ { |
| 32 | |
| 33 | class ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#: public QObjectcxx . . $ QObject# |
| 34 | { |
| 35 | Q_OBJECTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:170:9`! |
| 36 | Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(Reauthenticator) |
| 37 | |
| 38 | public: |
| 39 | ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#ReauthenticatorPrivate(3e8e662987b40281).(const QListcxx . . $ QList#<AuthDatacxx . . $ SignOnUi/AuthData#> &clientData, |
| 40 | const QVariantMapcxx . . $ QVariantMap# &extraParameters, |
| 41 | Reauthenticatorcxx . . $ SignOnUi/Reauthenticator# *reauthenticator); |
| 42 | ~cxx . . $ SignOnUi/ReauthenticatorPrivate#`~ReauthenticatorPrivate`(ced63f7c635d850d).ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#(); |
| 43 | |
| 44 | void startcxx . . $ SignOnUi/ReauthenticatorPrivate#start(49f6e7a06ebc5aa8).(); |
| 45 | |
| 46 | private: |
| 47 | void checkFinishedcxx . . $ SignOnUi/ReauthenticatorPrivate#checkFinished(49f6e7a06ebc5aa8).(); |
| 48 | |
| 49 | private Q_SLOTScxx . . $ `<external>/1208926524888476972/qobjectdefs.h:92:10`!: |
| 50 | void onErrorcxx . . $ SignOnUi/ReauthenticatorPrivate#onError(e22be6690a8478ff).(const SignOncxx . . $ SignOn/::Errorcxx . . $ SignOn/Error# &error); |
| 51 | void onResponsecxx . . $ SignOnUi/ReauthenticatorPrivate#onResponse(788a73c1a1492fd5).(const SignOncxx . . $ SignOn/::SessionDatacxx . . $ SignOn/SessionData# &response); |
| 52 | |
| 53 | private: |
| 54 | mutable Reauthenticatorcxx . . $ SignOnUi/Reauthenticator# *q_ptrcxx . . $ SignOnUi/ReauthenticatorPrivate#q_ptr.; |
| 55 | QListcxx . . $ QList#<AuthDatacxx . . $ SignOnUi/AuthData#> m_clientDatacxx . . $ SignOnUi/ReauthenticatorPrivate#m_clientData.; |
| 56 | QVariantMapcxx . . $ QVariantMap# m_extraParameterscxx . . $ SignOnUi/ReauthenticatorPrivate#m_extraParameters.; |
| 57 | int m_errorCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_errorCount.; |
| 58 | int m_responseCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_responseCount.; |
| 59 | }; |
| 60 | |
| 61 | } // namespace |
| 62 | |
| 63 | ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#::ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#ReauthenticatorPrivate(3e8e662987b40281).( |
| 64 | const QListcxx . . $ QList#<AuthDatacxx . . $ SignOnUi/AuthData#> &clientData, |
| 65 | const QVariantMapcxx . . $ QVariantMap# &extraParameters, |
| 66 | Reauthenticatorcxx . . $ SignOnUi/Reauthenticator# *request): |
| 67 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(request), |
| 68 | q_ptrcxx . . $ SignOnUi/ReauthenticatorPrivate#q_ptr.(request), |
| 69 | m_clientDatacxx . . $ SignOnUi/ReauthenticatorPrivate#m_clientData.(clientData), |
| 70 | m_extraParameterscxx . . $ SignOnUi/ReauthenticatorPrivate#m_extraParameters.(extraParameters), |
| 71 | m_errorCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_errorCount.(0), |
| 72 | m_responseCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_responseCount.(0) |
| 73 | { |
| 74 | } |
| 75 | |
| 76 | ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#::~cxx . . $ SignOnUi/ReauthenticatorPrivate#`~ReauthenticatorPrivate`(ced63f7c635d850d).ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#() |
| 77 | { |
| 78 | } |
| 79 | |
| 80 | void ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#::startcxx . . $ SignOnUi/ReauthenticatorPrivate#start(49f6e7a06ebc5aa8).() |
| 81 | { |
| 82 | Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`!(const AuthData &authData, m_clientData) { |
| 83 | Identitycxx . . $ SignOn/Identity# *identity = |
| 84 | Identitycxx . . $ SignOn/Identity#::existingIdentitycxx . . $ SignOn/Identity#existingIdentity(7e534ccf80011be0).(authData.identitycxx . . $ SignOnUi/AuthData#identity., this); |
| 85 | if (identity == 0) { m_errorCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_errorCount.++; continue; } |
| 86 | |
| 87 | AuthSessioncxx . . $ SignOn/AuthSession# *authSession = identity->createSessioncxx . . $ SignOn/Identity#createSession(1578aaca65afd4e1).(authData.methodcxx . . $ SignOnUi/AuthData#method.); |
| 88 | if (authSession == 0) { m_errorCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_errorCount.++; continue; } |
| 89 | |
| 90 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(authSession, |
| 91 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(error(const SignOn::Error &)), |
| 92 | this, |
| 93 | SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onError(const SignOn::Error &))); |
| 94 | QObjectcxx . . $ QObject#::connectcxx . . $ QObject#connect(158df1d9a01a3410).(authSession, |
| 95 | SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(response(const SignOn::SessionData &)), |
| 96 | this, |
| 97 | SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(onResponse(const SignOn::SessionData &))); |
| 98 | |
| 99 | /* Prepare the session data, adding the extra parameters. */ |
| 100 | QVariantMapcxx . . $ QVariantMap# sessionData = authDatacxx . . $ QMap#QMap(21739d87639e1d56)..sessionDatacxx . . $ SignOnUi/AuthData#sessionData.; |
| 101 | QVariantMapcxx . . $ QVariantMap#::const_iteratorcxx . . $ QMap#const_iterator# icxx . . $ QMap#const_iterator#const_iterator(49f6e7a06ebc5aa8).; |
| 102 | for (i =cxx . . $ QMap#const_iterator#`operator=`(2741e298c522abd1). m_extraParameterscxx . . $ SignOnUi/ReauthenticatorPrivate#m_extraParameters..constBegincxx . . $ QMap#constBegin(81a977e5fd18ea74).(); |
| 103 | i !=cxx . . $ QMap#const_iterator#`operator!=`(afb29c289d8ce2db). m_extraParameterscxx . . $ SignOnUi/ReauthenticatorPrivate#m_extraParameters..constEndcxx . . $ QMap#constEnd(81a977e5fd18ea74).(); |
| 104 | i++cxx . . $ QMap#const_iterator#operator++(fb26c9591f87d150).) { |
| 105 | sessionData[cxx . . $ QMap#`operator[]`(bbd415b616967878).i.keycxx . . $ QMap#const_iterator#key(ea465e50d690edfe).()] =cxx . . $ QVariant#`operator=`(b84532324b3fcc79). i.valuecxx . . $ QMap#const_iterator#value(bdbd05d619d62250).(); |
| 106 | } |
| 107 | |
| 108 | /* Start the session right now; signon-ui is queueing them anyway. */ |
| 109 | authSession->processcxx . . $ SignOn/AuthSession#process(eb4bf72deea28a27).(sessionDatacxx . . $ SignOn/SessionData#SessionData(3e95df3e31f2cce8)., authData.mechanismcxx . . $ SignOnUi/AuthData#mechanism.); |
| 110 | } |
| 111 | |
| 112 | checkFinishedcxx . . $ SignOnUi/ReauthenticatorPrivate#checkFinished(49f6e7a06ebc5aa8).(); |
| 113 | } |
| 114 | |
| 115 | void ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#::checkFinishedcxx . . $ SignOnUi/ReauthenticatorPrivate#checkFinished(49f6e7a06ebc5aa8).() |
| 116 | { |
| 117 | Q_Qcxx . . $ `<external>/15045578679651060896/qglobal.h:1178:9`!(Reauthenticator); |
| 118 | |
| 119 | if (m_errorCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_errorCount. + m_responseCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_responseCount. < m_clientDatacxx . . $ SignOnUi/ReauthenticatorPrivate#m_clientData..countcxx . . $ QList#count(455f465bc33b4cdf).()) return; |
| 120 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! q->finishedcxx . . $ SignOnUi/Reauthenticator#finished(b45ddcbc8423892c).(m_errorCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_errorCount. == 0); |
| 121 | } |
| 122 | |
| 123 | void ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#::onErrorcxx . . $ SignOnUi/ReauthenticatorPrivate#onError(e22be6690a8478ff).(const SignOncxx . . $ SignOn/::Errorcxx . . $ SignOn/Error# &error) |
| 124 | { |
| 125 | DEBUGcxx . . $ `online-accounts-common/debug.h:42:13`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Got error:" <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). error.messagecxx . . $ SignOn/Error#message(6ef7b6c27b00b43d).(); |
| 126 | |
| 127 | m_errorCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_errorCount.++; |
| 128 | checkFinishedcxx . . $ SignOnUi/ReauthenticatorPrivate#checkFinished(49f6e7a06ebc5aa8).(); |
| 129 | } |
| 130 | |
| 131 | void ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#::onResponsecxx . . $ SignOnUi/ReauthenticatorPrivate#onResponse(788a73c1a1492fd5).( |
| 132 | const SignOncxx . . $ SignOn/::SessionDatacxx . . $ SignOn/SessionData# &response) |
| 133 | { |
| 134 | DEBUGcxx . . $ `online-accounts-common/debug.h:42:13`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Got response:" <<cxx . . $ `operator<<`(d06749710cb27f7f). response.toMapcxx . . $ SignOn/SessionData#toMap(87f780dbe64191c4).(); |
| 135 | |
| 136 | m_responseCountcxx . . $ SignOnUi/ReauthenticatorPrivate#m_responseCount.++; |
| 137 | checkFinishedcxx . . $ SignOnUi/ReauthenticatorPrivate#checkFinished(49f6e7a06ebc5aa8).(); |
| 138 | } |
| 139 | |
| 140 | Reauthenticatorcxx . . $ SignOnUi/Reauthenticator#::Reauthenticatorcxx . . $ SignOnUi/Reauthenticator#Reauthenticator(8de248bc4c5bd6ce).(const QListcxx . . $ QList#<AuthDatacxx . . $ SignOnUi/AuthData#> &clientData, |
| 141 | const QVariantMapcxx . . $ QVariantMap# &extraParameters, |
| 142 | QObjectcxx . . $ QObject# *parent): |
| 143 | QObjectcxx . . $ QObject#QObject(749de1b6ae65bddd).(parent), |
| 144 | d_ptrcxx . . $ SignOnUi/Reauthenticator#d_ptr.(new ReauthenticatorPrivatecxx . . $ SignOnUi/ReauthenticatorPrivate#ReauthenticatorPrivate(3e8e662987b40281).(clientData, extraParameters, this)) |
| 145 | { |
| 146 | } |
| 147 | |
| 148 | Reauthenticatorcxx . . $ SignOnUi/Reauthenticator#::~cxx . . $ SignOnUi/Reauthenticator#`~Reauthenticator`(ced63f7c635d850d).Reauthenticatorcxx . . $ SignOnUi/Reauthenticator#() |
| 149 | { |
| 150 | } |
| 151 | |
| 152 | void Reauthenticatorcxx . . $ SignOnUi/Reauthenticator#::startcxx . . $ SignOnUi/Reauthenticator#start(49f6e7a06ebc5aa8).() |
| 153 | { |
| 154 | Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(Reauthenticator); |
| 155 | d->startcxx . . $ SignOnUi/ReauthenticatorPrivate#start(49f6e7a06ebc5aa8).(); |
| 156 | } |
| 157 | |
| 158 | #include "reauthenticator.moc"cxx . . $ `<file>/build/online-accounts-service/src/lomiri-online-accounts-service_autogen/include/reauthenticator.moc`/ |