Skip to content

Commit 2335e51

Browse files
Milestone 1.7.0 fix/authx pro wrong policy xml (#77)
Co-authored-by: Copilot <[email protected]>
1 parent 27b99c2 commit 2335e51

File tree

22 files changed

+275
-91
lines changed

22 files changed

+275
-91
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _Try it out, learn from it, apply it in your setups._
2222
|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2323
| [Simple API Management](./infrastructure/simple-apim) | Just the basics with a publicly accessible API Management instance fronting your APIs. This is the innermost way to experience and experiment with the APIM policies. |
2424
| [API Management & Container Apps](./infrastructure/apim-aca) | APIs are often implemented in containers running in Azure Container Apps. This architecture accesses the container apps publicly. It's beneficial to test both APIM and container app URLs here to contrast and compare experiences of API calls through and bypassing APIM. It is not intended to be a security baseline. |
25-
| [Secure Front Door & API Management & Container Apps](./infrastructure/afd-apim) | A higher-fidelity implementation of a secured setup in which Azure Front Door connects to APIM via the new private link integration. This traffic, once it traverses through Front Door, rides entirely on Microsoft-owned and operated networks. Similarly, the connection from APIM to Container Apps is secured but through a VNet configuration (it is also entirely possible to do this via private link). APIM Standard V2 is used here to accept a private link from Front Door. |
25+
| [Secure Front Door & API Management & Container Apps](./infrastructure/afd-apim-pe) | A higher-fidelity implementation of a secured setup in which Azure Front Door connects to APIM via the new private link integration. This traffic, once it traverses through Front Door, rides entirely on Microsoft-owned and operated networks. Similarly, the connection from APIM to Container Apps is secured but through a VNet configuration (it is also entirely possible to do this via private link). APIM Standard V2 is used here to accept a private link from Front Door. |
2626

2727
## 📁 List of Samples
2828

@@ -291,4 +291,4 @@ Furthermore, [Houssem Dellai](https://github.com/HoussemDellai) was instrumental
291291

292292
[Andrew Redman](https://github.com/anotherRedbeard) for contributing the _Azure Maps_ sample.
293293

294-
The original author of this project is [Simon Kurtz](https://github.com/simonkurtz-msft).
294+
The original author of this project is [Simon Kurtz](https://github.com/simonkurtz-msft).

infrastructure/afd-apim-pe/create.ipynb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,17 @@
3838
" PolicyFragment('AuthZ-Match-All', utils.read_policy_xml(utils.determine_shared_policy_path('pf-authz-match-all.xml')), 'Authorizes if all of the specified roles match the JWT role claims.'),\n",
3939
" PolicyFragment('AuthZ-Match-Any', utils.read_policy_xml(utils.determine_shared_policy_path('pf-authz-match-any.xml')), 'Authorizes if any of the specified roles match the JWT role claims.'),\n",
4040
" PolicyFragment('Http-Response-200', utils.read_policy_xml(utils.determine_shared_policy_path('pf-http-response-200.xml')), 'Returns a 200 OK response for the current HTTP method.'),\n",
41+
" PolicyFragment('Product-Match-Any', utils.read_policy_xml(utils.determine_shared_policy_path('pf-product-match-any.xml')), 'Proceeds if any of the specified products match the context product name.'),\n",
4142
" PolicyFragment('Remove-Request-Headers', utils.read_policy_xml(utils.determine_shared_policy_path('pf-remove-request-headers.xml')), 'Removes request headers from the incoming request.')\n",
4243
"]\n",
4344
"\n",
4445
"# 4) Define the APIs and their operations and policies\n",
4546
"\n",
4647
"# Policies\n",
47-
"hello_world_policy_xml = utils.read_policy_xml(HELLO_WORLD_XML_POLICY_PATH)\n",
48+
"pol_hello_world = utils.read_policy_xml(HELLO_WORLD_XML_POLICY_PATH)\n",
4849
"\n",
4950
"# Hello World (Root)\n",
50-
"api_hwroot_get = GET_APIOperation('This is a GET for API 1', hello_world_policy_xml)\n",
51+
"api_hwroot_get = GET_APIOperation('This is a GET for API 1', pol_hello_world)\n",
5152
"api_hwroot = API('hello-world', 'Hello World', '', 'This is the root API for Hello World', operations = [api_hwroot_get])\n",
5253
"\n",
5354
"apis: List[API] = [api_hwroot]\n",
@@ -56,22 +57,22 @@
5657
"if use_ACA:\n",
5758
" utils.print_info('ACA APIs will be created.')\n",
5859
"\n",
59-
" backend_policy_xml = utils.read_policy_xml(BACKEND_XML_POLICY_PATH)\n",
60-
" aca_backend_1_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-1')\n",
61-
" aca_backend_2_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-2')\n",
62-
" aca_backend_pool_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-pool')\n",
60+
" pol_backend = utils.read_policy_xml(BACKEND_XML_POLICY_PATH)\n",
61+
" pol_aca_backend_1 = pol_backend.format(backend_id = 'aca-backend-1')\n",
62+
" pol_aca_backend_2 = pol_backend.format(backend_id = 'aca-backend-2')\n",
63+
" pol_aca_backend_pool = pol_backend.format(backend_id = 'aca-backend-pool')\n",
6364
"\n",
6465
" # Hello World (ACA Backend 1)\n",
6566
" api_hwaca_1_get = GET_APIOperation('This is a GET for Hello World on ACA Backend 1')\n",
66-
" api_hwaca_1 = API('hello-world-aca-1', 'Hello World (ACA 1)', '/aca-1', 'This is the ACA API for Backend 1', policyXml = aca_backend_1_policy_xml, operations = [api_hwaca_1_get])\n",
67+
" api_hwaca_1 = API('hello-world-aca-1', 'Hello World (ACA 1)', '/aca-1', 'This is the ACA API for Backend 1', policyXml = pol_aca_backend_1, operations = [api_hwaca_1_get])\n",
6768
"\n",
6869
" # Hello World (ACA Backend 2)\n",
6970
" api_hwaca_2_get = GET_APIOperation('This is a GET for Hello World on ACA Backend 2')\n",
70-
" api_hwaca_2 = API('hello-world-aca-2', 'Hello World (ACA 2)', '/aca-2', 'This is the ACA API for Backend 2', policyXml = aca_backend_2_policy_xml, operations = [api_hwaca_2_get])\n",
71+
" api_hwaca_2 = API('hello-world-aca-2', 'Hello World (ACA 2)', '/aca-2', 'This is the ACA API for Backend 2', policyXml = pol_aca_backend_2, operations = [api_hwaca_2_get])\n",
7172
"\n",
7273
" # Hello World (ACA Backend Pool)\n",
7374
" api_hwaca_pool_get = GET_APIOperation('This is a GET for Hello World on ACA Backend Pool')\n",
74-
" api_hwaca_pool = API('hello-world-aca-pool', 'Hello World (ACA Pool)', '/aca-pool', 'This is the ACA API for Backend Pool', policyXml = aca_backend_pool_policy_xml, operations = [api_hwaca_pool_get])\n",
75+
" api_hwaca_pool = API('hello-world-aca-pool', 'Hello World (ACA Pool)', '/aca-pool', 'This is the ACA API for Backend Pool', policyXml = pol_aca_backend_pool, operations = [api_hwaca_pool_get])\n",
7576
"\n",
7677
" # Add ACA APIs to the existing apis array\n",
7778
" apis += [api_hwaca_1, api_hwaca_2, api_hwaca_pool]\n",

infrastructure/apim-aca/create.ipynb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,34 @@
3636
" PolicyFragment('AuthZ-Match-All', utils.read_policy_xml(utils.determine_shared_policy_path('pf-authz-match-all.xml')), 'Authorizes if all of the specified roles match the JWT role claims.'),\n",
3737
" PolicyFragment('AuthZ-Match-Any', utils.read_policy_xml(utils.determine_shared_policy_path('pf-authz-match-any.xml')), 'Authorizes if any of the specified roles match the JWT role claims.'),\n",
3838
" PolicyFragment('Http-Response-200', utils.read_policy_xml(utils.determine_shared_policy_path('pf-http-response-200.xml')), 'Returns a 200 OK response for the current HTTP method.'),\n",
39+
" PolicyFragment('Product-Match-Any', utils.read_policy_xml(utils.determine_shared_policy_path('pf-product-match-any.xml')), 'Proceeds if any of the specified products match the context product name.'),\n",
3940
" PolicyFragment('Remove-Request-Headers', utils.read_policy_xml(utils.determine_shared_policy_path('pf-remove-request-headers.xml')), 'Removes request headers from the incoming request.')\n",
4041
"]\n",
4142
"\n",
4243
"# 4) Define the APIs and their operations and policies\n",
4344
"\n",
4445
"# Policies\n",
45-
"hello_world_policy_xml = utils.read_policy_xml(HELLO_WORLD_XML_POLICY_PATH)\n",
46-
"backend_policy_xml = utils.read_policy_xml(BACKEND_XML_POLICY_PATH)\n",
47-
"aca_backend_1_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-1')\n",
48-
"aca_backend_2_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-2')\n",
49-
"aca_backend_pool_policy_xml = backend_policy_xml.format(backend_id = 'aca-backend-pool')\n",
46+
"pol_hello_world = utils.read_policy_xml(HELLO_WORLD_XML_POLICY_PATH)\n",
47+
"pol_backend = utils.read_policy_xml(BACKEND_XML_POLICY_PATH)\n",
48+
"pol_aca_backend_1 = pol_backend.format(backend_id = 'aca-backend-1')\n",
49+
"pol_aca_backend_2 = pol_backend.format(backend_id = 'aca-backend-2')\n",
50+
"pol_aca_backend_pool = pol_backend.format(backend_id = 'aca-backend-pool')\n",
5051
"\n",
5152
"# Hello World (Root)\n",
52-
"api_hwroot_get = GET_APIOperation('This is a GET for Hello World in the root', hello_world_policy_xml)\n",
53+
"api_hwroot_get = GET_APIOperation('This is a GET for Hello World in the root', pol_hello_world)\n",
5354
"api_hwroot = API('hello-world', 'Hello World', '', 'This is the root API for Hello World', operations = [api_hwroot_get])\n",
5455
"\n",
5556
"# Hello World (ACA Backend 1)\n",
5657
"api_hwaca_1_get = GET_APIOperation('This is a GET for Hello World on ACA Backend 1')\n",
57-
"api_hwaca_1 = API('hello-world-aca-1', 'Hello World (ACA 1)', '/aca-1', 'This is the ACA API for Backend 1', policyXml = aca_backend_1_policy_xml, operations = [api_hwaca_1_get])\n",
58+
"api_hwaca_1 = API('hello-world-aca-1', 'Hello World (ACA 1)', '/aca-1', 'This is the ACA API for Backend 1', policyXml = pol_aca_backend_1, operations = [api_hwaca_1_get])\n",
5859
"\n",
5960
"# Hello World (ACA Backend 2)\n",
6061
"api_hwaca_2_get = GET_APIOperation('This is a GET for Hello World on ACA Backend 2')\n",
61-
"api_hwaca_2 = API('hello-world-aca-2', 'Hello World (ACA 2)', '/aca-2', 'This is the ACA API for Backend 2', policyXml = aca_backend_2_policy_xml, operations = [api_hwaca_2_get])\n",
62+
"api_hwaca_2 = API('hello-world-aca-2', 'Hello World (ACA 2)', '/aca-2', 'This is the ACA API for Backend 2', policyXml = pol_aca_backend_2, operations = [api_hwaca_2_get])\n",
6263
"\n",
6364
"# Hello World (ACA Backend Pool)\n",
6465
"api_hwaca_pool_get = GET_APIOperation('This is a GET for Hello World on ACA Backend Pool')\n",
65-
"api_hwaca_pool = API('hello-world-aca-pool', 'Hello World (ACA Pool)', '/aca-pool', 'This is the ACA API for Backend Pool', policyXml = aca_backend_pool_policy_xml, operations = [api_hwaca_pool_get])\n",
66+
"api_hwaca_pool = API('hello-world-aca-pool', 'Hello World (ACA Pool)', '/aca-pool', 'This is the ACA API for Backend Pool', policyXml = pol_aca_backend_pool, operations = [api_hwaca_pool_get])\n",
6667
"\n",
6768
"# APIs Array\n",
6869
"apis: List[API] = [api_hwroot, api_hwaca_1, api_hwaca_2, api_hwaca_pool]\n",

infrastructure/simple-apim/create.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@
3636
" PolicyFragment('AuthZ-Match-All', utils.read_policy_xml(utils.determine_shared_policy_path('pf-authz-match-all.xml')), 'Authorizes if all of the specified roles match the JWT role claims.'),\n",
3737
" PolicyFragment('AuthZ-Match-Any', utils.read_policy_xml(utils.determine_shared_policy_path('pf-authz-match-any.xml')), 'Authorizes if any of the specified roles match the JWT role claims.'),\n",
3838
" PolicyFragment('Http-Response-200', utils.read_policy_xml(utils.determine_shared_policy_path('pf-http-response-200.xml')), 'Returns a 200 OK response for the current HTTP method.'),\n",
39+
" PolicyFragment('Product-Match-Any', utils.read_policy_xml(utils.determine_shared_policy_path('pf-product-match-any.xml')), 'Proceeds if any of the specified products match the context product name.'),\n",
3940
" PolicyFragment('Remove-Request-Headers', utils.read_policy_xml(utils.determine_shared_policy_path('pf-remove-request-headers.xml')), 'Removes request headers from the incoming request.')\n",
4041
"]\n",
4142
"\n",
4243
"# 4) Define the APIs and their operations and policies\n",
4344
"\n",
4445
"# Policies\n",
45-
"hello_world_policy_xml = utils.read_policy_xml(HELLO_WORLD_XML_POLICY_PATH)\n",
46+
"pol_hello_world = utils.read_policy_xml(HELLO_WORLD_XML_POLICY_PATH)\n",
4647
"\n",
4748
"# Hello World (Root)\n",
48-
"api_hwroot_get = GET_APIOperation('This is a GET for API 1', hello_world_policy_xml)\n",
49+
"api_hwroot_get = GET_APIOperation('This is a GET for API 1', pol_hello_world)\n",
4950
"api_hwroot = API('hello-world', 'Hello World', '', 'This is the root API for Hello World', operations = [api_hwroot_get])\n",
5051
"\n",
5152
"# APIs Array\n",

0 commit comments

Comments
 (0)