Skip to content

Commit

Permalink
Added Postman collections.
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Labordus <[email protected]>
  • Loading branch information
Dennis Labordus committed Jul 11, 2022
1 parent bc5d838 commit 40c3d78
Show file tree
Hide file tree
Showing 6 changed files with 385 additions and 0 deletions.
298 changes: 298 additions & 0 deletions postman/auth.collection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,298 @@
{
"info": {
"_postman_id": "1cb5ef5a-b707-4e19-a271-fc1522a87ef6",
"name": "Compas Auth",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "1434829"
},
"item": [
{
"name": "Get JWT (SCL Data Editor)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let responseData=pm.response.json();",
"pm.environment.set(\"bearer\", responseData.access_token);",
"",
"let template = `",
"<html>",
"<head>",
" <script src=\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\"></script>",
" <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js\"></script>",
"</head>",
"<body>",
" <div>",
" <div>",
" <pre><code style=\"width:max-content!important;\" id=\"copyText\">Bearer ${pm.environment.get('bearer')}</code></pre>",
" </div>",
" <button id=\"copyButton\" class=\"copyButton\" type=\"button\" data-clipboard-action=\"copy\" data-clipboard-target=\"#copyText\" style=\"background:green;color:white;\">Copy to Clipboard</button>",
" </div>",
"</body>",
"</html>",
"<script>",
" var clipboard = new ClipboardJS('#copyButton');",
"",
" clipboard.on('success', function(e) {",
" e.clearSelection();",
" e.trigger.textContent = '✔ Copied!';",
" window.setTimeout(function() {",
" e.trigger.textContent = 'Copy to Clipboard';",
" }, 2000);",
" });",
" clipboard.on('error', function(e) {",
" e.clearSelection();",
" e.trigger.textContent = '✗ Not Copied';",
" window.setTimeout(function() {",
" e.trigger.textContent = 'Copy to Clipboard';",
" }, 2000);",
" });",
" document.getElementById('copyButton').click()",
"</script>`;",
"",
"pm.visualizer.set(template, pm.response.json());",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "password",
"type": "text"
},
{
"key": "client_id",
"value": "openscd",
"type": "text"
},
{
"key": "username",
"value": "scl-data-editor",
"type": "text"
},
{
"key": "password",
"value": "editor",
"type": "text"
}
]
},
"url": {
"raw": "{{authUrl}}/realms/compas/protocol/openid-connect/token",
"host": [
"{{authUrl}}"
],
"path": [
"realms",
"compas",
"protocol",
"openid-connect",
"token"
]
}
},
"response": []
},
{
"name": "Get JWT (SCL Data Reader)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let responseData=pm.response.json();",
"pm.environment.set(\"bearer\", responseData.access_token);",
"",
"let template = `",
"<html>",
"<head>",
" <script src=\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\"></script>",
" <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js\"></script>",
"</head>",
"<body>",
" <div>",
" <div>",
" <pre><code style=\"width:max-content!important;\" id=\"copyText\">${pm.environment.get('bearer')}</code></pre>",
" </div>",
" <button id=\"copyButton\" class=\"copyButton\" type=\"button\" data-clipboard-action=\"copy\" data-clipboard-target=\"#copyText\" style=\"background:green;color:white;\">Copy to Clipboard</button>",
" </div>",
"</body>",
"</html>",
"<script>",
" var clipboard = new ClipboardJS('#copyButton');",
"",
" clipboard.on('success', function(e) {",
" e.clearSelection();",
" e.trigger.textContent = '✔ Copied!';",
" window.setTimeout(function() {",
" e.trigger.textContent = 'Copy to Clipboard';",
" }, 2000);",
" });",
" clipboard.on('error', function(e) {",
" e.clearSelection();",
" e.trigger.textContent = '✗ Not Copied';",
" window.setTimeout(function() {",
" e.trigger.textContent = 'Copy to Clipboard';",
" }, 2000);",
" });",
" document.getElementById('copyButton').click()",
"</script>`;",
"",
"pm.visualizer.set(template, pm.response.json());",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "password",
"type": "text"
},
{
"key": "client_id",
"value": "openscd",
"type": "text"
},
{
"key": "username",
"value": "scl-data-reader",
"type": "text"
},
{
"key": "password",
"value": "reader",
"type": "text"
}
]
},
"url": {
"raw": "{{authUrl}}/realms/compas/protocol/openid-connect/token",
"host": [
"{{authUrl}}"
],
"path": [
"realms",
"compas",
"protocol",
"openid-connect",
"token"
]
}
},
"response": []
},
{
"name": "Get JWT (SCD Reader)",
"event": [
{
"listen": "test",
"script": {
"exec": [
"let responseData=pm.response.json();",
"pm.environment.set(\"bearer\", responseData.access_token);",
"",
"let template = `",
"<html>",
"<head>",
" <script src=\"https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js\"></script>",
" <script src=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js\"></script>",
"</head>",
"<body>",
" <div>",
" <div>",
" <pre><code style=\"width:max-content!important;\" id=\"copyText\">${pm.environment.get('bearer')}</code></pre>",
" </div>",
" <button id=\"copyButton\" class=\"copyButton\" type=\"button\" data-clipboard-action=\"copy\" data-clipboard-target=\"#copyText\" style=\"background:green;color:white;\">Copy to Clipboard</button>",
" </div>",
"</body>",
"</html>",
"<script>",
" var clipboard = new ClipboardJS('#copyButton');",
"",
" clipboard.on('success', function(e) {",
" e.clearSelection();",
" e.trigger.textContent = '✔ Copied!';",
" window.setTimeout(function() {",
" e.trigger.textContent = 'Copy to Clipboard';",
" }, 2000);",
" });",
" clipboard.on('error', function(e) {",
" e.clearSelection();",
" e.trigger.textContent = '✗ Not Copied';",
" window.setTimeout(function() {",
" e.trigger.textContent = 'Copy to Clipboard';",
" }, 2000);",
" });",
" document.getElementById('copyButton').click()",
"</script>`;",
"",
"pm.visualizer.set(template, pm.response.json());",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "grant_type",
"value": "password",
"type": "text"
},
{
"key": "client_id",
"value": "openscd",
"type": "text"
},
{
"key": "username",
"value": "scd-reader",
"type": "text"
},
{
"key": "password",
"value": "reader",
"type": "text"
}
]
},
"url": {
"raw": "{{authUrl}}/realms/compas/protocol/openid-connect/token",
"host": [
"{{authUrl}}"
],
"path": [
"realms",
"compas",
"protocol",
"openid-connect",
"token"
]
}
},
"response": []
}
]
}
3 changes: 3 additions & 0 deletions postman/auth.collection.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2022 Alliander N.V.

