Skip to content

Commit 58f3749

Browse files
authored
Merge pull request #200589 from MicrosoftDocs/main
6/06 AM Publish
2 parents 80e7698 + af6bf13 commit 58f3749

File tree

196 files changed

+4333
-479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

196 files changed

+4333
-479
lines changed

articles/active-directory/app-proxy/application-proxy-configure-complex-application.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ This article provides you with the information you need to configure wildcard ap
5050
- Note - Regular application will always take precedence over a complex app (wildcard application).
5151

5252
## Pre-requisites
53-
Before you get started with single sign-on for header-based authentication apps, make sure your environment is ready with the following settings and configurations:
53+
Before you get started with Application Proxy Complex application scenario apps, make sure your environment is ready with the following settings and configurations:
5454
- You need to enable Application Proxy and install a connector that has line of site to your applications. See the tutorial [Add an on-premises application for remote access through Application Proxy](application-proxy-add-on-premises-application.md#add-an-on-premises-app-to-azure-ad) to learn how to prepare your on-premises environment, install and register a connector, and test the connector.
5555

5656

articles/active-directory/cloud-infrastructure-entitlement-management/faqs.md

Lines changed: 56 additions & 58 deletions
Large diffs are not rendered by default.

articles/active-directory/develop/scenario-desktop-acquire-token.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ let accounts = await msalTokenCache.getAllAccounts();
175175

176176
const tokenRequest = {
177177
code: response["authorization_code"],
178-
codeVerifier: verifier // PKCE Code Verifier
178+
codeVerifier: verifier, // PKCE Code Verifier
179179
redirectUri: "your_redirect_uri",
180180
scopes: ["User.Read"],
181181
};

articles/api-management/TOC.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@
257257
href: api-management-howto-protect-backend-with-aad.md
258258
- name: Protect your API with Azure AD B2C
259259
href: howto-protect-backend-frontend-azure-ad-b2c.md
260+
- name: Manage authorization tokens for OAuth 2.0 APIs
261+
items:
262+
- name: Authorizations overview
263+
href: authorizations-overview.md
264+
- name: Set up and use an authorization
265+
href: authorizations-how-to.md
260266
- name: Secure APIs using client certificate authentication
261267
href: api-management-howto-mutual-certificates-for-clients.md
262268
- name: Manage CA certificates
@@ -389,6 +395,8 @@
389395
href: api-management-transformation-policies.md
390396
- name: Validation policies
391397
href: validation-policies.md
398+
- name: Authorizations - identity providers
399+
href: authorizations-reference.md
392400
- name: Azure Policy built-ins
393401
displayName: samples, policies, definitions
394402
href: ./policy-reference.md

articles/api-management/api-management-access-restriction-policies.md

Lines changed: 141 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: dlepow
77

88
ms.service: api-management
99
ms.topic: reference
10-
ms.date: 03/04/2022
10+
ms.date: 06/03/2022
1111
ms.author: danlep
1212
---
1313

@@ -20,12 +20,13 @@ This article provides a reference for API Management access restriction policies
2020
## <a name="AccessRestrictionPolicies"></a> Access restriction policies
2121

2222
- [Check HTTP header](#CheckHTTPHeader) - Enforces existence and/or value of an HTTP header.
23+
- [Get authorization context](#GetAuthorizationContext) - Gets the authorization context of a specified [authorization](authorizations-overview.md) configured in the API Management instance.
2324
- [Limit call rate by subscription](#LimitCallRate) - Prevents API usage spikes by limiting call rate, on a per subscription basis.
2425
- [Limit call rate by key](#LimitCallRateByKey) - Prevents API usage spikes by limiting call rate, on a per key basis.
2526
- [Restrict caller IPs](#RestrictCallerIPs) - Filters (allows/denies) calls from specific IP addresses and/or address ranges.
2627
- [Set usage quota by subscription](#SetUsageQuota) - Allows you to enforce a renewable or lifetime call volume and/or bandwidth quota, on a per subscription basis.
2728
- [Set usage quota by key](#SetUsageQuotaByKey) - Allows you to enforce a renewable or lifetime call volume and/or bandwidth quota, on a per key basis.
28-
- [Validate JWT](#ValidateJWT) - Enforces existence and validity of a JWT extracted from either a specified HTTP Header or a specified query parameter.
29+
- [Validate JWT](#ValidateJWT) - Enforces existence and validity of a JWT extracted from either a specified HTTP header or a specified query parameter.
2930
- [Validate client certificate](#validate-client-certificate) - Enforces that a certificate presented by a client to an API Management instance matches specified validation rules and claims.
3031

3132
> [!TIP]
@@ -67,7 +68,7 @@ Use the `check-header` policy to enforce that a request has a specified HTTP hea
6768
| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------- |
6869
| failed-check-error-message | Error message to return in the HTTP response body if the header doesn't exist or has an invalid value. This message must have any special characters properly escaped. | Yes | N/A |
6970
| failed-check-httpcode | HTTP Status code to return if the header doesn't exist or has an invalid value. | Yes | N/A |
70-
| header-name | The name of the HTTP Header to check. | Yes | N/A |
71+
| header-name | The name of the HTTP header to check. | Yes | N/A |
7172
| ignore-case | Can be set to True or False. If set to True case is ignored when the header value is compared against the set of acceptable values. | Yes | N/A |
7273

7374
### Usage
@@ -78,6 +79,142 @@ This policy can be used in the following policy [sections](./api-management-howt
7879

7980
- **Policy scopes:** all scopes
8081

82+
## <a name="GetAuthorizationContext"></a> Get authorization context
83+
84+
Use the `get-authorization-context` policy to get the authorization context of a specified [authorization](authorizations-overview.md) (preview) configured in the API Management instance.
85+
86+
The policy fetches and stores authorization and refresh tokens from the configured authorization provider.
87+
88+
If `identity-type=jwt` is configured, a JWT token is required to be validated. The audience of this token must be https://azure-api.net/authorization-manager.
89+
90+
[!INCLUDE [api-management-policy-generic-alert](../../includes/api-management-policy-generic-alert.md)]
91+
92+
93+
### Policy statement
94+
95+
```xml
96+
<get-authorization-context
97+
provider-id="authorization provider id"
98+
authorization-id="authorization id"
99+
context-variable-name="variable name"
100+
identity-type="managed | jwt"
101+
identity="JWT bearer token"
102+
ignore-error="true | false" />
103+
```
104+
105+
### Examples
106+
107+
#### Example 1: Get token back
108+
109+
```xml
110+
<!-- Add to inbound policy. -->
111+
<get-authorization-context
112+
provider-id="github-01"
113+
authorization-id="auth-01"
114+
context-variable-name="auth-context"
115+
identity-type="managed"
116+
identity="@(context.Request.Headers["Authorization"][0].Replace("Bearer ", ""))"
117+
ignore-error="false" />
118+
<!-- Return the token -->
119+
<return-response>
120+
<set-status code="200" />
121+
<set-body template="none">@(((Authorization)context.Variables.GetValueOrDefault("auth-context"))?.AccessToken)</set-body>
122+
</return-response>
123+
```
124+
125+
#### Example 2: Get token back with dynamically set attributes
126+
127+
```xml
128+
<!-- Add to inbound policy. -->
129+
<get-authorization-context
130+
provider-id="@(context.Request.Url.Query.GetValueOrDefault("authorizationProviderId"))"
131+
authorization-id="@(context.Request.Url.Query.GetValueOrDefault("authorizationId"))" context-variable-name="auth-context"
132+
ignore-error="false"
133+
identity-type="managed" />
134+
<!-- Return the token -->
135+
<return-response>
136+
<set-status code="200" />
137+
<set-body template="none">@(((Authorization)context.Variables.GetValueOrDefault("auth-context"))?.AccessToken)</set-body>
138+
</return-response>
139+
```
140+
141+
#### Example 3: Attach the token to the backend call
142+
143+
```xml
144+
<!-- Add to inbound policy. -->
145+
<get-authorization-context
146+
provider-id="github-01"
147+
authorization-id="auth-01"
148+
context-variable-name="auth-context"
149+
identity-type="managed"
150+
ignore-error="false" />
151+
<!-- Attach the token to the backend call -->
152+
<set-header name="Authorization" exists-action="override">
153+
<value>@("Bearer " + ((Authorization)context.Variables.GetValueOrDefault("auth-context"))?.AccessToken)</value>
154+
</set-header>
155+
```
156+
157+
#### Example 4: Get token from incoming request and return token
158+
159+
```xml
160+
<!-- Add to inbound policy. -->
161+
<get-authorization-context
162+
provider-id="github-01"
163+
authorization-id="auth-01"
164+
context-variable-name="auth-context"
165+
identity-type="jwt"
166+
identity="@(context.Request.Headers["Authorization"][0].Replace("Bearer ", ""))"
167+
ignore-error="false" />
168+
<!-- Return the token -->
169+
<return-response>
170+
<set-status code="200" />
171+
<set-body template="none">@(((Authorization)context.Variables.GetValueOrDefault("auth-context"))?.AccessToken)</set-body>
172+
</return-response>
173+
```
174+
175+
### Elements
176+
177+
| Name | Description | Required |
178+
| ----- | ------------- | -------- |
179+
| get-authorization-context | Root element. | Yes |
180+
181+
### Attributes
182+
183+
| Name | Description | Required | Default |
184+
|---|---|---|---|
185+
| provider-id | The authorization provider resource identifier. | Yes | |
186+
| authorization-id | The authorization resource identifier. | Yes | |
187+
| context-variable-name | The name of the context variable to receive the [`Authorization` object](#authorization-object). | Yes | |
188+
| identity-type | Type of identity to be checked against the authorization access policy. <br> - `managed`: managed identity of the API Management service. <br> - `jwt`: JWT bearer token specified in the `identity` attribute. | No | managed |
189+
| identity | An Azure AD JWT bearer token to be checked against the authorization permissions. Ignored for `identity-type` other than `jwt`. <br><br>Expected claims: <br> - audience: https://azure-api.net/authorization-manager <br> - `oid`: Permission object id <br> - `tid`: Permission tenant id | No | |
190+
| ignore-error | Boolean. If acquiring the authorization context results in an error (for example, the authorization resource is not found or is in an error state): <br> - `true`: the context variable is assigned a value of null. <br> - `false`: return `500` | No | false |
191+
192+
### Authorization object
193+
194+
The Authorization context variable receives an object of type `Authorization`.
195+
196+
```c#
197+
class Authorization
198+
{
199+
public string AccessToken { get; }
200+
public IReadOnlyDictionary<string, object> Claims { get; }
201+
}
202+
```
203+
204+
| Property Name | Description |
205+
| -- | -- |
206+
| AccessToken | Bearer access token to authorize a backend HTTP request. |
207+
| Claims | Claims returned from the authorization server’s token response API (see [RFC6749#section-5.1](https://datatracker.ietf.org/doc/html/rfc6749#section-5.1)). |
208+
209+
### Usage
210+
211+
This policy can be used in the following policy [sections](./api-management-howto-policies.md#sections) and [scopes](./api-management-howto-policies.md#scopes).
212+
213+
- **Policy sections:** inbound
214+
215+
- **Policy scopes:** all scopes
216+
217+
81218
## <a name="LimitCallRate"></a> Limit call rate by subscription
82219

83220
The `rate-limit` policy prevents API usage spikes on a per subscription basis by limiting the call rate to a specified number per a specified time period. When the call rate is exceeded, the caller receives a `429 Too Many Requests` response status code.
@@ -415,7 +552,7 @@ This policy can be used in the following policy [sections](./api-management-howt
415552

416553
## <a name="ValidateJWT"></a> Validate JWT
417554

418-
The `validate-jwt` policy enforces existence and validity of a JSON web token (JWT) extracted from either a specified HTTP Header or a specified query parameter.
555+
The `validate-jwt` policy enforces existence and validity of a JSON web token (JWT) extracted from either a specified HTTP header or a specified query parameter.
419556

420557
> [!IMPORTANT]
421558
> The `validate-jwt` policy requires that the `exp` registered claim is included in the JWT token, unless `require-expiration-time` attribute is specified and set to `false`.

articles/api-management/api-management-policies.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ More information about policies:
1919

2020
## [Access restriction policies](api-management-access-restriction-policies.md)
2121
- [Check HTTP header](api-management-access-restriction-policies.md#CheckHTTPHeader) - Enforces existence and/or value of an HTTP Header.
22+
- [Get authorization context](api-management-access-restriction-policies.md#GetAuthorizationContext) - Gets the authorization context of a specified [authorization](authorizations-overview.md) configured in the API Management instance.
2223
- [Limit call rate by subscription](api-management-access-restriction-policies.md#LimitCallRate) - Prevents API usage spikes by limiting call rate, on a per subscription basis.
2324
- [Limit call rate by key](api-management-access-restriction-policies.md#LimitCallRateByKey) - Prevents API usage spikes by limiting call rate, on a per key basis.
2425
- [Restrict caller IPs](api-management-access-restriction-policies.md#RestrictCallerIPs) - Filters (allows/denies) calls from specific IP addresses and/or address ranges.

0 commit comments

Comments
 (0)