Skip to content

Commit b0ba1bf

Browse files
committed
Fix params for flutter tests to pass
1 parent 4c7e7de commit b0ba1bf

File tree

12 files changed

+65
-26
lines changed

12 files changed

+65
-26
lines changed

mock-server/app/http.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,13 @@
564564
->label('sdk.namespace', 'general')
565565
->label('sdk.method', 'oauth2')
566566
->param('clientId', '', new Text(100), 'OAuth2 Client ID.')
567-
->param('redirectUri', '', new Host(['localhost']), 'OAuth2 Redirect URI.') // Important to deny an open redirect attack
568567
->param('scopes', [], new ArrayList(new Text(100)), 'OAuth2 scope list.')
569568
->param('state', '', new Text(1024), 'OAuth2 state.')
569+
->param('success', '', new Text(1024), 'OAuth2 success redirect URI.')
570+
->param('failure', '', new Text(1024), 'OAuth2 failure redirect URI.')
570571
->inject('response')
571-
->action(function (string $client_id, string $redirectURI, array $scopes, string $state, UtopiaSwooleResponse $response) {
572-
$response->redirect($redirectURI . '?' . \http_build_query(['code' => 'abcdef', 'state' => $state]));
572+
->action(function (string $clientId, array $scopes, string $state, string $success, string $failure, UtopiaSwooleResponse $response) {
573+
$response->redirect($success . '?' . \http_build_query(['code' => 'abcdef', 'state' => $state]));
573574
});
574575

575576
App::get('/v1/mock/tests/general/oauth2/token')

templates/flutter/base/requests/oauth.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
query: query.join('&')
3232
);
3333

34-
return client.webAuth(url, callbackUrlScheme: success);
34+
return client.webAuth(url, callbackUrlScheme: success);

tests/languages/dart/tests.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ void main() async {
106106

107107
final url = await general.oauth2(
108108
clientId: 'clientId',
109-
redirectUri: 'https://localhost',
110109
scopes: ['test'],
111-
state: '123456'
110+
state: '123456',
111+
success: 'https://localhost',
112+
failure: 'https://localhost'
112113
);
113114
print(url);
114115

tests/languages/deno/tests.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ async function start() {
134134

135135
await general.empty();
136136

137-
const url = await general.oauth2('clientId', 'https://localhost', ['test'], '123456')
137+
const url = await general.oauth2(
138+
'clientId',
139+
['test'],
140+
'123456',
141+
'https://localhost',
142+
'https://localhost'
143+
)
138144
console.log(url)
139145

140146
// Query helper tests

tests/languages/dotnet/Tests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ public async Task Test1()
115115

116116
var url = await general.Oauth2(
117117
clientId: "clientId",
118-
redirectUri: "https://localhost",
119118
scopes: new List<string>() {"test"},
120-
state: "123456"
119+
state: "123456",
120+
success: "https://localhost",
121+
failure: "https://localhost"
121122
);
122123
TestContext.WriteLine(url);
123124

tests/languages/kotlin/Tests.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,14 @@ class ServiceTest {
127127
try {
128128
val url = general.oauth2(
129129
clientId = "clientId",
130-
redirectUri = "https://localhost",
131130
scopes = listOf("test"),
132-
state = "123456"
131+
state = "123456",
132+
success = "https://localhost",
133+
failure = "https://localhost",
133134
)
134135
writeToFile(url)
135136
} catch(e: Exception) {
137+
writeToFile("Was exception")
136138
writeToFile(e.message)
137139
}
138140

tests/languages/node/test.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,13 @@ async function start() {
9999

100100
await general.empty();
101101

102-
const url = await general.oauth2('clientId', 'https://localhost', ['test'], '123456')
102+
const url = await general.oauth2(
103+
'clientId',
104+
['test'],
105+
'123456',
106+
'https://localhost',
107+
'https://localhost'
108+
)
103109
console.log(url)
104110

105111
// Query helper tests

tests/languages/php/test.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@
109109

110110
$general->empty();
111111

112-
$url = $general->oauth2('clientId', 'https://localhost', ['test'], '123456');
112+
$url = $general->oauth2(
113+
'clientId',
114+
['test'],
115+
'123456',
116+
'https://localhost',
117+
'https://localhost'
118+
);
113119
echo $url . "\n";
114120

115121
// Query helper tests

tests/languages/python/tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,13 @@
9595

9696
general.empty()
9797

98-
url = general.oauth2('clientId', 'https://localhost', ['test'], '123456')
98+
url = general.oauth2(
99+
'clientId',
100+
['test'],
101+
'123456',
102+
'https://localhost',
103+
'https://localhost'
104+
)
99105
print(url)
100106

101107
# Query helper tests

tests/languages/ruby/tests.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@
108108

109109
url = general.oauth2(
110110
client_id: 'clientId',
111-
redirect_uri: 'https://localhost',
112111
scopes: ['test'],
113-
state: '123456'
112+
state: '123456',
113+
success: 'https://localhost',
114+
failure: 'https://localhost'
114115
)
115116
puts url
116117

0 commit comments

Comments
 (0)