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
Currently, theASP.NETCoretemplatescreateAzureActiveDirectory (AzureAD) webAPIsthatsigninuserswithinyourorganizationoranyorganization. Theydon'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, theASP.NETCoretemplatescreateAzureActiveDirectory (AzureAD) webAPIsthatsigninuserswithinyourorganizationoranyorganization. Theydon'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:
ThisprecedingcodesnippetisextractedfromtheASP.NETCorewebAPIincrementaltutorialin [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
+
TheprecedingcodesnippetisextractedfromtheASP.NETCorewebAPIincrementaltutorialin [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.
135
135
136
136
## Token validation
137
137
@@ -149,7 +149,7 @@ There can also be special validations. For example, it's possible to validate th
149
149
150
150
Thevalidationstepsarecapturedinvalidators, whichareprovidedbythe [MicrosoftIdentityModelExtensionsfor .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).
151
151
152
-
Thevalidatorsaredescribedinthistable:
152
+
Thistabledescribesthevalidators:
153
153
154
154
|Validator|Description|
155
155
|---------|---------|
@@ -160,9 +160,9 @@ The validators are described in this table:
160
160
|**ValidateSignature**|Ensuresthetokenhasn't been tampered with. |
Thevalidatorsareassociatedwithpropertiesofthe**TokenValidationParameters**class. ThepropertiesareinitializedfromtheASP.NETandASP.NETCoreconfiguration.Inmostcases, youdon't need to change the parameters.
Appsthataren'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
+
Inmostcases, youdon't need to change the parameters. Apps that aren'tsingletenantsareexceptions. ThesewebappsacceptusersfromanyorganizationorfrompersonalMicrosoftaccounts. Issuersinthiscasemustbevalidated.
Copy file name to clipboardExpand all lines: articles/active-directory/develop/scenario-protected-web-api-app-registration.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ After you create the application, you can determine or change the accepted token
52
52
53
53
Web APIs don't need to register a redirect URI because no user is interactively signed in.
54
54
55
-
## Expose an API
55
+
## Exposed API
56
56
57
57
Other settings specific to web APIs are the exposed API and the exposed scopes.
58
58
@@ -132,7 +132,7 @@ The web API checks for the app role. This role is a software developer's way to
132
132
To add this increased security:
133
133
134
134
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 ...**
Copy file name to clipboardExpand all lines: articles/active-directory/develop/scenario-protected-web-api-verification-scope-app-roles.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ But this protection isn't enough. It guarantees only that ASP.NET and ASP.NET Co
52
52
- The *scopes* if the API is called on behalf of a user.
53
53
- The *app roles* if the API can be called from a daemon app.
54
54
55
-
## Verifying scopes in APIs called on behalf of users
55
+
## Verify scopes in APIs called on behalf of users
56
56
57
57
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).
58
58
@@ -81,7 +81,7 @@ public class TodoListController : Controller
81
81
The `VerifyUserHasAnyAcceptedScope` method does something like the following steps:
82
82
83
83
- 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.
85
85
86
86
```csharp
87
87
/// <summary>
@@ -113,7 +113,7 @@ The `VerifyUserHasAnyAcceptedScope` method does something like the following ste
113
113
114
114
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.
115
115
116
-
## Verifying app roles in APIs called by daemon apps
116
+
## Verify app roles in APIs called by daemon apps
117
117
118
118
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.
0 commit comments