diff --git a/default.sh b/default.sh index 5131d37..a98d6b2 100644 --- a/default.sh +++ b/default.sh @@ -301,6 +301,7 @@ onboard_mock_relying_party_with_mock_rp_oidc_client(){ --folder 'create/publish_policy_group_and_policy' \ --folder partner-self-registration \ --folder authenticate-to-upload-certs \ + --folder authenticate-to-onboard-non-mosipid-client \ --folder upload-ca-certificate \ --folder upload-leaf-certificate \ --folder activate-partner \ diff --git a/onboarding.postman_collection.json b/onboarding.postman_collection.json index a001526..d01bfa5 100644 --- a/onboarding.postman_collection.json +++ b/onboarding.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "863ca8cb-6596-4c39-b0b2-e2ae80d5301d", + "_postman_id": "db876b6f-3b70-4a09-abf8-e4a42dd64e17", "name": "onboarding Copy", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "12620596" @@ -307,6 +307,31 @@ }, "response": [] } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "if (pm.environment.get(\"mosip-id\") == 'false' ){console.log(\"This request is skipped as eSignet is not deployed against MosipID\");\r", + "\r", + "    pm.execution.skipRequest()\r", + "}" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } ] }, { @@ -319,10 +344,7 @@ "listen": "prerequest", "script": { "exec": [ - "if (pm.environment.get(\"mosip-id\") == 'false' ){console.log(\"This request is skipped as eSignet is not deployed against MosipID\");\r", - "\r", - "    pm.execution.skipRequest()\r", - "}" + "" ], "type": "text/javascript", "packages": {} @@ -392,10 +414,7 @@ "listen": "prerequest", "script": { "exec": [ - "if (pm.environment.get(\"mosip-id\") == 'false' ){console.log(\"This request is skipped as eSignet is not deployed against MosipID\");\r", - "\r", - "    pm.execution.skipRequest()\r", - "}" + "" ], "type": "text/javascript", "packages": {} @@ -459,12 +478,7 @@ "exec": [ "const policydata = pm.iterationData.toObject();\r", "console.log(JSON.stringify(policydata));\r", - "pm.environment.set('policy-data', JSON.stringify(policydata));\r", - "if (pm.environment.get(\"mosip-id\") == 'false' ){console.log(\"This request is skipped as eSignet is not deployed against MosipID\");\r", - "\r", - "    pm.execution.skipRequest()\r", - "}\r", - "" + "pm.environment.set('policy-data', JSON.stringify(policydata));" ], "type": "text/javascript", "packages": {} @@ -541,10 +555,7 @@ "listen": "prerequest", "script": { "exec": [ - "if (pm.environment.get(\"mosip-id\") == 'false' ){console.log(\"This request is skipped as eSignet is not deployed against MosipID\");\r", - "\r", - "    pm.execution.skipRequest()\r", - "}" + "" ], "type": "text/javascript", "packages": {} @@ -592,6 +603,31 @@ }, "response": [] } + ], + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "if (pm.environment.get(\"mosip-id\") == 'false' ){console.log(\"This request is skipped as eSignet is not deployed against MosipID\");\r", + "\r", + "    pm.execution.skipRequest()\r", + "}" + ] + } + }, + { + "listen": "test", + "script": { + "type": "text/javascript", + "packages": {}, + "exec": [ + "" + ] + } + } ] }, { @@ -1347,7 +1383,10 @@ "listen": "prerequest", "script": { "exec": [ - "" + "if (pm.environment.get(\"mosip-id\") == 'false' ){console.log(\"This request is skipped as eSignet is not deployed against MosipID\");\r", + "\r", + "    pm.execution.skipRequest()\r", + "}" ], "type": "text/javascript", "packages": {} @@ -1382,6 +1421,73 @@ }, "response": [] }, + { + "name": "authenticate-to-onboard-non-mosipid-client", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var jsonData = JSON.parse(responseBody);\r", + "//var data = JSON.stringify(jsonData);\r", + "console.log(jsonData.access_token);\r", + "pm.environment.set(\"non-mosipid-token\", jsonData.access_token);" + ], + "type": "text/javascript", + "packages": {} + } + }, + { + "listen": "prerequest", + "script": { + "exec": [ + "" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "client_id", + "value": "{{module-clientid}}", + "type": "text" + }, + { + "key": "client_secret", + "value": "{{module-secretkey}}", + "type": "text" + }, + { + "key": "grant_type", + "value": "client_credentials", + "type": "text" + } + ] + }, + "url": { + "raw": "{{keycloak-url}}/auth/realms/mosip/protocol/openid-connect/token", + "host": [ + "{{keycloak-url}}" + ], + "path": [ + "auth", + "realms", + "mosip", + "protocol", + "openid-connect", + "token" + ] + } + }, + "response": [] + }, { "name": "upload-ca-certificate", "event": [ @@ -2633,7 +2739,7 @@ "pm.test(\"validating clientid\", function () {", " pm.expect(pm.response.text()).to.include(\"clientId\");", "});", - "pm.test(\"validating clientid status\", function () {", + "pm.test(\"validating client status\", function () {", " pm.expect(pm.response.text()).to.include(\"ACTIVE\");", "});", "var responseJson = pm.response.json();", @@ -2647,9 +2753,7 @@ " pm.environment.set(\"mpartner-default-mimotooidc-clientID\", responseJson.response.clientId);", "} else if (partnerKcUsername === \"esignet-sunbird-partner\") {", " pm.environment.set(\"mpartner-default-sunbirdoidc-clientID\", responseJson.response.clientId);", - "} ", - "", - "" + "} " ], "type": "text/javascript", "packages": {} @@ -2734,9 +2838,10 @@ "pm.test(\"validating clientid\", function () {\r", " pm.expect(pm.response.text()).to.include(\"clientId\");\r", "});\r", - "pm.test(\"validating clientid status\", function () {\r", + "pm.test(\"validating client status\", function () {\r", " pm.expect(pm.response.text()).to.include(\"ACTIVE\");\r", - "});" + "});\r", + "" ], "type": "text/javascript", "packages": {} @@ -2810,9 +2915,15 @@ "pm.test(\"validating clientid\", function () {\r", " pm.expect(pm.response.text()).to.include(\"clientId\");\r", "});\r", - "pm.test(\"validating clientid status\", function () {\r", + "pm.test(\"validating client status\", function () {\r", " pm.expect(pm.response.text()).to.include(\"ACTIVE\");\r", - "});" + "});\r", + "var responseJson = pm.response.json();\r", + "var partnerKcUsername = pm.variables.get(\"partner-kc-username\");\r", + "\r", + "if (partnerKcUsername === \"mpartner-default-mock-rp-oidc\") {\r", + " pm.environment.set(\"mpartner-default-demo-oidc-clientID\", responseJson.response.clientId);\r", + "}" ], "type": "text/javascript", "packages": {} @@ -2825,7 +2936,7 @@ "bearer": [ { "key": "token", - "value": "{{authtoken}}", + "value": "{{non-mosipid-token}}", "type": "string" } ] @@ -2834,7 +2945,7 @@ "header": [], "body": { "mode": "raw", - "raw": "{\r\n \"requestTime\": \"{{$isoTimestamp}}\",\r\n \"request\": {\r\n \"clientId\": \"{{oidc-clientid}}\",\r\n \"clientName\": \"{{oidc-client-name}}\",\r\n \"publicKey\":\r\n {\r\n \"kty\": \"RSA\",\r\n \"e\": \"AQAB\",\r\n \"use\": \"sig\",\r\n \"kid\": \"{{keyid}}\",\r\n \"alg\": \"RS256\",\r\n \"n\": \"{{key}}\"\r\n},\r\n \"relyingPartyId\": \"{{oidc-client-name}}\",\r\n \"userClaims\": [\r\n \"birthdate\",\r\n \"address\",\r\n \"gender\",\r\n \"name\",\r\n \"phone_number\",\r\n \"picture\",\r\n \"email\",\r\n \"individual_id\"\r\n ],\r\n \"authContextRefs\": [\r\n \"mosip:idp:acr:linked-wallet\",\r\n \"mosip:idp:acr:biometrics\",\r\n \"mosip:idp:acr:generated-code\"\r\n ],\r\n \"logoUri\": \"{{logo-uri}}\",\r\n \"redirectUris\":{{redirect_uris_array}},\r\n \"grantTypes\": [\r\n \"authorization_code\"\r\n ],\r\n \"clientAuthMethods\": [\r\n \"private_key_jwt\"\r\n ]\r\n }\r\n}", + "raw": "{\r\n \"requestTime\": \"{{$isoTimestamp}}\",\r\n \"request\": {\r\n \"clientId\": \"{{oidc-clientid}}\",\r\n \"clientName\": \"{{oidc-client-name}}\",\r\n \"publicKey\":\r\n {\r\n \"kty\": \"RSA\",\r\n \"e\": \"AQAB\",\r\n \"use\": \"sig\",\r\n \"kid\": \"{{keyid}}\",\r\n \"alg\": \"RS256\",\r\n \"n\": \"{{key}}\"\r\n},\r\n \"relyingPartyId\": \"{{oidc-clientid}}}\",\r\n \"userClaims\": [\r\n \"birthdate\",\r\n \"address\",\r\n \"gender\",\r\n \"name\",\r\n \"phone_number\",\r\n \"picture\",\r\n \"email\",\r\n \"individual_id\"\r\n ],\r\n \"authContextRefs\": [\r\n \"mosip:idp:acr:linked-wallet\",\r\n \"mosip:idp:acr:biometrics\",\r\n \"mosip:idp:acr:generated-code\"\r\n ],\r\n \"logoUri\": \"{{logo-uri}}\",\r\n \"redirectUris\":{{redirect_uris_array}},\r\n \"grantTypes\": [\r\n \"authorization_code\"\r\n ],\r\n \"clientAuthMethods\": [\r\n \"private_key_jwt\"\r\n ]\r\n }\r\n}", "options": { "raw": { "language": "json" @@ -2886,9 +2997,14 @@ "pm.test(\"validating clientid\", function () {\r", " pm.expect(pm.response.text()).to.include(\"clientId\");\r", "});\r", - "pm.test(\"validating clientid status\", function () {\r", + "pm.test(\"validating client status\", function () {\r", " pm.expect(pm.response.text()).to.include(\"ACTIVE\");\r", - "});" + "});\r", + "var responseJson = pm.response.json();\r", + "var partnerKcUsername = pm.variables.get(\"partner-kc-username\");\r", + " if (partnerKcUsername === \"esignet-sunbird-partner\") {\r", + " pm.environment.set(\"mpartner-default-sunbirdoidc-clientID\", responseJson.response.clientId);\r", + "} " ], "type": "text/javascript", "packages": {} @@ -3144,6 +3260,21 @@ }, { "name": "delete-user", + "event": [ + { + "listen": "prerequest", + "script": { + "exec": [ + "if (pm.environment.get(\"mosip-id\") == 'false' ){console.log(\"This request is skipped as eSignet is not deployed against MosipID\");\r", + "\r", + "    pm.execution.skipRequest()\r", + "}" + ], + "type": "text/javascript", + "packages": {} + } + } + ], "request": { "auth": { "type": "bearer",