Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 94be418

Browse files
authored
Merge pull request #70 from PramodValavala-MSFT/prvalav/add-authz-server-examples
Examples for OAuth and OpenID Connect providers
2 parents 2f142ea + 794f2da commit 94be418

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

example/Security/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# API Management : Security
2+
3+
## OAuth2 & OpenID Connect
4+
5+
APIM supports adding OAuth 2.0 and OpenID Connect servers which can be used to protect APIs with.
6+
7+
The template examples present in this folder are based on the [tutorial](https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-protect-backend-with-aad) present in the docs.

example/Security/oauth2.template.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"ApimServiceName": {
6+
"type": "string"
7+
},
8+
"frontendClientID": {
9+
"type": "string"
10+
},
11+
"frontendClientSecret": {
12+
"type": "string"
13+
},
14+
"backendClientID": {
15+
"type": "string"
16+
},
17+
"authorizationEndpoint": {
18+
"type": "string"
19+
},
20+
"tokenEndpoint": {
21+
"type": "string"
22+
},
23+
"clientRegistrationEndpoint": {
24+
"type": "string"
25+
}
26+
},
27+
"resources": [
28+
{
29+
"type": "Microsoft.ApiManagement/service/authorizationServers",
30+
"name": "[concat(parameters('ApimServiceName'), '/', 'client-app')]",
31+
"apiVersion": "2018-01-01",
32+
"properties": {
33+
"displayName": "Azure AD",
34+
"clientRegistrationEndpoint": "[parameters('clientRegistrationEndpoint')]",
35+
"authorizationEndpoint": "[parameters('authorizationEndpoint')]",
36+
"authorizationMethods": ["GET"],
37+
"clientAuthenticationMethod": ["Body"],
38+
"tokenBodyParameters": [
39+
{
40+
"name": "resource",
41+
"value": "[parameters('backendClientID')]"
42+
}
43+
],
44+
"tokenEndpoint": "[parameters('tokenEndpoint')]",
45+
"grantTypes": ["authorizationCode"],
46+
"bearerTokenSendingMethods": ["authorizationHeader"],
47+
"clientId": "[parameters('frontendClientID')]",
48+
"clientSecret": "[parameters('frontendClientSecret')]"
49+
}
50+
}
51+
]
52+
}

example/Security/openid.template.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"ApimServiceName": {
6+
"type": "string"
7+
},
8+
"clientID": {
9+
"type": "string"
10+
},
11+
"clientSecret": {
12+
"type": "string"
13+
},
14+
"metadataEndpoint": {
15+
"type": "string"
16+
}
17+
},
18+
"resources": [
19+
{
20+
"type": "Microsoft.ApiManagement/service/openidConnectProviders",
21+
"name": "[concat(parameters('ApimServiceName'), '/', 'client-app')]",
22+
"apiVersion": "2018-01-01",
23+
"properties": {
24+
"displayName": "Azure AD",
25+
"metadataEndpoint": "[parameters('metadataEndpoint')]",
26+
"clientId": "[parameters('clientID')]",
27+
"clientSecret": "[parameters('clientSecret')]"
28+
}
29+
}
30+
]
31+
}

0 commit comments

Comments
 (0)