Skip to content

Commit 6c0cbc6

Browse files
Merge pull request #33876 from dotnet/main
Merge to Live
2 parents 972052b + 06e72d8 commit 6c0cbc6

9 files changed

+165
-174
lines changed

aspnetcore/blazor/security/blazor-web-app-with-entra.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,11 @@ Example:
9999
```json
100100
"AzureAd": {
101101
"CallbackPath": "/signin-oidc",
102-
"ClientId": "41451fa7-82d9-4673-8fa5-69eff5a761fd",
102+
"ClientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
103103
"Domain": "contoso.onmicrosoft.com",
104104
"Instance": "https://login.microsoftonline.com/",
105105
"ResponseType": "code",
106-
"TenantId": "e86c78e2-8bb4-4c41-aefd-918e0565a45e"
106+
"TenantId": "aaaabbbb-0000-cccc-1111-dddd2222eeee"
107107
},
108108
```
109109

aspnetcore/blazor/security/blazor-web-app-with-oidc.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ The following <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConn
112112

113113
Example:
114114

115-
* Authority (`{AUTHORITY}`): `https://login.microsoftonline.com/a3942615-d115-4eb7-bc84-9974abcf5064/v2.0/` (uses Tenant ID `a3942615-d115-4eb7-bc84-9974abcf5064`)
116-
* Client Id (`{CLIENT ID}`): `4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f`
115+
* Authority (`{AUTHORITY}`): `https://login.microsoftonline.com/aaaabbbb-0000-cccc-1111-dddd2222eeee/v2.0/` (uses Tenant ID `aaaabbbb-0000-cccc-1111-dddd2222eeee`)
116+
* Client Id (`{CLIENT ID}`): `00001111-aaaa-2222-bbbb-3333cccc4444`
117117

118118
```csharp
119119
oidcOptions.Authority = "https://login.microsoftonline.com/a3942615-d115-4eb7-bc84-9974abcf5064/v2.0/";
120-
oidcOptions.ClientId = "4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f";
120+
oidcOptions.ClientId = "00001111-aaaa-2222-bbbb-3333cccc4444";
121121
```
122122

123123
Example for Microsoft Azure "common" authority:
@@ -138,8 +138,8 @@ The following <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConn
138138

139139
* <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.MapInboundClaims%2A> and configuration of <xref:Microsoft.IdentityModel.Tokens.TokenValidationParameters.NameClaimType%2A> and <xref:Microsoft.IdentityModel.Tokens.TokenValidationParameters.RoleClaimType%2A>: Many OIDC servers use "`name`" and "`role`" rather than the SOAP/WS-Fed defaults in <xref:System.Security.Claims.ClaimTypes>. When <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.MapInboundClaims%2A> is set to `false`, the handler doesn't perform claims mappings, and the claim names from the JWT are used directly by the app. The following example sets the role claim type to "`roles`," which is appropriate for [Microsoft Entra ID (ME-ID)](https://www.microsoft.com/security/business/microsoft-entra). Consult your identity provider's documentation for more information.
140140

