Loading app_template.py +6 −18 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from flask import Flask, jsonify, request app = Flask(__name__) OBJ_FILE = "discoverer.pkl" OBJ_FILE_INV = "invoker.pkl" user_name = os.getenv("USER_NAME", "test") Loading @@ -21,6 +22,11 @@ def onboard(): ### Uncomment to print the Invoker ID # with open("./invoker_info/{0}/capif_api_security_context_details-{0}.json".format(user_name), "rb") as f: # d = json.load(f) ### Uncomment, fill the ... with the object and store invoker object # with open(OBJ_FILE_INV, 'wb') as f: # pickle.dump(invoker, f) # response_message = "Invoker onboarded with ID: {}".format(d['api_invoker_id']) return response_message Loading @@ -45,24 +51,6 @@ def discover(): return response_message @app.get("/getauth") def getauth(): response_message = "Get authorization to service API" ### Uncomment, fill the ... with a preferred variable name and fetch the discoverer object # if not os.path.exists(OBJ_FILE): # return "No session found.", 404 # with open(OBJ_FILE, 'rb') as f: # ... = pickle.load(f) ### Create Security Context and get API token for the discovered API # jwt_token = ... ### Uncomment to return the token # response_message = "Get authorization to service API: {}".format(jwt_token) return response_message @app.post("/access") def access_service(): response_message = "Access" Loading invoker.postman_collection.json +2 −21 Original line number Diff line number Diff line { "info": { "_postman_id": "783ff25d-3ff4-4ae5-a56b-1edeea129358", "_postman_id": "6261c92a-9424-493b-a3d6-8cadab7d4df2", "name": "APIs", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "31915954", "_collection_link": "https://go.postman.co/collection/31915954-783ff25d-3ff4-4ae5-a56b-1edeea129358?source=collection_link" "_collection_link": "https://go.postman.co/collection/31915954-6261c92a-9424-493b-a3d6-8cadab7d4df2?source=collection_link" }, "item": [ { Loading Loading @@ -64,25 +64,6 @@ }, "response": [] }, { "name": "Get Authorization", "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8001/getauth", "protocol": "http", "host": [ "localhost" ], "port": "8001", "path": [ "getauth" ] } }, "response": [] }, { "name": "Testing API", "request": { Loading Loading
app_template.py +6 −18 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from flask import Flask, jsonify, request app = Flask(__name__) OBJ_FILE = "discoverer.pkl" OBJ_FILE_INV = "invoker.pkl" user_name = os.getenv("USER_NAME", "test") Loading @@ -21,6 +22,11 @@ def onboard(): ### Uncomment to print the Invoker ID # with open("./invoker_info/{0}/capif_api_security_context_details-{0}.json".format(user_name), "rb") as f: # d = json.load(f) ### Uncomment, fill the ... with the object and store invoker object # with open(OBJ_FILE_INV, 'wb') as f: # pickle.dump(invoker, f) # response_message = "Invoker onboarded with ID: {}".format(d['api_invoker_id']) return response_message Loading @@ -45,24 +51,6 @@ def discover(): return response_message @app.get("/getauth") def getauth(): response_message = "Get authorization to service API" ### Uncomment, fill the ... with a preferred variable name and fetch the discoverer object # if not os.path.exists(OBJ_FILE): # return "No session found.", 404 # with open(OBJ_FILE, 'rb') as f: # ... = pickle.load(f) ### Create Security Context and get API token for the discovered API # jwt_token = ... ### Uncomment to return the token # response_message = "Get authorization to service API: {}".format(jwt_token) return response_message @app.post("/access") def access_service(): response_message = "Access" Loading
invoker.postman_collection.json +2 −21 Original line number Diff line number Diff line { "info": { "_postman_id": "783ff25d-3ff4-4ae5-a56b-1edeea129358", "_postman_id": "6261c92a-9424-493b-a3d6-8cadab7d4df2", "name": "APIs", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "31915954", "_collection_link": "https://go.postman.co/collection/31915954-783ff25d-3ff4-4ae5-a56b-1edeea129358?source=collection_link" "_collection_link": "https://go.postman.co/collection/31915954-6261c92a-9424-493b-a3d6-8cadab7d4df2?source=collection_link" }, "item": [ { Loading Loading @@ -64,25 +64,6 @@ }, "response": [] }, { "name": "Get Authorization", "request": { "method": "GET", "header": [], "url": { "raw": "http://localhost:8001/getauth", "protocol": "http", "host": [ "localhost" ], "port": "8001", "path": [ "getauth" ] } }, "response": [] }, { "name": "Testing API", "request": { Loading