summaryrefslogtreecommitdiffstats
path: root/src/oauth/qoauth2authorizationcodeflow.cpp
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-09-05 11:21:52 +0200
committerIvan Solovev <ivan.solovev@qt.io>2022-09-14 21:55:03 +0200
commitdb2f209b2d299def846503e632dc9999e3007cba (patch)
tree6d6f4f5754ad6d2f70271fd0b237be6a5a2382e1 /src/oauth/qoauth2authorizationcodeflow.cpp
parent4c4af1619811e89bd436360e1c75ab0a235700ce (diff)
OAuth2: allow to specify TLS configuration
Specifying a custom TLS configuration is necessary when it is required to establish a Mutual TLS connection between the client and the Authentication Server. [ChangeLog][QAbstractOAuth2] Introduce a new sslConfiguration parameter which allows to specify a TLS configuration used during the authentication process. This patch also applies the new parameter to QOAuth2AuthorizationCodeFlow class. Fixes: QTBUG-88325 Change-Id: I5daac3d97e4df1ecc35597e168a2d111881d704a Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/oauth/qoauth2authorizationcodeflow.cpp')
-rw-r--r--src/oauth/qoauth2authorizationcodeflow.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/oauth/qoauth2authorizationcodeflow.cpp b/src/oauth/qoauth2authorizationcodeflow.cpp
index 2706c70..c9e3b00 100644
--- a/src/oauth/qoauth2authorizationcodeflow.cpp
+++ b/src/oauth/qoauth2authorizationcodeflow.cpp
@@ -295,6 +295,10 @@ void QOAuth2AuthorizationCodeFlow::refreshAccessToken()
QMultiMap<QString, QVariant> parameters;
QNetworkRequest request(d->accessTokenUrl);
+#ifndef QT_NO_SSL
+ if (d->sslConfiguration && !d->sslConfiguration->isNull())
+ request.setSslConfiguration(*d->sslConfiguration);
+#endif
QUrlQuery query;
parameters.insert(Key::grantType, QStringLiteral("refresh_token"));
parameters.insert(Key::refreshToken, d->refreshToken);
@@ -369,6 +373,10 @@ void QOAuth2AuthorizationCodeFlow::requestAccessToken(const QString &code)
QMultiMap<QString, QVariant> parameters;
QNetworkRequest request(d->accessTokenUrl);
+#ifndef QT_NO_SSL
+ if (d->sslConfiguration && !d->sslConfiguration->isNull())
+ request.setSslConfiguration(*d->sslConfiguration);
+#endif
QUrlQuery query;
parameters.insert(Key::grantType, QStringLiteral("authorization_code"));
parameters.insert(Key::code, QUrl::toPercentEncoding(code));