141-
> [!NOTE]
142-
> <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.MapInboundClaims%2A> must be set to `false` for most OIDC providers, which prevents renaming claims.
141+
> [!NOTE]
142+
> <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.MapInboundClaims%2A> must be set to `false` for most OIDC providers, which prevents renaming claims.
143143
144144
```csharp
145145
oidcOptions.MapInboundClaims = false;
@@ -179,19 +179,19 @@ The following <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConn
179179
> [!NOTE]
180180
> A port isn't required for `localhost` addresses when using Microsoft Entra ID. Most other OIDC providers require a correct port.
181181
182-
```csharp
183-
oidcOptions.CallbackPath = new PathString("{PATH}");
184-
oidcOptions.SignedOutCallbackPath = new PathString("{PATH}");
185-
oidcOptions.RemoteSignOutPath = new PathString("{PATH}");
186-
```
182+
```csharp
183+
oidcOptions.CallbackPath = new PathString("{PATH}");
184+
oidcOptions.SignedOutCallbackPath = new PathString("{PATH}");
185+
oidcOptions.RemoteSignOutPath = new PathString("{PATH}");
186+
```
187187

188-
Examples (default values):
188+
Examples (default values):
189189

190-
```csharp
191-
oidcOptions.CallbackPath = new PathString("/signin-oidc");
192-
oidcOptions.SignedOutCallbackPath = new PathString("/signout-callback-oidc");
193-
oidcOptions.RemoteSignOutPath = new PathString("/signout-oidc");
194-
```
190+
```csharp
191+
oidcOptions.CallbackPath = new PathString("/signin-oidc");
192+
oidcOptions.SignedOutCallbackPath = new PathString("/signout-callback-oidc");
193+
oidcOptions.RemoteSignOutPath = new PathString("/signout-oidc");
194+
```
195195

196196
* (*Microsoft Azure only with the "common" endpoint*) <xref:Microsoft.IdentityModel.Tokens.TokenValidationParameters.IssuerValidator%2A?displayProperty=nameWithType>: Many OIDC providers work with the default issuer validator, but we need to account for the issuer parameterized with the Tenant ID (`{TENANT ID}`) returned by `https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration`. For more information, see [SecurityTokenInvalidIssuerException with OpenID Connect and the Azure AD "common" endpoint (`AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet` #1731)](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/1731).
197197
@@ -359,7 +359,7 @@ The following <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConn
359359

360360
* App ID URI (`{APP ID URI}`): `https://{DIRECTORY NAME}.onmicrosoft.com/{CLIENT ID}`
361361
* Directory Name (`{DIRECTORY NAME}`): `contoso`
362-
* Application (Client) Id (`{CLIENT ID}`): `4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f`
362+
* Application (Client) Id (`{CLIENT ID}`): `00001111-aaaa-2222-bbbb-3333cccc4444`
363363
* Scope configured for weather data from `MinimalApiJwt` (`{API NAME}`): `Weather.Get`
364364

365365
```csharp
@@ -370,11 +370,11 @@ The following <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConn
370370

371371
Example:
372372

373-
* App ID URI (`{APP ID URI}`): `api://{CLIENT ID}` with Application (Client) Id (`{CLIENT ID}`): `4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f`
373+
* App ID URI (`{APP ID URI}`): `api://{CLIENT ID}` with Application (Client) Id (`{CLIENT ID}`): `00001111-aaaa-2222-bbbb-3333cccc4444`
374374
* Scope configured for weather data from `MinimalApiJwt` (`{API NAME}`): `Weather.Get`
375375

376376
```csharp
377-
oidcOptions.Scope.Add("api://4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f/Weather.Get");
377+
oidcOptions.Scope.Add("api://00001111-aaaa-2222-bbbb-3333cccc4444/Weather.Get");
378378
```
379379

380380
* <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.Authority%2A> and <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.ClientId%2A>: Sets the Authority and Client ID for OIDC calls.
@@ -386,12 +386,12 @@ The following <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConn
386386

387387
Example:
388388

389-
* Authority (`{AUTHORITY}`): `https://login.microsoftonline.com/a3942615-d115-4eb7-bc84-9974abcf5064/v2.0/` (uses Tenant ID `a3942615-d115-4eb7-bc84-9974abcf5064`)
390-
* Client Id (`{CLIENT ID}`): `4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f`
389+
* Authority (`{AUTHORITY}`): `https://login.microsoftonline.com/aaaabbbb-0000-cccc-1111-dddd2222eeee/v2.0/` (uses Tenant ID `aaaabbbb-0000-cccc-1111-dddd2222eeee`)
390+
* Client Id (`{CLIENT ID}`): `00001111-aaaa-2222-bbbb-3333cccc4444`
391391

392392
```csharp
393393
oidcOptions.Authority = "https://login.microsoftonline.com/a3942615-d115-4eb7-bc84-9974abcf5064/v2.0/";
394-
oidcOptions.ClientId = "4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f";
394+
oidcOptions.ClientId = "00001111-aaaa-2222-bbbb-3333cccc4444";
395395
```
396396

397397
Example for Microsoft Azure "common" authority:
@@ -412,8 +412,8 @@ The following <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConn
412412

413413
* <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.MapInboundClaims%2A> and configuration of <xref:Microsoft.IdentityModel.Tokens.TokenValidationParameters.NameClaimType%2A> and <xref:Microsoft.IdentityModel.Tokens.TokenValidationParameters.RoleClaimType%2A>: Many OIDC servers use "`name`" and "`role`" rather than the SOAP/WS-Fed defaults in <xref:System.Security.Claims.ClaimTypes>. When <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.MapInboundClaims%2A> is set to `false`, the handler doesn't perform claims mappings and the claim names from the JWT are used directly by the app. The following example sets the role claim type to "`roles`," which is appropriate for [Microsoft Entra ID (ME-ID)](https://www.microsoft.com/security/business/microsoft-entra). Consult your identity provider's documentation for more information.
414414

415-
> [!NOTE]
416-
> <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.MapInboundClaims%2A> must be set to `false` for most OIDC providers, which prevents renaming claims.
415+
> [!NOTE]
416+
> <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectOptions.MapInboundClaims%2A> must be set to `false` for most OIDC providers, which prevents renaming claims.
417417
418418
```csharp
419419
oidcOptions.MapInboundClaims = false;
@@ -453,19 +453,19 @@ The following <xref:Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConn
453453
> [!NOTE]
454454
> A port isn't required for `localhost` addresses.
455455
456-
```csharp
457-
oidcOptions.CallbackPath = new PathString("{PATH}");
458-
oidcOptions.SignedOutCallbackPath = new PathString("{PATH}");
459-
oidcOptions.RemoteSignOutPath = new PathString("{PATH}");
460-
```
456+
```csharp
457+
oidcOptions.CallbackPath = new PathString("{PATH}");
458+
oidcOptions.SignedOutCallbackPath = new PathString("{PATH}");
459+
oidcOptions.RemoteSignOutPath = new PathString("{PATH}");
460+
```
461461

462-
Examples (default values):
462+
Examples (default values):
463463

464-
```csharp
465-
oidcOptions.CallbackPath = new PathString("/signin-oidc");
466-
oidcOptions.SignedOutCallbackPath = new PathString("/signout-callback-oidc");
467-
oidcOptions.RemoteSignOutPath = new PathString("/signout-oidc");
468-
```
464+
```csharp
465+
oidcOptions.CallbackPath = new PathString("/signin-oidc");
466+
oidcOptions.SignedOutCallbackPath = new PathString("/signout-callback-oidc");
467+
oidcOptions.RemoteSignOutPath = new PathString("/signout-oidc");
468+
```
469469

470470
* (*Microsoft Azure only with the "common" endpoint*) <xref:Microsoft.IdentityModel.Tokens.TokenValidationParameters.IssuerValidator%2A?displayProperty=nameWithType>: Many OIDC providers work with the default issuer validator, but we need to account for the issuer parameterized with the Tenant ID (`{TENANT ID}`) returned by `https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration`. For more information, see [SecurityTokenInvalidIssuerException with OpenID Connect and the Azure AD "common" endpoint (`AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet` #1731)](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/1731).
471471
@@ -533,20 +533,20 @@ Configure the project in the <xref:Microsoft.AspNetCore.Authentication.JwtBearer
533533
App ID URI (`{APP ID URI}`): `https://{DIRECTORY NAME}.onmicrosoft.com/{CLIENT ID}`:
534534

535535
* Directory Name (`{DIRECTORY NAME}`): `contoso`
536-
* Application (Client) Id (`{CLIENT ID}`): `4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f`
536+
* Application (Client) Id (`{CLIENT ID}`): `00001111-aaaa-2222-bbbb-3333cccc4444`
537537

538538
```csharp
539-
jwtOptions.Audience = "https://contoso.onmicrosoft.com/4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f";
539+
jwtOptions.Audience = "https://contoso.onmicrosoft.com/00001111-aaaa-2222-bbbb-3333cccc4444";
540540
```
541541

542542
The preceding example pertains to an app registered in a tenant with an AAD B2C tenant type. If the app is registered in an ME-ID tenant, the App ID URI is different, thus the audience is different.
543543

544544
Example:
545545

546-
App ID URI (`{APP ID URI}`): `api://{CLIENT ID}` with Application (Client) Id (`{CLIENT ID}`): `4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f`
546+
App ID URI (`{APP ID URI}`): `api://{CLIENT ID}` with Application (Client) Id (`{CLIENT ID}`): `00001111-aaaa-2222-bbbb-3333cccc4444`
547547

