Skip to content
Snippets Groups Projects
Commit 24212fef authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Merge branch '5-postman-update-with-the-new-register' into 'develop'

Update 3 files

See merge request ocf/documentation!3
parents 51c794ea f2da7416
No related branches found
No related tags found
1 merge request!3Update 3 files
Pipeline #7953 passed
Showing
with 229 additions and 198 deletions
doc/images/flows/01_Login_Admin.png

28.3 KiB

doc/images/flows/01_Register_of_AEF.png

69.9 KiB

doc/images/flows/01a_Register_(Only)_AEF.png

50.9 KiB

doc/images/flows/01b_Register_of_AEF_GetAuth.png

38 KiB

doc/images/flows/02_Creation_of_user.png

46.7 KiB

doc/images/flows/03_Register_of_AEF_GetAuth.png

44.8 KiB

doc/images/flows/04_Invoker_Register.png

70 KiB

doc/images/flows/04a_Invoker_(Only)_Register.png

50.8 KiB

doc/images/flows/04b_Invoker_Register_GetAuth.png

38.1 KiB

doc/images/flows/06_Invoker_Register_GetAuth.png

49.5 KiB

{
"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"
]
}
},
......
{
"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
......@@ -43,19 +43,29 @@ 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 User by Admin
The first step would be for an administrator to create a user with which a provider and an invoker will be created. To do this, the admin must log in to obtain the token needed in admin requests.
#### **01-Login_admin**
![Flow](../../images/flows/01_Login_Admin.png)
#### **01-register_user_provider**
#### **02-Creation of User**
![Flow](../../images/flows/01a_Register_(Only)_AEF.png)
![Flow](../../images/flows/02_Creation_of_user.png)
#### **02-getauth_provider**
### Publication of an API
The next step is to register a provider using the user created by the administrator in order to publish an API.
![Flow](../../images/flows/01b_Register_of_AEF_GetAuth.png)
#### **03-getauth_provider**
#### **03-onboard_provider**
![Flow](../../images/flows/03_Register_of_AEF_GetAuth.png)
![Flow](../../images/flows/02_AEF_API_Provider_registration.png)
#### **04-onboard_provider**
![Flow](../../images/flows/04_AEF_API_Provider_registration.png)
At this point we move on to using certificate authentication in CAPIF. In Postman it is necessary to add the certificates manually and using more than one certificate for the same host as we do in CAPIF complicates things. For this reason, we use the script to overwrite a certificate and a key when it is necessary to have a specific one.
......@@ -67,9 +77,9 @@ 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**
![Flow](../../images/flows/03_AEF_Publish.png)
![Flow](../../images/flows/05_AEF_Publish.png)
Once the api is published, we can start it. In this case we have a test one created in python called <a href="./hello_api.py" download>hello_api.py</a> that can be executed with the following command:
......@@ -83,35 +93,33 @@ With this the provider part would be finished.
### Calling the API
#### **05-register_user_invoker**
![Flow](../../images/flows/04a_Invoker_(Only)_Register.png)
Finally, we will create an invoker with the user given by the administrator to be able to use the published api.
#### **06-getauth_invoker**
![Flow](../../images/flows/04b_Invoker_Register_GetAuth.png)
![Flow](../../images/flows/06_Invoker_Register_GetAuth.png)
#### **07-onboard_invoker**
![Flow](../../images/flows/05_Invoker_Onboarding.png)
![Flow](../../images/flows/07_Invoker_Onboarding.png)
At this point we move on to using certificate authentication in CAPIF. **If you did not configure the provider's certificates, you would have to do it now**.
#### **08-discover**
![Flow](../../images/flows/06_Invoker_Discover_AEF.png)
![Flow](../../images/flows/08_Invoker_Discover_AEF.png)
#### **09-security_context**
![Flow](../../images/flows/07_Invoker_Create_Security_Context.png)
![Flow](../../images/flows/09_Invoker_Create_Security_Context.png)
#### **10-get_token**
![Flow](../../images/flows/08_Invoker_Get_Token.png)
![Flow](../../images/flows/10_Invoker_Get_Token.png)
#### **11-call_service**
![Flow](../../images/flows/09_Invoker_Send_Request_to_AEF_Service_API.png)
![Flow](../../images/flows/11_Invoker_Send_Request_to_AEF_Service_API.png)
With this, we would have made the API call and finished the flow.
......@@ -121,8 +129,8 @@ Other requests that we have added are the following:
- **offboard_provider** Performs offboarding of the provider, thereby eliminating the published APIs.
- **offboard_invoker** Offboards the invoker, also eliminating access to the APIs of that invoker.
- **remove_user_invoker** Delete the user created for the invoker.
- **remove_user_provider** Delete the user created for the provider.
- **remove_user** Delete the user.
- **refresh_admin_token** Return a new access token to the admin.
## Notes
......
  • yangalicace1 @caceres1

    mentioned in commit e2e7f330

    By Jorge Moratinos on 2024-04-22T14:55:29 (imported from GitLab)

    ·

    mentioned in commit e2e7f330

    By Jorge Moratinos on 2024-04-22T14:55:29 (imported from GitLab)

    Toggle commit list
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment