You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/auth/entra-id/how-to/consume-m2m.md
-60
Original file line number
Diff line number
Diff line change
@@ -25,75 +25,15 @@ spec:
25
25
26
26
Depending on how you communicate with the API you're consuming, [configure the appropriate outbound access policies](../../../workloads/how-to/access-policies.md#outbound-access).
27
27
28
-
{%- if tenant() == "nav" %}
29
-
???+ warning "Use webproxy for outbound network connectivity from on-premises environments"
30
-
31
-
If you're on-premises, you must enable and use [`webproxy`](../../../workloads/application/reference/application-spec.md#webproxy) to access Entra ID.
32
-
33
-
{%- endif %}
34
-
35
28
## Acquire token
36
29
37
30
Now you can request a new token for the API that you want to consume.
38
31
39
-
To acquire a token, you can either:
40
-
41
-
- [acquire tokens with Texas](#acquire-tokens-with-texas), or
42
-
- [acquire tokens manually](#acquire-tokens-manually) in your application
43
-
44
-
### Acquire tokens with Texas
45
-
46
32
{% set identity_provider = 'azuread' %}
47
33
{% set target = 'api://<cluster>.<namespace>.<other-api-app-name>/.default' %}
48
34
{% set target_description = 'The intended _audience_ (target API or recipient) of the new token.' %}
49
35
{% include 'auth/partials/token.md' %}
50
36
51
-
### Acquire tokens manually
52
-
53
-
The token request is an HTTP POST request.
54
-
It must have the `Content-Type` header set to `application/x-www-form-urlencoded`.
55
-
56
-
The body of the request should contain the following parameters:
| `client_id` | `60dea49a-255b-48b5-b0c0-0974ac1c0b53` | Client identifier for your application. Set to the [`AZURE_APP_CLIENT_ID` environment variable][variables-ref]. |
61
-
| `client_secret` | `<some-secret>` | Client secret for your application. Set to the [`AZURE_APP_CLIENT_SECRET` environment variable][variables-ref]. |
Your application does not need to validate this token.
88
-
89
-
!!! tip "Token Caching"
90
-
91
-
The `expires_in` field denotes the lifetime of the token in seconds.
92
-
93
-
**Cache and reuse the token until it expires** to minimize network latency impact.
94
-
95
-
A safe cache key for this flow is `key = $scope`.
96
-
97
37
## Consume API
98
38
99
39
Once you have acquired a new token, you can finally consume the target API by using the token as a [Bearer token](../../explanations/README.md#bearer-token):
Copy file name to clipboardexpand all lines: docs/auth/entra-id/how-to/consume-obo.md
+1-65
Original file line number
Diff line number
Diff line change
@@ -19,78 +19,14 @@ This is also known as the _on-behalf-of (OBO)_ flow.
19
19
20
20
Depending on how you communicate with the API you're consuming, [configure the appropriate outbound access policies](../../../workloads/how-to/access-policies.md#outbound-access).
21
21
22
-
{%- if tenant() == "nav" %}
23
-
???+ warning "Use webproxy for outbound network connectivity from on-premises environments"
24
-
25
-
If you're on-premises, you must enable and use [`webproxy`](../../../workloads/application/reference/application-spec.md#webproxy) to access Entra ID.
26
-
27
-
{%- endif %}
28
-
29
22
## Exchange token
30
23
31
-
Now you can exchange the employees subject token for a new token targeting the API that you want to consume.
32
-
33
-
To exchange a token, you can either:
34
-
35
-
-[exchange tokens with Texas](#exchange-tokens-with-texas), or
36
-
-[exchange tokens manually](#exchange-tokens-manually) in your application
37
-
38
-
### Exchange tokens with Texas
24
+
Now you can exchange the employee's subject token for a new token, targeting the API that you want to consume.
39
25
40
26
{% set identity_provider = 'azuread' %}
41
27
{% set target = 'api://<cluster>.<namespace>.<other-api-app-name>/.default' %}
42
28
{% include 'auth/partials/token-exchange.md' %}
43
29
44
-
### Exchange tokens manually
45
-
46
-
The token request is an HTTP POST request.
47
-
It must have the `Content-Type` header set to `application/x-www-form-urlencoded`.
48
-
49
-
The body of the request should contain the following parameters:
|`assertion`|`eyJraWQ...`| The employee's subject token from the inbound request. Token that should be exchanged. |
54
-
|`client_id`|`60dea49a-255b-48b5-b0c0-0974ac1c0b53`| Client identifier for your application. Set to the [`AZURE_APP_CLIENT_ID` environment variable][variables-ref]. |
55
-
|`client_secret`|`<some-secret>`| Client secret for your application. Set to the [`AZURE_APP_CLIENT_SECRET` environment variable][variables-ref]. |
Your application does not need to validate this token.
85
-
86
-
!!! tip "Token Caching"
87
-
88
-
The `expires_in` field denotes the lifetime of the token in seconds.
89
-
90
-
**Cache and reuse the token until it expires** to minimize network latency impact.
91
-
92
-
A safe cache key for this flow is `key = sha256($subject_token + $scope)`.
93
-
94
30
## Consume API
95
31
96
32
Once you have acquired a new token, you can finally consume the target API by using the token as a [Bearer token](../../explanations/README.md#bearer-token):
| `AZURE_APP_CLIENT_ID` | [Client ID](../../explanations/README.md#client-id) that uniquely identifies the application in Entra ID. |
234
-
| `AZURE_APP_CLIENT_SECRET` | [Client secret](../../explanations/README.md#client-secret) for the application in Entra ID. |
235
-
| `AZURE_APP_WELL_KNOWN_URL` | The well-known URL for the [metadata discovery document](../../explanations/README.md#well-known-url-metadata-document). |
236
-
| `AZURE_OPENID_CONFIG_TOKEN_ENDPOINT` | `token_endpoint` from the [metadata discovery document](../../explanations/README.md#token-endpoint). |
238
+
Validate that the token is signed with a public key published at the JWKS endpoint.
239
+
This endpoint URI can be found in one of two ways:
237
240
238
-
`AZURE_APP_WELL_KNOWN_URL`is optional if you're using `AZURE_OPENID_CONFIG_TOKEN_ENDPOINT` directly.
241
+
1. the `AZURE_OPENID_CONFIG_JWKS_URI` environment variable, or
242
+
2. the `jwks_uri` property from the metadata discovery document.
243
+
The document is found at the endpoint pointed to by the `AZURE_APP_WELL_KNOWN_URL` environment variable.
239
244
240
-
### Variables for validating tokens
245
+
**Claims Validation**
246
+
247
+
[Other claims](../reference/README.md#claims) may be present in the token. Validation of these claims is optional.
248
+
249
+
## Runtime Variables & Credentials
241
250
242
-
These variables are used to [:dart: secure your API](../how-to/secure.md):
251
+
Your application will automatically be injected with the following environment variables at runtime.
| `AZURE_APP_CLIENT_ID` | [Client ID](../explanations/README.md#client-id) that uniquely identifies the application in Entra ID. |
247
-
| `AZURE_APP_WELL_KNOWN_URL` | The well-known URL for the [metadata discovery document](../../explanations/README.md#well-known-url-metadata-document). |
248
-
| `AZURE_OPENID_CONFIG_ISSUER` | `issuer` from the [metadata discovery document](../../explanations/README.md#issuer). |
249
-
| `AZURE_OPENID_CONFIG_JWKS_URI` | `jwks_uri` from the [metadata discovery document](../../explanations/README.md#jwks-endpoint-public-keys). |
0 commit comments