548548
```csharp
549-
jwtOptions.Audience = "api://4ba4de56-9cef-45d9-83fa-a4c18f9f5f0f";
549+
jwtOptions.Audience = "api://00001111-aaaa-2222-bbbb-3333cccc4444";
550550
```
551551

552552
* <xref:Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerOptions.Authority%2A>: Sets the Authority for making OpenID Connect calls. Match the value to the Authority configured for the OIDC handler in `BlazorWebAppOidc/Program.cs`:
@@ -557,7 +557,7 @@ Configure the project in the <xref:Microsoft.AspNetCore.Authentication.JwtBearer
557557

558558
Example:
559559

560-
Authority (`{AUTHORITY}`): `https://login.microsoftonline.com/a3942615-d115-4eb7-bc84-9974abcf5064/v2.0/` (uses Tenant ID `a3942615-d115-4eb7-bc84-9974abcf5064`)
560+
Authority (`{AUTHORITY}`): `https://login.microsoftonline.com/aaaabbbb-0000-cccc-1111-dddd2222eeee/v2.0/` (uses Tenant ID `aaaabbbb-0000-cccc-1111-dddd2222eeee`)
561561

562562
```csharp
563563
jwtOptions.Authority = "https://login.microsoftonline.com/a3942615-d115-4eb7-bc84-9974abcf5064/v2.0/";

aspnetcore/blazor/security/includes/troubleshoot-wasm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ Example JWT decoded by the tool for an app that authenticates against Azure AAD
211211
"nbf": 1610055829,
212212
"ver": "1.0",
213213
"iss": "https://mysiteb2c.b2clogin.com/5cc15ea8-a296-4aa3-97e4-226dcc9ad298/v2.0/",
214-
"sub": "5ee963fb-24d6-4d72-a1b6-889c6e2c7438",
215-
"aud": "70bde375-fce3-4b82-984a-b247d823a03f",
214+
"sub": "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb",
215+
"aud": "00001111-aaaa-2222-bbbb-3333cccc4444",
216216
"nonce": "b2641f54-8dc4-42ca-97ea-7f12ff4af871",
217217
"iat": 1610055829,
218218
"auth_time": 1610055822,

aspnetcore/blazor/security/webassembly/hosted-with-azure-active-directory-b2c.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Register an AAD B2C app for the *Server API app*:
4444

4545
Record the following information:
4646

47-
* *Server API app* Application (client) ID (for example, `41451fa7-82d9-4673-8fa5-69eff5a761fd`)
47+
* *Server API app* Application (client) ID (for example, `00001111-aaaa-2222-bbbb-3333cccc4444`)
4848
* AAD B2C instance (for example, `https://contoso.b2clogin.com/`, which includes the trailing slash). The instance is the scheme and host of an Azure B2C app registration, which can be found by opening the **Endpoints** window from the **App registrations** page in the Azure portal.
4949
* Primary/Publisher/Tenant domain (for example, `contoso.onmicrosoft.com`): The domain is available as the **Publisher domain** in the **Branding** blade of the Azure portal for the registered app.
5050

@@ -60,7 +60,7 @@ Select **Expose an API** from the sidebar and follow these steps:
6060

6161
Record the following information:
6262

63-
* App ID URI GUID (for example, record `41451fa7-82d9-4673-8fa5-69eff5a761fd` from `https://contoso.onmicrosoft.com/41451fa7-82d9-4673-8fa5-69eff5a761fd`)
63+
* App ID URI GUID (for example, record `00001111-aaaa-2222-bbbb-3333cccc4444` from `https://contoso.onmicrosoft.com/00001111-aaaa-2222-bbbb-3333cccc4444`)
6464
* Scope name (for example, `API.Access`)
6565

6666
### Register a client app in Azure
@@ -77,7 +77,7 @@ Register an AAD B2C app for the *Client app*:
7777
> [!NOTE]
7878
> Supplying the port number for a `localhost` AAD B2C redirect URI isn't required. For more information, see [Redirect URI (reply URL) restrictions and limitations: Localhost exceptions (Entra documentation)](/entra/identity-platform/reply-url#localhost-exceptions).
7979
80-
Record the *Client app* Application (client) ID (for example, `4369008b-21fa-427c-abaa-9b53bf58e538`).
80+
Record the *Client app* Application (client) ID (for example, `11112222-bbbb-3333-cccc-4444dddd5555`).
8181

