Skip to content

Commit 55630c1

Browse files
committed
Updated docker/auth-tests.postman_collection.json to handle the new OIDC auth flow.
1 parent 0d051d9 commit 55630c1

1 file changed

Lines changed: 35 additions & 35 deletions

File tree

docker/auth-test/postman/auth-tests.postman_collection.json

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -314,21 +314,20 @@
314314
"});",
315315
"",
316316
"const location = pm.response.headers.get('Location');",
317-
"pm.test('Redirect contains JWT token', function() {",
317+
"pm.test('Redirect contains WebAPI OTC code', function() {",
318318
" pm.expect(location).to.not.be.undefined;",
319-
" pm.expect(location).to.include('token=');",
319+
" pm.expect(location).to.include('code=');",
320320
"});",
321321
"",
322-
"// Extract JWT from redirect URL",
322+
"// Extract OTC from redirect URL",
323323
"if (location) {",
324-
" const tokenMatch = location.match(/[?&#]token=([^&#]+)/);",
325-
" const token = tokenMatch ? tokenMatch[1] : null;",
326-
" if (token) {",
327-
" pm.collectionVariables.set('oidc_jwt_token', token);",
328-
" pm.test('JWT token is well-formed', function() {",
329-
" pm.expect(token).to.include('.');",
330-
" const parts = token.split('.');",
331-
" pm.expect(parts.length).to.equal(3);",
324+
" const otcMatch = location.match(/[?&#]code=([^&#]+)/);",
325+
" const otc = otcMatch ? otcMatch[1] : null;",
326+
" if (otc) {",
327+
" pm.collectionVariables.set('oidc_webapi_otc', otc);",
328+
" pm.test('OTC is well-formed UUID', function() {",
329+
" const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;",
330+
" pm.expect(otc).to.match(uuidRegex);",
332331
" });",
333332
" }",
334333
"}"
@@ -368,45 +367,35 @@
368367
}
369368
},
370369
{
371-
"name": "4. Get Token via Refresh",
370+
"name": "4. Redeem OTC Code",
372371
"event": [
373-
{
374-
"listen": "prerequest",
375-
"script": {
376-
"exec": [
377-
"const token = pm.collectionVariables.get('oidc_jwt_token');",
378-
"if (token) {",
379-
" pm.request.headers.add({",
380-
" key: 'Authorization',",
381-
" value: 'Bearer ' + token",
382-
" });",
383-
"}"
384-
],
385-
"type": "text/javascript"
386-
}
387-
},
388372
{
389373
"listen": "test",
390374
"script": {
391375
"exec": [
392-
"const token = pm.collectionVariables.get('oidc_jwt_token');",
393-
"if (!token) {",
394-
" pm.test.skip('No OIDC token available');",
376+
"const otc = pm.collectionVariables.get('oidc_webapi_otc');",
377+
"if (!otc) {",
378+
" pm.test.skip('No OIDC OTC code available');",
395379
"} else {",
396-
" pm.test('Refresh returns 200 with new JWT', function() {",
380+
" pm.test('OTC redemption returns 200', function() {",
397381
" pm.response.to.have.status(200);",
398382
" });",
399383
"",
400384
" const jsonData = pm.response.json();",
401-
" pm.test('Refresh response contains login and jwt', function() {",
385+
" pm.test('Redemption response contains login and jwt', function() {",
402386
" pm.expect(jsonData).to.have.property('login');",
403387
" pm.expect(jsonData).to.have.property('jwt');",
404388
" pm.expect(jsonData.login).to.equal('testuser');",
405389
" });",
406390
"",
407-
" // Update token for subsequent requests",
391+
" // Store JWT for subsequent requests",
408392
" if (jsonData.jwt) {",
409393
" pm.collectionVariables.set('oidc_jwt_token', jsonData.jwt);",
394+
" pm.test('JWT token is well-formed', function() {",
395+
" pm.expect(jsonData.jwt).to.include('.');",
396+
" const parts = jsonData.jwt.split('.');",
397+
" pm.expect(parts.length).to.equal(3);",
398+
" });",
410399
" }",
411400
"}"
412401
],
@@ -418,13 +407,20 @@
418407
"method": "GET",
419408
"header": [],
420409
"url": {
421-
"raw": "{{base_url}}/user/refresh",
410+
"raw": "{{base_url}}/user/login/otc?code={{oidc_webapi_otc}}",
422411
"host": [
423412
"{{base_url}}"
424413
],
425414
"path": [
426415
"user",
427-
"refresh"
416+
"login",
417+
"otc"
418+
],
419+
"query": [
420+
{
421+
"key": "code",
422+
"value": "{{oidc_webapi_otc}}"
423+
}
428424
]
429425
}
430426
}
@@ -990,6 +986,10 @@
990986
"key": "oidc_auth_code",
991987
"value": ""
992988
},
989+
{
990+
"key": "oidc_webapi_otc",
991+
"value": ""
992+
},
993993
{
994994
"key": "oidc_jwt_token",
995995
"value": ""

0 commit comments

Comments
 (0)