Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-05-05 15:31:16 +0300
committerHannah von Reth <vonreth@kde.org>2021-05-05 16:46:20 +0300
commitef3260f017a9524f70a9c847f2e5638bec89166e (patch)
treec0313c87740f1cf98195c3de5534a783f00fe3a9 /test
parent4c431067a1c7036ac33995017e0b9e5bdee1fd1a (diff)
Use http://127.0.0.1 for oidc
Diffstat (limited to 'test')
-rw-r--r--test/testoauth.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/testoauth.cpp b/test/testoauth.cpp
index bafde234c..26e6fa647 100644
--- a/test/testoauth.cpp
+++ b/test/testoauth.cpp
@@ -98,6 +98,9 @@ public:
TokenAsked,
CustomState } state = StartState;
Q_ENUM(State);
+
+ // for oauth2 we use localhost, for oidc we use 127.0.0.1
+ QString localHost = QStringLiteral("localhost");
bool replyToBrowserOk = false;
bool gotAuthOk = false;
virtual bool done() const { return replyToBrowserOk && gotAuthOk; }
@@ -139,13 +142,13 @@ public:
virtual void openBrowserHook(const QUrl &url) {
QCOMPARE(state, StatusPhpState);
state = BrowserOpened;
- QCOMPARE(url.path(), QString(sOAuthTestServer.path() + "/index.php/apps/oauth2/authorize"));
+ QCOMPARE(url.path(), sOAuthTestServer.path() + QStringLiteral("/index.php/apps/oauth2/authorize"));
QVERIFY(url.toString().startsWith(sOAuthTestServer.toString()));
QUrlQuery query(url);
- QCOMPARE(query.queryItemValue(QLatin1String("response_type")), QLatin1String("code"));
- QCOMPARE(query.queryItemValue(QLatin1String("client_id")), Theme::instance()->oauthClientId());
- QUrl redirectUri(query.queryItemValue(QLatin1String("redirect_uri")));
- QCOMPARE(redirectUri.host(), QLatin1String("localhost"));
+ QCOMPARE(query.queryItemValue(QStringLiteral("response_type")), QLatin1String("code"));
+ QCOMPARE(query.queryItemValue(QStringLiteral("client_id")), Theme::instance()->oauthClientId());
+ QUrl redirectUri(query.queryItemValue(QStringLiteral("redirect_uri")));
+ QCOMPARE(redirectUri.host(), localHost);
redirectUri.setQuery(QStringLiteral("code=%1&state=%2").arg(code, query.queryItemValue(QStringLiteral("state"))));
createBrowserReply(QNetworkRequest(redirectUri));
}
@@ -355,6 +358,11 @@ private slots:
void testWellKnown() {
struct Test : OAuthTestCase {
+ Test()
+ {
+ localHost = QLatin1String("127.0.0.1");
+ }
+
QNetworkReply * wellKnownReply(QNetworkAccessManager::Operation op, const QNetworkRequest & req) override {
OC_ASSERT(op == QNetworkAccessManager::GetOperation);
QJsonDocument jsondata(QJsonObject{