From 625ecd8c72e1d6c8e3238b85d872d3ce22a992f0 Mon Sep 17 00:00:00 2001 From: Mahesh-Binayak <76687012+mahesh-binayak@users.noreply.github.com> Date: Tue, 3 Dec 2024 15:41:40 +0530 Subject: [PATCH 1/6] [DSD-6742]added new auth api for esignet Signed-off-by: Mahesh.Binayak --- default.sh | 1 + onboarding.postman_collection.json | 148 +++++++++++++++++++++++++---- 2 files changed, 128 insertions(+), 21 deletions(-) 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..5921d12 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": "ef4e8a89-ad21-4eae-bff5-77a6b276e81e", "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": [ @@ -2825,7 +2931,7 @@ "bearer": [ { "key": "token", - "value": "{{authtoken}}", + "value": "{{non-mosipid-token}}", "type": "string" } ] From 3afe2db7351186f825892967ef1bf59ae6a8969a Mon Sep 17 00:00:00 2001 From: Mahesh-Binayak <76687012+mahesh-binayak@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:21:03 +0530 Subject: [PATCH 2/6] [DSD-6742]added new auth api for esignet Signed-off-by: Mahesh.Binayak --- onboarding.postman_collection.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onboarding.postman_collection.json b/onboarding.postman_collection.json index 5921d12..abaa964 100644 --- a/onboarding.postman_collection.json +++ b/onboarding.postman_collection.json @@ -2864,7 +2864,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 \r\n ],\r\n \"authContextRefs\": [\r\n \"mosip:idp:acr:id-token\"\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 \r\n ],\r\n \"authContextRefs\": [\r\n \"mosip:idp:acr:id-token\"\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" From 307a3257ee2615e513a14957fbdb38a3a13a25ce Mon Sep 17 00:00:00 2001 From: Mahesh-Binayak <76687012+mahesh-binayak@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:52:43 +0530 Subject: [PATCH 3/6] [DSD-6742]added new auth api for esignet Signed-off-by: Mahesh.Binayak --- onboarding.postman_collection.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/onboarding.postman_collection.json b/onboarding.postman_collection.json index abaa964..e25018d 100644 --- a/onboarding.postman_collection.json +++ b/onboarding.postman_collection.json @@ -1,6 +1,6 @@ { "info": { - "_postman_id": "ef4e8a89-ad21-4eae-bff5-77a6b276e81e", + "_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" @@ -2864,7 +2864,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-clientid}}\",\r\n \"userClaims\": [\r\n \r\n ],\r\n \"authContextRefs\": [\r\n \"mosip:idp:acr:id-token\"\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-client-name}}\",\r\n \"userClaims\": [\r\n \r\n ],\r\n \"authContextRefs\": [\r\n \"mosip:idp:acr:id-token\"\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" @@ -2940,7 +2940,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" From 7a455078bc7d8e9a8b46ca5e26f7c12f1eec0f42 Mon Sep 17 00:00:00 2001 From: Mahesh-Binayak <76687012+mahesh-binayak@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:01:47 +0530 Subject: [PATCH 4/6] [DSD-6742]added new auth api for esignet Signed-off-by: Mahesh.Binayak --- onboarding.postman_collection.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/onboarding.postman_collection.json b/onboarding.postman_collection.json index e25018d..e75e688 100644 --- a/onboarding.postman_collection.json +++ b/onboarding.postman_collection.json @@ -3250,6 +3250,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", From e832ef41f17005ef9d6e2ed39813ed9f0aa815ed Mon Sep 17 00:00:00 2001 From: Mahesh-Binayak <76687012+mahesh-binayak@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:10:07 +0530 Subject: [PATCH 5/6] [DSD-6742]added new auth api for esignet Signed-off-by: Mahesh.Binayak --- onboarding.postman_collection.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/onboarding.postman_collection.json b/onboarding.postman_collection.json index e75e688..e768b74 100644 --- a/onboarding.postman_collection.json +++ b/onboarding.postman_collection.json @@ -2747,12 +2747,6 @@ "", "if (partnerKcUsername === \"mpartner-default-mock-rp-oidc\") {", " pm.environment.set(\"mpartner-default-demo-oidc-clientID\", responseJson.response.clientId);", - "} else if (partnerKcUsername === \"mpartner-default-resident-oidc\") {", - " pm.environment.set(\"mpartner-default-resident-oidc-clientID\", responseJson.response.clientId);", - "} else if (partnerKcUsername === \"mpartner-default-mimotooidc\") {", - " 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);", "} ", "", "" From f0c510f199dd02199a9318ff6eb59286906e64ce Mon Sep 17 00:00:00 2001 From: Mahesh-Binayak <76687012+mahesh-binayak@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:06:24 +0530 Subject: [PATCH 6/6] [DSD-6742]added new auth api for esignet Signed-off-by: Mahesh.Binayak --- onboarding.postman_collection.json | 36 +++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/onboarding.postman_collection.json b/onboarding.postman_collection.json index e768b74..d01bfa5 100644 --- a/onboarding.postman_collection.json +++ b/onboarding.postman_collection.json @@ -2739,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();", @@ -2747,9 +2747,13 @@ "", "if (partnerKcUsername === \"mpartner-default-mock-rp-oidc\") {", " pm.environment.set(\"mpartner-default-demo-oidc-clientID\", responseJson.response.clientId);", - "} ", - "", - "" + "} else if (partnerKcUsername === \"mpartner-default-resident-oidc\") {", + " pm.environment.set(\"mpartner-default-resident-oidc-clientID\", responseJson.response.clientId);", + "} else if (partnerKcUsername === \"mpartner-default-mimotooidc\") {", + " 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": {} @@ -2834,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": {} @@ -2910,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": {} @@ -2986,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": {}