From 8a4aeb6141cb6b16af72bf19b43a62a9de504683 Mon Sep 17 00:00:00 2001 From: Tunahan Cicek Date: Thu, 22 Feb 2024 10:00:49 +0100 Subject: [PATCH] Add postman collection for access rule management. Adjust default wildcard types --- charts/registry/values.yaml | 2 +- docs/development/postman/README.md | 4 + ...s-rule-management-api-v1.0-collection.json | 168 ++++++++++++++++++ 3 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 docs/development/postman/tractusx-dtr-access-rule-management-api-v1.0-collection.json diff --git a/charts/registry/values.yaml b/charts/registry/values.yaml index 19e68a87..8e325841 100644 --- a/charts/registry/values.yaml +++ b/charts/registry/values.yaml @@ -48,7 +48,7 @@ registry: idpClientId: default-client tenantId: default-tenant externalSubjectIdWildcardPrefix: PUBLIC_READABLE - externalSubjectIdWildcardAllowedTypes: manufacturerPartId,assetLifecyclePhase + externalSubjectIdWildcardAllowedTypes: manufacturerPartId,digitalTwinType useGranularAccessControl: "false" service: port: 8080 diff --git a/docs/development/postman/README.md b/docs/development/postman/README.md index 42b6da4a..4ba50584 100644 --- a/docs/development/postman/README.md +++ b/docs/development/postman/README.md @@ -1,8 +1,12 @@ # DTR Postman Collection ## Postman +### DTR Postman Collection: The postman collection can be used to call all provided APIs of the DTR. +### Access rule management Postman Collection: +The postman collection can be used to call all provided APIs of the access rule management. + ### Setup Postman To install postman, download the newest version: diff --git a/docs/development/postman/tractusx-dtr-access-rule-management-api-v1.0-collection.json b/docs/development/postman/tractusx-dtr-access-rule-management-api-v1.0-collection.json new file mode 100644 index 00000000..6edbf46f --- /dev/null +++ b/docs/development/postman/tractusx-dtr-access-rule-management-api-v1.0-collection.json @@ -0,0 +1,168 @@ +{ + "info": { + "_postman_id": "47f1eefc-bd84-4c6b-9c30-2ff696b1dde0", + "name": "tractusx-dtr-access-rule-management-api-v1.0 Copy", + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" + }, + "item": [ + { + "name": "get Rules", + "request": { + "method": "GET", + "header": [], + "url": "{{baseUrl}}/api/v3.0/access-controls/rules" + }, + "response": [] + }, + { + "name": "create Rule", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"validFrom\": \"2020-01-02T03:04:05Z\",\n \"validTo\": \"4999-01-02T03:04:05Z\",\n \"description\": \"ACME policy within set validity period\",\n \"policyType\": \"AAS\",\n \"policy\": {\n \"accessRules\": [\n {\n \"attribute\": \"bpn\",\n \"operator\": \"eq\",\n \"value\": \"BPNL00000000000A\"\n },\n {\n \"attribute\": \"mandatorySpecificAssetIds\",\n \"operator\": \"includes\",\n \"values\": [\n {\n \"attribute\": \"manufacturerPartId\",\n \"operator\": \"eq\",\n \"value\": \"99991\"\n },\n {\n \"attribute\": \"customerPartId\",\n \"operator\": \"eq\",\n \"value\": \"ACME001\"\n }\n ]\n },\n {\n \"attribute\": \"visibleSpecificAssetIdNames\",\n \"operator\": \"includes\",\n \"values\": [\n {\n \"attribute\": \"name\",\n \"operator\": \"eq\",\n \"value\": \"manufacturerPartId\"\n },\n {\n \"attribute\": \"name\",\n \"operator\": \"eq\",\n \"value\": \"customerPartId\"\n },\n {\n \"attribute\": \"name\",\n \"operator\": \"eq\",\n \"value\": \"partInstanceId\"\n }\n ]\n },\n {\n \"attribute\": \"visibleSemanticIds\",\n \"operator\": \"includes\",\n \"values\": [\n {\n \"attribute\": \"modelUrn\",\n \"operator\": \"eq\",\n \"value\": \"urn:samm:net.catenax.vehicle.submodel_external1:1.0.0#Pcf\"\n }\n ]\n }\n ]\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": "{{baseUrl}}/api/v3.0/access-controls/rules" + }, + "response": [] + }, + { + "name": "get Rule by ruleId", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/v3.0/access-controls/rules/:ruleId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "v3.0", + "access-controls", + "rules", + ":ruleId" + ], + "variable": [ + { + "key": "ruleId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "update Rule by ruleId", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"id\": 1,\n \"tid\": \"00000000-1111-2222-3333-444444444444\",\n \"policyType\": \"AAS\",\n \"policy\": {\n \"accessRules\": [\n {\n \"attribute\": \"bpn\",\n \"operator\": \"eq\",\n \"value\": \"BPNL00000000000A\"\n },\n {\n \"attribute\": \"mandatorySpecificAssetIds\",\n \"operator\": \"includes\",\n \"values\": [\n {\n \"attribute\": \"manufacturerPartId\",\n \"operator\": \"eq\",\n \"value\": \"99991\"\n },\n {\n \"attribute\": \"customerPartId\",\n \"operator\": \"eq\",\n \"value\": \"ACME001\"\n }\n ]\n },\n {\n \"attribute\": \"visibleSpecificAssetIdNames\",\n \"operator\": \"includes\",\n \"values\": [\n {\n \"attribute\": \"name\",\n \"operator\": \"eq\",\n \"value\": \"manufacturerPartId\"\n },\n {\n \"attribute\": \"name\",\n \"operator\": \"eq\",\n \"value\": \"customerPartId\"\n },\n {\n \"attribute\": \"name\",\n \"operator\": \"eq\",\n \"value\": \"partInstanceId\"\n }\n ]\n },\n {\n \"attribute\": \"visibleSemanticIds\",\n \"operator\": \"includes\",\n \"values\": [\n {\n \"attribute\": \"modelUrn\",\n \"operator\": \"eq\",\n \"value\": \"Traceabilityv1.1.0\"\n },\n {\n \"attribute\": \"modelUrn\",\n \"operator\": \"eq\",\n \"value\": \"ProductCarbonFootprintv1.1.0\"\n }\n ]\n }\n ]\n },\n \"description\": \"Access rule description.\",\n \"validFrom\": \"2024-01-02T03:04:05Z\",\n \"validTo\": \"2024-06-07T08:09:10Z\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{baseUrl}}/api/v3.0/access-controls/rules/:ruleId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "v3.0", + "access-controls", + "rules", + ":ruleId" + ], + "variable": [ + { + "key": "ruleId", + "value": "" + } + ] + } + }, + "response": [] + }, + { + "name": "delete rule by ruleId", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/v3.0/access-controls/rules/:ruleId", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "v3.0", + "access-controls", + "rules", + ":ruleId" + ], + "variable": [ + { + "key": "ruleId", + "value": "" + } + ] + } + }, + "response": [] + } + ], + "auth": { + "type": "oauth2", + "oauth2": { + "clientSecret": "", + "clientId": "", + "accessTokenUrl": "", + "challengeAlgorithm": "S256", + "scope": "openid", + "redirect_uri": "", + "grant_type": "client_credentials", + "authUrl": "", + "addTokenTo": "header", + "client_authentication": "header" + } + }, + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "" + ] + } + } + ], + "variable": [ + { + "key": "baseUrl", + "value": "", + "type": "default" + } + ] +} \ No newline at end of file