SPDX-License-Identifier: Apache-2.0
39 changes: 39 additions & 0 deletions postman/docker-compose.environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"id": "42022eb4-7cc9-483c-919f-145bb2c5ba61",
"name": "Docker Compose",
"values": [
{
"key": "sclDataServiceBaseUrl",
"value": "http://localhost:9090/compas-scl-data-service",
"enabled": true
},
{
"key": "cimMappingBaseUrl",
"value": "http://localhost:9091/compas-cim-mapping",
"enabled": true
},
{
"key": "authUrl",
"value": "http://localhost:8089/auth",
"enabled": true
},
{
"key": "bearer",
"value": "",
"enabled": true
},
{
"key": "sclAutoAlignServiceBaseUrl",
"value": "http://localhost:9092/compas-scl-auto-alignment",
"enabled": true
},
{
"key": "sclValidatorBaseUrl",
"value": "http://localhost:9093/compas-scl-validator",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2022-07-11T08:51:37.380Z",
"_postman_exported_using": "Postman/9.24.1"
}
3 changes: 3 additions & 0 deletions postman/docker-compose.environment.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2022 Alliander N.V.

SPDX-License-Identifier: Apache-2.0
39 changes: 39 additions & 0 deletions postman/local.environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"id": "bf50c1be-fa5a-4b32-b372-098bc6190d42",
"name": "Local",
"values": [
{
"key": "sclDataServiceBaseUrl",
"value": "http://localhost:9090/compas-scl-data-service",
"enabled": true
},
{
"key": "cimMappingBaseUrl",
"value": "http://localhost:9091/compas-cim-mapping",
"enabled": true
},
{
"key": "authUrl",
"value": "http://localhost:8089/auth",
"enabled": true
},
{
"key": "bearer",
"value": "",
"enabled": true
},
{
"key": "sclAutoAlignServiceBaseUrl",
"value": "http://localhost:9092/compas-scl-auto-alignment",
"enabled": true
},
{
"key": "sclValidatorBaseUrl",
"value": "http://localhost:9093/compas-scl-validator",
"enabled": true
}
],
"_postman_variable_scope": "environment",
"_postman_exported_at": "2022-07-11T08:50:55.958Z",
"_postman_exported_using": "Postman/9.24.1"
}
3 changes: 3 additions & 0 deletions postman/local.environment.json.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SPDX-FileCopyrightText: 2022 Alliander N.V.

SPDX-License-Identifier: Apache-2.0

0 comments on commit 40c3d78

Please sign in to comment.