refactor: add logging category for credentials

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2022-12-27 17:04:42 +01:00
parent 4d334b645d
commit c8d8046412
13 changed files with 81 additions and 54 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include <QLoggingCategory>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
@ -11,6 +12,8 @@
namespace Katabasis {
Q_DECLARE_LOGGING_CATEGORY(katabasisCredentials)
class ReplyServer;
class PollServer;

View File

@ -22,6 +22,7 @@
#include "JsonResponse.h"
namespace {
// ref: https://tools.ietf.org/html/rfc8628#section-3.2
// Exception: Google sign-in uses "verification_url" instead of "*_uri" - we'll accept both.
bool hasMandatoryDeviceAuthParams(const QVariantMap& params)
@ -58,6 +59,8 @@ QByteArray createQueryParameters(const QList<Katabasis::RequestParameter> &param
namespace Katabasis {
Q_LOGGING_CATEGORY(katabasisCredentials, "katabasis.credentials", QtWarningMsg)
DeviceFlow::DeviceFlow(Options & opts, Token & token, QObject *parent, QNetworkAccessManager *manager) : QObject(parent), token_(token) {
manager_ = manager ? manager : new QNetworkAccessManager(this);
qRegisterMetaType<QNetworkReply::NetworkError>("QNetworkReply::NetworkError");
@ -333,9 +336,7 @@ QString DeviceFlow::refreshToken() {
}
void DeviceFlow::setRefreshToken(const QString &v) {
#ifndef NDEBUG
qDebug() << "DeviceFlow::setRefreshToken" << v << "...";
#endif
qCDebug(katabasisCredentials) << "new refresh token:" << v;
token_.refresh_token = v;
}