Skip to content

Commit c51f1d4

Browse files
author
Tiago Brenck
authored
Merge pull request #315 from Azure-Samples/tibre/updateReadmeCodeSnippet
Updated code snippet according to refactoring
2 parents 0483186 + e1bbf94 commit c51f1d4

File tree

6 files changed

+15
-12
lines changed

6 files changed

+15
-12
lines changed

1-WebApp-OIDC/1-1-MyOrg/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ cd "1-WebApp-OIDC\1-1-MyOrg"
164164
by this line:
165165
166166
```CSharp
167-
services.AddSignIn(Configuration);
167+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
168+
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
168169
```
169170
170171
This enables your application to use the Microsoft identity platform endpoint. This endpoint is capable of signing-in users both with their Work and School and Microsoft Personal accounts.

1-WebApp-OIDC/1-2-AnyOrg/README-1-1-to-1-2.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ In the `Startup.cs` file, in the `ConfigureServices` method, after `services.Add
6464
{
6565
...
6666
// Sign-in users with the Microsoft identity platform
67-
services.AddSignIn(Configuration);
67+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
68+
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
6869

6970
// Restrict users to specific belonging to specific tenants
7071
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>

1-WebApp-OIDC/1-2-AnyOrg/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ cd "1-WebApp-OIDC\1-2-AnyOrg"
156156
by this line:
157157
158158
```CSharp
159-
services.AddSignIn(Configuration);
159+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
160+
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
160161
```
161162
162163
This enables your application to use the Microsoft identity platform endpoint. This endpoint is capable of signing-in users both with their Work and School and Microsoft Personal accounts.

1-WebApp-OIDC/1-4-Sovereign/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ Note that enabling your application for sovereign clouds requires you to:
3232

3333
More details in [Authentication in National Clouds](https://docs.microsoft.com/en-us/azure/active-directory/develop/authentication-national-cloud)
3434

35-
36-
3735
## How to run this sample
3836

3937
To run this sample:
@@ -124,7 +122,8 @@ cd "1-WebApp-OIDC\1-4-Sovereign"
124122
by this line:
125123
126124
```CSharp
127-
services.AddSignIn(Configuration);
125+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
126+
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
128127
```
129128
130129
This enables your application to use the Microsoft identity platform endpoint. This endpoint is capable of signing-in users both with their Work and School and Microsoft Personal accounts.

1-WebApp-OIDC/1-5-B2C/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ You can trigger the middleware to send an OpenID Connect sign-in request by deco
126126
Here is the middleware example:
127127

128128
```csharp
129-
services.AddAuthentication(AzureADB2CDefaults.AuthenticationScheme)
130-
.AddAzureADB2C(options => Configuration.Bind("AzureAdB2C", options));
129+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
130+
.AddSignIn("AzureAdB2C", Configuration, options => Configuration.Bind("AzureAdB2C", options));
131131
```
132132

133133
Important things to notice:
134134

135-
- The method `AddAzureADB2C` will configure the authentication based on the `AzureADB2COptions.cs` options. Feel free to bind more properties on ``AzureAdB2C`` section on ``appsettings.json`` if you need to set more options.
135+
- The method `AddSignIn` will configure the authentication based on the `MicrosoftIdentityOptions.cs` options. Feel free to bind more properties on `AzureAdB2C` section on `appsettings.json` if you need to set more options.
136136
- The urls you set for `CallbackPath` and `SignedOutCallbackPath` should be registered on the **Reply Urls** of your application, in [Azure Portal](https://portal.azure.com).
137137

138138
## Next steps

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,12 @@ After the following lines in the ConfigureServices(IServiceCollection services)
100100
public void ConfigureServices(IServiceCollection services)
101101
{
102102
. . .
103+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
104+
.AddSignIn("AzureAd", Configuration, options => Configuration.Bind("AzureAd", options));
103105
// Token acquisition service based on MSAL.NET
104106
// and chosen token cache implementation
105-
services.AddSignIn(Configuration)
106-
.AddWebAppCallsProtectedWebApi(Configuration, new string[] { Constants.ScopeUserRead })
107-
.AddInMemoryTokenCache();
107+
services.AddWebAppCallsProtectedWebApi(Configuration, new string[] { Constants.ScopeUserRead })
108+
.AddInMemoryTokenCache();
108109
```
109110

110111
The two new lines of code:

0 commit comments

Comments
 (0)