diff --git a/doc/images/flows/01_Login_Admin.png b/doc/images/flows/01_Login_Admin.png new file mode 100644 index 0000000000000000000000000000000000000000..9efce4142ee9483aae2e7c5bba9efe13a9a48443 Binary files /dev/null and b/doc/images/flows/01_Login_Admin.png differ diff --git a/doc/images/flows/01_Register_of_AEF.png b/doc/images/flows/01_Register_of_AEF.png deleted file mode 100644 index 391cb43fe8657f9965c66391f716cfc06a5e9eb0..0000000000000000000000000000000000000000 Binary files a/doc/images/flows/01_Register_of_AEF.png and /dev/null differ diff --git a/doc/images/flows/01a_Register_(Only)_AEF.png b/doc/images/flows/01a_Register_(Only)_AEF.png deleted file mode 100644 index 5b6d17b181408b74fb3e15bc8276d79bf1290c39..0000000000000000000000000000000000000000 Binary files a/doc/images/flows/01a_Register_(Only)_AEF.png and /dev/null differ diff --git a/doc/images/flows/01b_Register_of_AEF_GetAuth.png b/doc/images/flows/01b_Register_of_AEF_GetAuth.png deleted file mode 100644 index 8cb5cb75839e340aeedf3349c8032fcae1fc3ce4..0000000000000000000000000000000000000000 Binary files a/doc/images/flows/01b_Register_of_AEF_GetAuth.png and /dev/null differ diff --git a/doc/images/flows/02_Register_of_User.png b/doc/images/flows/02_Register_of_User.png new file mode 100644 index 0000000000000000000000000000000000000000..ab8096c7bccade84ed3defead6f678114582d8ca Binary files /dev/null and b/doc/images/flows/02_Register_of_User.png differ diff --git a/doc/images/flows/03_Register_of_AEF_GetAuth.png b/doc/images/flows/03_Register_of_AEF_GetAuth.png new file mode 100644 index 0000000000000000000000000000000000000000..0108a8012c117a0fa3249645946d8bf9f6cc1034 Binary files /dev/null and b/doc/images/flows/03_Register_of_AEF_GetAuth.png differ diff --git a/doc/images/flows/02_AEF_API_Provider_registration.png b/doc/images/flows/04_AEF_API_Provider_registration.png similarity index 100% rename from doc/images/flows/02_AEF_API_Provider_registration.png rename to doc/images/flows/04_AEF_API_Provider_registration.png diff --git a/doc/images/flows/04_Invoker_Register.png b/doc/images/flows/04_Invoker_Register.png deleted file mode 100644 index 571f2af8098ba390a31cf5676ba0cd180b55d983..0000000000000000000000000000000000000000 Binary files a/doc/images/flows/04_Invoker_Register.png and /dev/null differ diff --git a/doc/images/flows/04a_Invoker_(Only)_Register.png b/doc/images/flows/04a_Invoker_(Only)_Register.png deleted file mode 100644 index 535d8b5baf23f43060231d20ca82c077e0959bab..0000000000000000000000000000000000000000 Binary files a/doc/images/flows/04a_Invoker_(Only)_Register.png and /dev/null differ diff --git a/doc/images/flows/04b_Invoker_Register_GetAuth.png b/doc/images/flows/04b_Invoker_Register_GetAuth.png deleted file mode 100644 index 2cb2349e0378c18f874da9442852ca1eb79deb6b..0000000000000000000000000000000000000000 Binary files a/doc/images/flows/04b_Invoker_Register_GetAuth.png and /dev/null differ diff --git a/doc/images/flows/03_AEF_Publish.png b/doc/images/flows/05_AEF_Publish.png similarity index 100% rename from doc/images/flows/03_AEF_Publish.png rename to doc/images/flows/05_AEF_Publish.png diff --git a/doc/images/flows/06_Invoker_Register_GetAuth.png b/doc/images/flows/06_Invoker_Register_GetAuth.png new file mode 100644 index 0000000000000000000000000000000000000000..5e6aa97d892411cfc1ba6fb4e3a8693c63f2b5d4 Binary files /dev/null and b/doc/images/flows/06_Invoker_Register_GetAuth.png differ diff --git a/doc/images/flows/05_Invoker_Onboarding.png b/doc/images/flows/07_Invoker_Onboarding.png similarity index 100% rename from doc/images/flows/05_Invoker_Onboarding.png rename to doc/images/flows/07_Invoker_Onboarding.png diff --git a/doc/images/flows/06_Invoker_Discover_AEF.png b/doc/images/flows/08_Invoker_Discover_AEF.png similarity index 100% rename from doc/images/flows/06_Invoker_Discover_AEF.png rename to doc/images/flows/08_Invoker_Discover_AEF.png diff --git a/doc/images/flows/07_Invoker_Create_Security_Context.png b/doc/images/flows/09_Invoker_Create_Security_Context.png similarity index 100% rename from doc/images/flows/07_Invoker_Create_Security_Context.png rename to doc/images/flows/09_Invoker_Create_Security_Context.png diff --git a/doc/images/flows/08_Invoker_Get_Token.png b/doc/images/flows/10_Invoker_Get_Token.png similarity index 100% rename from doc/images/flows/08_Invoker_Get_Token.png rename to doc/images/flows/10_Invoker_Get_Token.png diff --git a/doc/images/flows/09_Invoker_Send_Request_to_AEF_Service_API.png b/doc/images/flows/11_Invoker_Send_Request_to_AEF_Service_API.png similarity index 100% rename from doc/images/flows/09_Invoker_Send_Request_to_AEF_Service_API.png rename to doc/images/flows/11_Invoker_Send_Request_to_AEF_Service_API.png diff --git a/doc/testing/postman/CAPIF.postman_collection.json b/doc/testing/postman/CAPIF.postman_collection.json index dcbd5adbd0b6688caed14dfcb104e4519413f156..4f4ba37f91eee28896bbf4974c51b9a0d8b84f73 100644 --- a/doc/testing/postman/CAPIF.postman_collection.json +++ b/doc/testing/postman/CAPIF.postman_collection.json @@ -1,35 +1,94 @@ { "info": { - "_postman_id": "5cfdf0d7-3b3c-4961-9cb9-84c2bf85056c", + "_postman_id": "b512e528-4b13-4be2-aed2-a61a8381360e", "name": "CAPIF", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "31608242", - "_collection_link": "https://red-comet-993867.postman.co/workspace/Team-Workspace~bfc7c442-a60c-4bb1-8730-fdabc2df89b9/collection/31608242-5cfdf0d7-3b3c-4961-9cb9-84c2bf85056c?action=share&source=collection_link&creator=31608242" + "_collection_link": "https://red-comet-993867.postman.co/workspace/Team-Workspace~bfc7c442-a60c-4bb1-8730-fdabc2df89b9/collection/31608242-b512e528-4b13-4be2-aed2-a61a8381360e?action=share&source=collection_link&creator=31608242" }, "item": [ { - "name": "01-register_user_provider", + "name": "01-login_admin", "event": [ { "listen": "test", "script": { "exec": [ "var res = JSON.parse(responseBody);", - "pm.environment.set('ONBOARDING_URL', res.ccf_api_onboarding_url);", - "pm.environment.set('PUBLISH_URL', res.ccf_publish_url);", - "pm.environment.set('USER_ID', res.id);", + "", + "pm.environment.set('REFRESH_TOKEN', res.refresh_token);", + "pm.environment.set('ADMIN_TOKEN', res.access_token);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{ADMIN_PASSWORD}}", + "type": "string" + }, + { + "key": "username", + "value": "{{ADMIN_USER}}", + "type": "string" + } + ] + }, + "method": "POST", + "header": [], + "url": { + "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/login", + "protocol": "https", + "host": [ + "{{REGISTER_HOSTNAME}}" + ], + "port": "{{REGISTER_PORT}}", + "path": [ + "login" + ] + } + }, + "response": [] + }, + { + "name": "02-create_user", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var res = JSON.parse(responseBody);", + "", + "pm.environment.set('USER_UUID', res.uuid);", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{ADMIN_TOKEN}}", + "type": "string" + } + ] + }, "method": "POST", "header": [], "body": { "mode": "raw", - "raw": "{\n\"password\": \"{{PASSWORD}}\",\n\"username\": \"{{USERNAME}}\",\n\"description\": \"provider\",\n\"role\": \"provider\",\n\"cn\": \"provider\"\n}", + "raw": "{\n \"username\": \"{{USER_NAME}}\",\n \"password\": \"{{USER_PASSWORD}}\",\n \"description\": \"PepeDescription\",\n \"email\": \"pepe@gmail.com\"\n}", "options": { "raw": { "language": "json" @@ -37,21 +96,21 @@ } }, "url": { - "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/register", + "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/createUser", "protocol": "https", "host": [ "{{REGISTER_HOSTNAME}}" ], "port": "{{REGISTER_PORT}}", "path": [ - "register" + "createUser" ] } }, "response": [] }, { - "name": "02-getauth_provider", + "name": "03-getauth", "event": [ { "listen": "test", @@ -61,6 +120,11 @@ "", "pm.environment.set('CA_ROOT', res.ca_root);", "pm.environment.set('ACCESS_TOKEN', res.access_token);", + "pm.environment.set('ONBOARDING_URL', res.ccf_api_onboarding_url);", + "pm.environment.set('PUBLISH_URL', res.ccf_publish_url);", + "pm.environment.set('DISCOVER_URL', res.ccf_discover_url);", + "pm.environment.set('SECURITY_URL', res.ccf_security_url);", + "pm.environment.set('ONBOARDING_URL_INVOKER', res.ccf_onboarding_url);", "", "setTimeout(() => {", " pm.sendRequest({", @@ -77,22 +141,29 @@ " });", " }, 5000);" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\"password\": \"{{PASSWORD}}\",\n\"username\": \"{{USERNAME}}\"\n}", - "options": { - "raw": { - "language": "json" + "auth": { + "type": "basic", + "basic": [ + { + "key": "password", + "value": "{{USER_PASSWORD}}", + "type": "string" + }, + { + "key": "username", + "value": "{{USER_NAME}}", + "type": "string" } - } + ] }, + "method": "GET", + "header": [], "url": { "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/getauth", "protocol": "https", @@ -108,7 +179,7 @@ "response": [] }, { - "name": "03-onboard_provider", + "name": "04-onboard_provider", "event": [ { "listen": "test", @@ -220,7 +291,7 @@ "response": [] }, { - "name": "04-publish_api", + "name": "05-publish_api", "event": [ { "listen": "prerequest", @@ -299,107 +370,7 @@ "response": [] }, { - "name": "05-register_user_invoker", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var res = JSON.parse(responseBody);", - "pm.environment.set('ONBOARDING_URL_INVOKER', res.ccf_onboarding_url);", - "pm.environment.set('DISCOVER_URL', res.ccf_discover_url);", - "pm.environment.set('USER_INVOKER_ID', res.id);", - "" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\"password\": \"{{PASSWORD}}\",\n\"username\": \"{{USERNAME_INVOKER}}\",\n\"description\": \"invoker\",\n\"role\": \"invoker\",\n\"cn\": \"invoker\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/register", - "protocol": "https", - "host": [ - "{{REGISTER_HOSTNAME}}" - ], - "port": "{{REGISTER_PORT}}", - "path": [ - "register" - ] - } - }, - "response": [] - }, - { - "name": "06-getauth_invoker", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "var res = JSON.parse(responseBody);", - "", - "pm.environment.set('CA_ROOT', res.ca_root);", - "pm.environment.set('ACCESS_TOKEN_INVOKER', res.access_token);", - "", - "setTimeout(() => {", - " pm.sendRequest({", - " url: 'http://localhost:3000/write_ca',", - " method: 'POST',", - " header: 'Content-Type:application/json',", - " encoding: 'binary',", - " body: {", - " mode: 'raw',", - " raw: res", - " }", - " }, function (err, res) {", - " console.log(res);", - " });", - " }, 5000);" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\"password\": \"{{PASSWORD}}\",\n\"username\": \"{{USERNAME_INVOKER}}\"\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "url": { - "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/getauth", - "protocol": "https", - "host": [ - "{{REGISTER_HOSTNAME}}" - ], - "port": "{{REGISTER_PORT}}", - "path": [ - "getauth" - ] - } - }, - "response": [] - }, - { - "name": "07-onboard_invoker", + "name": "06-onboard_invoker", "event": [ { "listen": "test", @@ -415,7 +386,8 @@ "", "" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } }, { @@ -446,7 +418,8 @@ "", "pm.request.body.raw = res;" ], - "type": "text/javascript" + "type": "text/javascript", + "packages": {} } } ], @@ -456,7 +429,7 @@ "bearer": [ { "key": "token", - "value": "{{ACCESS_TOKEN_INVOKER}}", + "value": "{{ACCESS_TOKEN}}", "type": "string" } ] @@ -493,7 +466,7 @@ "response": [] }, { - "name": "08-discover", + "name": "07-discover", "event": [ { "listen": "prerequest", @@ -581,7 +554,7 @@ "response": [] }, { - "name": "09-security_context", + "name": "08-security_context", "event": [ { "listen": "prerequest", @@ -660,7 +633,7 @@ "response": [] }, { - "name": "10-get_token", + "name": "09-get_token", "event": [ { "listen": "prerequest", @@ -760,7 +733,7 @@ "response": [] }, { - "name": "11-call_service", + "name": "10-call_service", "event": [ { "listen": "prerequest", @@ -806,7 +779,7 @@ ], "body": { "mode": "raw", - "raw": "{\n\"name\": \"{{USERNAME_INVOKER}}\"\n}", + "raw": "{\n\"name\": {{USERNAME_INVOKER}}\n}", "options": { "raw": { "language": "json" @@ -923,13 +896,23 @@ "response": [] }, { - "name": "remove_user_invoker", + "name": "remove_user", "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{ADMIN_TOKEN}}", + "type": "string" + } + ] + }, "method": "DELETE", "header": [], "body": { "mode": "raw", - "raw": "{\n\"password\": \"{{PASSWORD}}\",\n\"username\": \"{{USERNAME_INVOKER}}\"\n}", + "raw": "", "options": { "raw": { "language": "json" @@ -937,42 +920,58 @@ } }, "url": { - "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/remove", + "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/deleteUser/{{USER_UUID}}", "protocol": "https", "host": [ "{{REGISTER_HOSTNAME}}" ], "port": "{{REGISTER_PORT}}", "path": [ - "remove" + "deleteUser", + "{{USER_UUID}}" ] } }, "response": [] }, { - "name": "remove_user_provider", + "name": "refresh_admin_token", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "var res = JSON.parse(responseBody);", + "", + "pm.environment.set('REFRESH_TOKEN', res.refresh_token);" + ], + "type": "text/javascript", + "packages": {} + } + } + ], "request": { - "method": "DELETE", - "header": [], - "body": { - "mode": "raw", - "raw": "{\n\"password\": \"{{PASSWORD}}\",\n\"username\": \"{{USERNAME}}\"\n}", - "options": { - "raw": { - "language": "json" + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{REFRESH_TOKEN}}", + "type": "string" } - } + ] }, + "method": "GET", + "header": [], "url": { - "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/remove", + "raw": "https://{{REGISTER_HOSTNAME}}:{{REGISTER_PORT}}/refresh", "protocol": "https", "host": [ "{{REGISTER_HOSTNAME}}" ], "port": "{{REGISTER_PORT}}", "path": [ - "remove" + "refresh" ] } }, diff --git a/doc/testing/postman/CAPIF.postman_environment.json b/doc/testing/postman/CAPIF.postman_environment.json index fd084b3c9a3bedd57ac8b3c388eed1a219aac9e8..edb56350236e508cac6810f1a7acd7f7353bc1ca 100644 --- a/doc/testing/postman/CAPIF.postman_environment.json +++ b/doc/testing/postman/CAPIF.postman_environment.json @@ -1,5 +1,5 @@ { - "id": "f2daf431-63c4-4275-8755-4cc5de2e566d", + "id": "6c75108a-36b0-43b2-98b7-297b0b827a54", "name": "CAPIF", "values": [ { @@ -32,12 +32,6 @@ "type": "default", "enabled": true }, - { - "key": "USERNAME_INVOKER", - "value": "InvokerONE", - "type": "default", - "enabled": true - }, { "key": "PASSWORD", "value": "pass", @@ -57,115 +51,145 @@ "enabled": true }, { - "key": "ONBOARDING_URL", + "key": "ADMIN_USER", + "value": "admin", + "type": "default", + "enabled": true + }, + { + "key": "ADMIN_PASSWORD", + "value": "password123", + "type": "default", + "enabled": true + }, + { + "key": "ADMIN_TOKEN", "value": "", - "type": "any", + "type": "default", "enabled": true }, { - "key": "PUBLISH_URL", + "key": "REFRESH_TOKEN", "value": "", - "type": "any", + "type": "default", + "enabled": true + }, + { + "key": "USER_NAME", + "value": "Bob", + "type": "default", "enabled": true }, { - "key": "USER_ID", + "key": "USER_PASSWORD", + "value": "1234", + "type": "default", + "enabled": true + }, + { + "key": "USER_UUID", "value": "", "type": "any", "enabled": true }, { - "key": "CA_ROOT", + "key": "ONBOARDING_URL", "value": "", "type": "any", "enabled": true }, { - "key": "ACCESS_TOKEN", + "key": "PUBLISH_URL", "value": "", "type": "any", "enabled": true }, { - "key": "APF_KEY", + "key": "ONBOARDING_URL_INVOKER", "value": "", "type": "any", "enabled": true }, { - "key": "AMF_KEY", + "key": "DISCOVER_URL", "value": "", "type": "any", "enabled": true }, { - "key": "AEF_KEY", + "key": "SECURITY_URL", + "value": "", + "type": "default", + "enabled": true + }, + { + "key": "CA_ROOT", "value": "", "type": "any", "enabled": true }, { - "key": "PROVIDER_ID", + "key": "ACCESS_TOKEN", "value": "", "type": "any", "enabled": true }, { - "key": "AEF_ID", + "key": "APF_KEY", "value": "", "type": "any", "enabled": true }, { - "key": "AEF_CERT", + "key": "AMF_KEY", "value": "", "type": "any", "enabled": true }, { - "key": "APF_ID", + "key": "AEF_KEY", "value": "", "type": "any", "enabled": true }, { - "key": "APF_CERT", + "key": "PROVIDER_ID", "value": "", "type": "any", "enabled": true }, { - "key": "AMF_ID", + "key": "AEF_ID", "value": "", "type": "any", "enabled": true }, { - "key": "AMF_CERT", + "key": "AEF_CERT", "value": "", "type": "any", "enabled": true }, { - "key": "ONBOARDING_URL_INVOKER", + "key": "APF_ID", "value": "", "type": "any", "enabled": true }, { - "key": "DISCOVER_URL", + "key": "APF_CERT", "value": "", "type": "any", "enabled": true }, { - "key": "USER_INVOKER_ID", + "key": "AMF_ID", "value": "", "type": "any", "enabled": true }, { - "key": "ACCESS_TOKEN_INVOKER", + "key": "AMF_CERT", "value": "", "type": "any", "enabled": true @@ -238,6 +262,6 @@ } ], "_postman_variable_scope": "environment", - "_postman_exported_at": "2023-12-20T10:47:32.128Z", - "_postman_exported_using": "Postman/10.21.4" + "_postman_exported_at": "2024-04-22T06:53:35.508Z", + "_postman_exported_using": "Postman/10.24.19" } \ No newline at end of file diff --git a/doc/testing/postman/README.md b/doc/testing/postman/README.md index fbe18f44d7744f1c45a18a9c944838a53332ab17..78a44414e6fc42834e8b2cd9a951101915e6d201 100644 --- a/doc/testing/postman/README.md +++ b/doc/testing/postman/README.md @@ -43,17 +43,25 @@ CAPIF_HOSTNAME capifcore ## CAPIF Flows Once the first steps have been taken, we can now use Postman requests. These requests are numbered in the order that must be followed to obtain everything necessary from CAPIF. -### Publication of an API +### Creation of an user + +The first step would be for an administrator to create a user with which a provider and an invoker will be created. + +#### **01-Login_admin** + + -#### **01-register_user_provider** +#### **02-Register of User** -_AEF.png) + -#### **02-getauth_provider** +### Publication of an API + +#### **03-getauth_provider** - + -#### **03-onboard_provider** +#### **04-onboard_provider**  @@ -67,7 +75,7 @@ To configure go to **settings** in Postman and open the **certificates** section Once this is done, the node script will be in charge of changing the certificate that is necessary in each request. -#### **04-publish_api** +#### **05-publish_api**  @@ -83,13 +91,9 @@ With this the provider part would be finished. ### Calling the API -#### **05-register_user_invoker** - -_Register.png) - #### **06-getauth_invoker** - + #### **07-onboard_invoker**