Skip to content

Commit 43131b5

Browse files
author
Kalyan Krishna
committed
Merge branch 'kkrishna/updates2019' of https://github.com/Azure-Samples/active-directory-dotnet-webapi-manual-jwt-validation into kkrishna/updates2019
2 parents 1fcfaff + 5efe765 commit 43131b5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ endpoint: AAD v2.0
1515

1616
A Web API that accepts bearer token is secured by [validating the token](https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens#validating-tokens) they receive from callers. When a developer generates a skeleton Web API code using [Visual Studio](https://aka.ms/vsdownload), token validation libraries and code to carry out basic token validation is automatically generated in the project. An example of the generated code using the [asp.net security middleware](https://github.com/aspnet/Security) and [Microsoft Identity Model Extension for .NET](https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet) to validate tokens is provided below.
1717

18-
```CSharp
19-
public void ConfigureAuth(IAppBuilder app)
18+
```CSharp
19+
public void ConfigureAuth(IAppBuilder app)
20+
{
21+
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
22+
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
2023
{
21-
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
22-
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
23-
{
24-
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
25-
TokenValidationParameters = new TokenValidationParameters {
26-
ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
27-
},
28-
});
29-
}
30-
```
24+
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
25+
TokenValidationParameters = new TokenValidationParameters {
26+
ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
27+
},
28+
});
29+
}
30+
```
3131

3232
The code above will validate the issuer, audience, and the signing tokens, which is usually sufficient for most scenarios. But often the developer's requirements are more than what the defaults provide. Examples of these requirements can be:
3333

0 commit comments

Comments
 (0)