Skip to content

Commit 0e1dca1

Browse files
author
BobbySchmidt2
committed
scenario-protected-web-api
1 parent 32c980f commit 0e1dca1

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

articles/active-directory/develop/scenario-protected-web-api-app-configuration.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ The middleware is added to the web API by this instruction:
109109
services.AddAzureAdBearer(options => Configuration.Bind("AzureAd", options));
110110
```
111111

112-
Currently, the ASP.NET Core templates create Azure Active Directory (Azure AD) web APIs that sign in users within your organization or any organization. They don't sign in users with personal accounts. But you can change the templates to use the Microsoft identity platform endpoint by adding this code to the Startup.cs file:
112+
Currently, the ASP.NET Core templates create Azure Active Directory (Azure AD) web APIs that sign in users within your organization or any organization. They don't sign in users with personal accounts. But you can change the templates to use the Microsoft identity platform endpoint by adding this code to Startup.cs:
113113

114114
```csharp
115115
services.Configure<JwtBearerOptions>(AzureADDefaults.JwtBearerAuthenticationScheme, options =>
@@ -131,7 +131,7 @@ services.Configure<JwtBearerOptions>(AzureADDefaults.JwtBearerAuthenticationSche
131131
});
132132
```
133133

134-
This preceding code snippet is extracted from the ASP.NET Core web API incremental tutorial in [Microsoft.Identity.Web/WebApiServiceCollectionExtensions.cs#L50-L63](https://github.com/Azure-Samples/active-directory-dotnet-native-aspnetcore-v2/blob/154282843da2fc2958fad151e2a11e521e358d42/Microsoft.Identity.Web/WebApiServiceCollectionExtensions.cs#L50-L63). The **AddProtectedWebApi** method, which does more than the snippet shows, is called from Startup.cs.
134+
The preceding code snippet is extracted from the ASP.NET Core web API incremental tutorial in [Microsoft.Identity.Web/WebApiServiceCollectionExtensions.cs#L50-L63](https://github.com/Azure-Samples/active-directory-dotnet-native-aspnetcore-v2/blob/154282843da2fc2958fad151e2a11e521e358d42/Microsoft.Identity.Web/WebApiServiceCollectionExtensions.cs#L50-L63). The **AddProtectedWebApi** method, which does more than the snippet shows, is called from Startup.cs.
135135
136136
## Token validation
137137

@@ -149,7 +149,7 @@ There can also be special validations. For example, it's possible to validate th
149149

150150
The validation steps are captured in validators, which are provided by the [Microsoft IdentityModel Extensions for .NET](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet) open-source library. The validators are defined in the library source file [Microsoft.IdentityModel.Tokens/Validators.cs](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/blob/master/src/Microsoft.IdentityModel.Tokens/Validators.cs).
151151
152-
The validators are described in this table:
152+
This table describes the validators:
153153

154154
| Validator | Description |
155155
|---------|---------|
@@ -160,9 +160,9 @@ The validators are described in this table:
160160
| **ValidateSignature** | Ensures the token hasn't been tampered with. |
161161
| **ValidateTokenReplay** | Ensures the token isn't replayed. There's a special case for some onetime-use protocols. |
162162

163-
The validators are associated with properties of the **TokenValidationParameters** class. The properties are initialized from the ASP.NET and ASP.NET Core configuration. In most cases, you don't need to change the parameters.
163+
The validators are associated with properties of the **TokenValidationParameters** class. The properties are initialized from the ASP.NET and ASP.NET Core configuration.
164164

165-
Apps that aren't single tenants are exceptions. These web apps accept users from any organization or from personal Microsoft accounts. In this case, issuers must be validated.
165+
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.
166166

167167
## Token validation in Azure Functions
168168

articles/active-directory/develop/scenario-protected-web-api-app-registration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ After you create the application, you can determine or change the accepted token
5252

5353
Web APIs don't need to register a redirect URI because no user is interactively signed in.
5454

55-
## Expose an API
55+
## Exposed API
5656

5757
Other settings specific to web APIs are the exposed API and the exposed scopes.
5858

@@ -132,7 +132,7 @@ The web API checks for the app role. This role is a software developer's way to
132132
To add this increased security:
133133

134134
1. Go to the app **Overview** page for your app registration.
135-
1. Under **Managed application in local directory**, select the link with the name of your app. The name of this selection might be truncated. For example, you might see **Managed application in ...**
135+
1. Under **Managed application in local directory**, select the link with the name of your app. The label for this selection might be truncated. For example, you might see **Managed application in ...**
136136

137137
> [!NOTE]
138138
>

articles/active-directory/develop/scenario-protected-web-api-verification-scope-app-roles.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ But this protection isn't enough. It guarantees only that ASP.NET and ASP.NET Co
5252
- The *scopes* if the API is called on behalf of a user.
5353
- The *app roles* if the API can be called from a daemon app.
5454

55-
## Verifying scopes in APIs called on behalf of users
55+
## Verify scopes in APIs called on behalf of users
5656

5757
If a client app calls your API on behalf of a user, the API needs to request a bearer token that has specific scopes for the API. For more information, see [Code configuration | Bearer token](scenario-protected-web-api-app-configuration.md#bearer-token).
5858

@@ -81,7 +81,7 @@ public class TodoListController : Controller
8181
The `VerifyUserHasAnyAcceptedScope` method does something like the following steps:
8282

8383
- Verify there's a claim named `http://schemas.microsoft.com/identity/claims/scope` or `scp`.
84-
- Verify that the claim has a value that contains the scope expected by the API.
84+
- Verify the claim has a value that contains the scope expected by the API.
8585

8686
```csharp
8787
/// <summary>
@@ -113,7 +113,7 @@ The `VerifyUserHasAnyAcceptedScope` method does something like the following ste
113113

114114
The preceding [sample code](https://github.com/Azure-Samples/active-directory-dotnet-native-aspnetcore-v2/blob/02352945c1c4abb895f0b700053506dcde7ed04a/Microsoft.Identity.Web/Resource/ScopesRequiredByWebAPIExtension.cs#L47) is for ASP.NET Core. For ASP.NET, just replace `HttpContext.User` with `ClaimsPrincipal.Current`, and replace the claim type `"http://schemas.microsoft.com/identity/claims/scope"` with `"scp"`. Also see the code snippet later in this article.
115115

116-
## Verifying app roles in APIs called by daemon apps
116+
## Verify app roles in APIs called by daemon apps
117117

118118
If your web API is called by a [daemon app](scenario-daemon-overview.md), that app should require an application permission to your web API. As shown in [Exposing application permissions (app roles)](https://docs.microsoft.com/azure/active-directory/develop/scenario-protected-web-api-app-registration#exposing-application-permissions-app-roles), your API exposes such permissions. One example is the `access_as_application` app role.
119119

0 commit comments

Comments
 (0)