8282
In **Authentication** > **Platform configurations** > **Single-page application**:
8383

@@ -116,10 +116,10 @@ dotnet new blazorwasm -au IndividualB2C --aad-b2c-instance "{AAD B2C INSTANCE}"
116116
| --- | --- | --- |
117117
| `{AAD B2C INSTANCE}` | Instance | `https://contoso.b2clogin.com/` (includes the trailing slash) |
118118
| `{PROJECT NAME}` | &mdash; | `BlazorSample` |
119-
| `{CLIENT APP CLIENT ID}` | Application (client) ID for the **:::no-loc text="Client":::** app | `4369008b-21fa-427c-abaa-9b53bf58e538` |
119+
| `{CLIENT APP CLIENT ID}` | Application (client) ID for the **:::no-loc text="Client":::** app | `11112222-bbbb-3333-cccc-4444dddd5555` |
120120
| `{DEFAULT SCOPE}` | Scope name | `API.Access` |
121-
| `{SERVER API APP CLIENT ID}` | Application (client) ID for the **:::no-loc text="Server":::** app | `41451fa7-82d9-4673-8fa5-69eff5a761fd` |
122-
| `{SERVER API APP ID URI GUID}` | Application ID URI GUID | `41451fa7-82d9-4673-8fa5-69eff5a761fd` (GUID ONLY, matches the `{SERVER API APP CLIENT ID}`) |
121+
| `{SERVER API APP CLIENT ID}` | Application (client) ID for the **:::no-loc text="Server":::** app | `00001111-aaaa-2222-bbbb-3333cccc4444` |
122+
| `{SERVER API APP ID URI GUID}` | Application ID URI GUID | `00001111-aaaa-2222-bbbb-3333cccc4444` (GUID ONLY, matches the `{SERVER API APP CLIENT ID}`) |
123123
| `{SIGN UP OR SIGN IN POLICY}` | Sign-up/sign-in user flow | `B2C_1_signupsignin1` |
124124
| `{TENANT DOMAIN}` | Primary/Publisher/Tenant domain | `contoso.onmicrosoft.com` |
125125

@@ -185,7 +185,7 @@ Example:
185185
{
186186
"AzureAdB2C": {
187187
"Instance": "https://contoso.b2clogin.com/",
188-
"ClientId": "41451fa7-82d9-4673-8fa5-69eff5a761fd",
188+
"ClientId": "00001111-aaaa-2222-bbbb-3333cccc4444",
189189
"Domain": "contoso.onmicrosoft.com",
190190
"Scopes": "API.Access",
191191
"SignUpSignInPolicyId": "B2C_1_signupsignin1",
@@ -273,7 +273,7 @@ Example:
273273
{
274274
"AzureAdB2C": {
275275
"Authority": "https://contoso.b2clogin.com/contoso.onmicrosoft.com/B2C_1_signupsignin1",
276-
"ClientId": "4369008b-21fa-427c-abaa-9b53bf58e538",
276+
"ClientId": "11112222-bbbb-3333-cccc-4444dddd5555",
277277
"ValidateAuthority": false
278278
}
279279
}
@@ -322,7 +322,7 @@ builder.Services.AddMsalAuthentication(options =>
322322
});
323323
```
324324

325-
The `{SCOPE URI}` is the default access token scope (for example, `https://contoso.onmicrosoft.com/41451fa7-82d9-4673-8fa5-69eff5a761fd/API.Access` or the custom URI that you configured in the Azure portal).
325+
The `{SCOPE URI}` is the default access token scope (for example, `https://contoso.onmicrosoft.com/00001111-aaaa-2222-bbbb-3333cccc4444/API.Access` or the custom URI that you configured in the Azure portal).
326326

327327
The <xref:Microsoft.Extensions.DependencyInjection.MsalWebAssemblyServiceCollectionExtensions.AddMsalAuthentication%2A> method accepts a callback to configure the parameters required to authenticate an app. The values required for configuring the app can be obtained from the Azure Portal AAD configuration when you register the app.
328328

0 commit comments

Comments
 (0)