Skip to content

Commit a2ddb13

Browse files
authored
Improving the readme.md with a diagram illustrating the sample (#20)
1 parent 220cf18 commit a2ddb13

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ platforms: dotnet
44
author: jmprieur
55
level: 300
66
client: .NET Framework 4.5 WPF
7-
service: .NET Framework 4.5 web api
7+
service: .NET Framework 4.5 Web Api
88
endpoint: AAD V1
99
---
1010
![](https://identitydivision.visualstudio.com/_apis/public/build/definitions/a7934fdd-dcde-4492-a406-7fad6ac00e17/18/badge)
@@ -13,6 +13,8 @@ endpoint: AAD V1
1313
## About this sample
1414
This sample demonstrates how to manually process a JWT access token in a web API using the JSON Web Token Handler For the Microsoft .Net Framework 4.5. This sample is equivalent to the [NativeClient-DotNet](https://github.com/Azure-Samples/active-directory-dotnet-native-desktop) sample, except that, in the ``TodoListService``, instead of using OWIN middleware to process the token, the token is processed manually in application code. The client, which demonstrates how to acquire a token for this protected API, is unchanged from the [NativeClient-DotNet](https://github.com/Azure-Samples/active-directory-dotnet-native-desktop) sample.
1515

16+
![Topology](./ReadmeFiles/Topology.png)
17+
1618
## Scenario: protecting a Web API - acquiring a token for the protected Web API
1719
When you want to protect a Web API, you request your clients to get a [Security token](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-dev-glossary#security-token) for your API, and you validate it. Usually, for ASP.NET applications this validation is delegated to the OWIN middleware, but you can also validate it yourself, leveraging the ``System.IdentityModel.Tokens.Jwt`` library.
1820

ReadmeFiles/Topology.png

13.1 KB
Loading

TodoListService-ManualJwt/Global.asax.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage
127127
ValidAudience = audience,
128128
ValidIssuer = issuer,
129129
IssuerSigningTokens = signingTokens,
130-
CertificateValidator = X509CertificateValidator.None
130+
CertificateValidator = X509CertificateValidator.None // Certificate validation does not make sense since AAD's metadata document is signed with a self-signed certificate.
131131
};
132132

133133
try

0 commit comments

Comments
 (0)