diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-11-19 17:57:41 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-11-19 17:57:41 +0900 |
commit | 5937127b73a82fc86f6546397373ce9dbaf4e560 (patch) | |
tree | 1e3b4e5ddd50e8a4b605e7e599591d47fe9bed55 /lib/connectiondata.cpp | |
parent | 1d57741c679ec3112ae45e833b8f152fa737b944 (diff) | |
download | libquotient-5937127b73a82fc86f6546397373ce9dbaf4e560.tar.gz libquotient-5937127b73a82fc86f6546397373ce9dbaf4e560.zip |
BaseJob: Don't send accessToken if not needed; send again on 401
The first part closes #358; the second part is a workaround for non-standard
cases when endpoints without security by the spec turn out to be secured
(in particular, the case of authenticating media servers).
Diffstat (limited to 'lib/connectiondata.cpp')
-rw-r--r-- | lib/connectiondata.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/connectiondata.cpp b/lib/connectiondata.cpp index cbc36420..e2a0f06f 100644 --- a/lib/connectiondata.cpp +++ b/lib/connectiondata.cpp @@ -42,6 +42,7 @@ public: QString lastEvent; QString userId; QString deviceId; + std::vector<QString> needToken; mutable unsigned int txnCounter = 0; const qint64 txnBase = QDateTime::currentMSecsSinceEpoch(); @@ -143,6 +144,12 @@ const QString& ConnectionData::deviceId() const { return d->deviceId; } const QString& ConnectionData::userId() const { return d->userId; } +bool ConnectionData::needsToken(const QString& requestName) const +{ + return std::find(d->needToken.cbegin(), d->needToken.cend(), requestName) + != d->needToken.cend(); +} + void ConnectionData::setDeviceId(const QString& deviceId) { d->deviceId = deviceId; @@ -150,6 +157,11 @@ void ConnectionData::setDeviceId(const QString& deviceId) void ConnectionData::setUserId(const QString& userId) { d->userId = userId; } +void ConnectionData::setNeedsToken(const QString& requestName) +{ + d->needToken.push_back(requestName); +} + QString ConnectionData::lastEvent() const { return d->lastEvent; } void ConnectionData::setLastEvent(QString identifier) |