Skip to content

Commit 2d20662

Browse files
committed
update api to preview 0.3.0
1 parent c361cdc commit 2d20662

File tree

28 files changed

+88
-79
lines changed

28 files changed

+88
-79
lines changed

2-WebApp-graph-user/2-1-Call-MSGraph/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ After the following lines in the ConfigureServices(IServiceCollection services)
100100
public void ConfigureServices(IServiceCollection services)
101101
{
102102
. . .
103-
services.AddMicrosoftWebAppAuthentication(Configuration)
104-
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { Constants.ScopeUserRead })
105-
.AddInMemoryTokenCaches();
103+
services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
104+
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { Constants.ScopeUserRead })
105+
.AddInMemoryTokenCaches();
106106
```
107107

108108
The two new lines of code:
@@ -281,7 +281,7 @@ HTML table displaying the properties of the *me* object as returned by Microsoft
281281
## Next steps
282282

283283
- Learn how to enable distributed caches in [token cache serialization](../2-2-TokenCache)
284-
- Learn how the same principle you've just learnt can be used to call:
284+
- Learn how the same principle you've just learned can be used to call:
285285
- [several Microsoft APIs](../../3-WebApp-multi-APIs), which will enable you to learn how incremental consent and conditional access is managed in your Web App
286286
- 3rd party, or even [your own Web API](../../4-WebApp-your-API), which will enable you to learn about custom scopes
287287

2-WebApp-graph-user/2-1-Call-MSGraph/Startup.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public void ConfigureServices(IServiceCollection services)
4040

4141
services.AddOptions();
4242

43-
services.AddMicrosoftWebAppAuthentication(Configuration)
44-
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { Constants.ScopeUserRead })
45-
.AddInMemoryTokenCaches();
43+
services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
44+
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { Constants.ScopeUserRead })
45+
.AddInMemoryTokenCaches();
4646
/*
4747
// or use a distributed Token Cache by adding
4848
.AddDistributedTokenCaches();

2-WebApp-graph-user/2-2-TokenCache/README-incremental-instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ public void ConfigureServices(IServiceCollection services)
9696
. . .
9797
// Token acquisition service based on MSAL.NET
9898
// and the Sql server based token cache implementation
99-
services.AddMicrosoftWebAppAuthentication(Configuration)
100-
.AddMicrosoftWebAppCallsWebApi(new string[] { Constants.ScopeUserRead })
99+
services.AddMicrosoftIdentityWebAppAuthentication(Configuration)
100+
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { Constants.ScopeUserRead })
101101
.AddSqlAppTokenCache(Configuration)
102102
.AddSqlPerUserTokenCache(Configuration);
103103
```

2-WebApp-graph-user/2-2-TokenCache/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,9 @@ public void ConfigureServices(IServiceCollection services)
186186
{
187187
. . .
188188
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
189-
.AddMicrosoftWebApp(Configuration)
190-
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { Constants.ScopeUserRead })
191-
.AddDistributedTokenCaches();
189+
.AddMicrosoftIdentityWebApp(Configuration)
190+
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { Constants.ScopeUserRead })
191+
.AddDistributedTokenCaches();
192192

193193
services.AddDistributedSqlServerCache(options =>
194194
{

2-WebApp-graph-user/2-2-TokenCache/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ dotnet tool install --global dotnet-sql-cache
5555
*/
5656

5757
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
58-
.AddMicrosoftWebApp(Configuration)
59-
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { Constants.ScopeUserRead })
58+
.AddMicrosoftIdentityWebApp(Configuration)
59+
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { Constants.ScopeUserRead })
6060
.AddDistributedTokenCaches();
6161

6262
services.AddDistributedSqlServerCache(options =>

2-WebApp-graph-user/2-3-Multi-Tenant/README-National-Cloud.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ In order to be able to sign-in users from multiple tenants, the [/common endpoin
237237

238238
```csharp
239239
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
240-
.AddMicrosoftWebApp(Configuration)
240+
.AddMicrosoftIdentityWebApp(Configuration)
241241
```
242242

243243
You can read about the various endpoints of the Microsoft Identity Platform [here](https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols#endpoints).

2-WebApp-graph-user/2-3-Multi-Tenant/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ In order to be able to sign-in users from multiple tenants, the [/common endpoin
234234

235235
```csharp
236236
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
237-
.AddMicrosoftWebApp(Configuration)
237+
.AddMicrosoftIdentityWebApp(Configuration)
238238
```
239239

240240
You can read about the various endpoints of the Microsoft Identity Platform [here](https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols#endpoints).

2-WebApp-graph-user/2-3-Multi-Tenant/Startup.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void ConfigureServices(IServiceCollection services)
5757

5858
// Sign-in users with the Microsoft identity platform
5959
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
60-
.AddMicrosoftWebApp(options =>
60+
.AddMicrosoftIdentityWebApp(options =>
6161
{
6262
Configuration.Bind("AzureAd", options);
6363
options.Events.OnTokenValidated = async context =>
@@ -85,7 +85,12 @@ public void ConfigureServices(IServiceCollection services)
8585
return Task.FromResult(0);
8686
};
8787
})
88-
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { GraphScope.UserReadAll })
88+
.EnableTokenAcquisitionToCallDownstreamApi(
89+
options =>
90+
{
91+
Configuration.Bind("AzureAd", options);
92+
},
93+
new string[] { GraphScope.UserReadAll })
8994
.AddInMemoryTokenCaches();
9095

9196
services.AddControllersWithViews(options =>

2-WebApp-graph-user/2-4-Sovereign-Call-MSGraph/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ After the following lines in the ConfigureServices(IServiceCollection services)
9292
{
9393
. . .
9494
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
95-
.AddMicrosoftWebApp(Configuration)
95+
.AddMicrosoftIdentityWebApp(Configuration)
9696

9797
// Token acquisition service based on MSAL.NET
9898
// and chosen token cache implementation
99-
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { Constants.ScopeUserRead });
100-
services.AddInMemoryTokenCaches();
99+
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { Constants.ScopeUserRead })
100+
.AddInMemoryTokenCaches();
101101
```
102102

103103
The two new lines of code:
@@ -214,7 +214,7 @@ HTML table displaying the properties of the *me* object as returned by Microsoft
214214
## Next steps
215215

216216
- Learn how to enable distributed caches in [token cache serialization](../2-2-TokenCache)
217-
- Learn how the same principle you've learnt can be used to call:
217+
- Learn how the same principle you've learned can be used to call:
218218
- [several Microsoft APIs](../../3-WebApp-multi-APIs), which will enable you to learn how incremental consent and conditional access is managed in your Web App
219219
- Third party, or even [your own Web API](../../4-WebApp-your-API), which will enable you to learn about custom scopes
220220

2-WebApp-graph-user/2-4-Sovereign-Call-MSGraph/Startup.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,13 @@ public void ConfigureServices(IServiceCollection services)
4242
services.AddOptions();
4343

4444
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
45-
.AddMicrosoftWebApp(Configuration)
45+
.AddMicrosoftIdentityWebApp(Configuration)
4646

4747
// Token acquisition service based on MSAL.NET
4848
// and chosen token cache implementation
49-
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { Constants.ScopeUserRead });
50-
services.AddInMemoryTokenCaches();
49+
.EnableTokenAcquisitionToCallDownstreamApi(new string[] { Constants.ScopeUserRead })
50+
.AddInMemoryTokenCaches()
51+
.AddInMemoryTokenCaches();
5152

5253
// Add Graph
5354
services.AddGraphService(Configuration);

0 commit comments

Comments
 (0)