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
> A client application requests the bearer token to the Microsoft identity platform *for the web API*. The web API is the only application that should verify the token and view the claims it contains. Client apps should never try to inspect the claims in tokens.
52
+
> A client application requests the bearer token to the Microsoft identity platform *for the web API*. The API is the only application that should verify the token and view the claims it contains. Client apps should never try to inspect the claims in tokens.
53
53
>
54
54
> In the future, the web API might require that the token be encrypted. This requirement would prevent access for client apps that can view access tokens.
55
55
@@ -59,7 +59,7 @@ This section describes how to configure a bearer token.
59
59
60
60
### Config file
61
61
62
-
You need specify the TenantId only if you want to accept access tokens from a single tenant (line-of-business app). Otherwise, it can be left as `common`. The different values can be:
62
+
You need specify the `TenantId` only if you want to accept access tokens from a single tenant (line-of-business app). Otherwise, it can be left as `common`. The different values can be:
63
63
- A GUID (Tenant ID = Directory ID)
64
64
-`common` can be any organization and personal accounts
65
65
-`organizations` can be any organization
@@ -81,7 +81,7 @@ You need specify the TenantId only if you want to accept access tokens from a si
81
81
}
82
82
```
83
83
84
-
#### Case where you used a custom App ID URI for your web API
84
+
#### Using a custom App ID URI for a web API
85
85
86
86
If you've accepted the default App ID URI proposed by the Azure portal, you don't need to specify the audience (see [Application ID URI and scopes](scenario-protected-web-api-app-registration.md#scopes-and-the-application-id-uri)). Otherwise, add an `Audience` property whose value is the App ID URI for your web API. This typically starts with `api://`.
87
87
@@ -93,7 +93,6 @@ If you've accepted the default App ID URI proposed by the Azure portal, you don'
93
93
"TenantId": "common",
94
94
"Audience": "Enter_the_Application_ID_URI_here"
95
95
},
96
-
// more lines
97
96
}
98
97
```
99
98
@@ -105,7 +104,7 @@ When an app is called on a controller action that holds an **[Authorize]** attri
105
104
106
105
Microsoft recommends you use the [Microsoft.Identity.Web](https://www.nuget.org/packages/Microsoft.Identity.Web) NuGet package when developing a web API with ASP.NET Core.
107
106
108
-
_Microsoft.Identity.Web_ provides the glue between ASP.NET Core, the authentication middleware, and the [Microsoft Authentication Library (MSAL)](msal-overview.md) for .NET. It allows for a clearer, more robust developer experience and leverages the power of the Microsoft identity platform and Azure AD B2C.
107
+
*Microsoft.Identity.Web* provides the glue between ASP.NET Core, the authentication middleware, and the [Microsoft Authentication Library (MSAL)](msal-overview.md) for .NET. It allows for a clearer, more robust developer experience and leverages the power of the Microsoft identity platform and Azure AD B2C.
109
108
110
109
#### ASP.NET for .NET 6.0
111
110
@@ -120,7 +119,7 @@ dotnet new webapi --auth SingleOrg
120
119
121
120
**Visual Studio** - To create a web API project in Visual Studio, select **File** > **New** > **Project** > **ASP.NET Core Web API**.
122
121
123
-
Both the .NET CLI and Visual Studio project templates create a _Program.cs_ file that looks similar this code snippet. Notice the`Microsoft.Identity.Web` using directive and the lines containing authentication and authorization.
122
+
Both the .NET CLI and Visual Studio project templates create a *Program.cs* file that looks similar this code snippet. Notice `Microsoft.Identity.Web` using directive and the lines containing authentication and authorization.
124
123
125
124
```csharp
126
125
usingMicrosoft.AspNetCore.Authentication;
@@ -186,7 +185,7 @@ This table describes the validators:
186
185
187
186
#### Customizing token validation
188
187
189
-
The validators are associated with properties of the **TokenValidationParameters** class. The properties are initialized from the ASP.NET and ASP.NET Core configuration.
188
+
The validators are associated with properties of the *TokenValidationParameters* class. The properties are initialized from the ASP.NET and ASP.NET Core configuration.
190
189
191
190
In most cases, you don't need to change the parameters. Apps that aren't single tenants are exceptions. These web apps accept users from any organization or from personal Microsoft accounts. Issuers in this case must be validated. Microsoft.Identity.Web takes care of the issuer validation as well.
0 commit comments