Skip to content

Commit 3c479b0

Browse files
authored
Minor ReadMe updates and config files for Secret Manager (#379)
1 parent c596200 commit 3c479b0

28 files changed

+183
-27
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@ 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.AddMicrosoftWebAppAuthentication(Configuration, options =>
68-
{
69-
Configuration.Bind("AzureAd", options);
70-
// Restrict users to specific belonging to specific tenants
71-
options.TokenValidationParameters.IssuerValidator = ValidateSpecificIssuers;
72-
}, options => Configuration.Bind("AzureAd", options));
67+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
68+
.AddMicrosoftWebApp(options =>
69+
{
70+
Configuration.Bind("AzureAd", options);
71+
// Restrict users to specific belonging to specific tenants
72+
options.TokenValidationParameters.IssuerValidator = ValidateSpecificIssuers;
73+
});
7374
...
7475
```
7576

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}

1-WebApp-OIDC/1-3-AnyOrgOrPersonal/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,17 +147,15 @@ In the **appsettings.json** file:
147147
.AddAzureAD(options => Configuration.Bind("AzureAd", options));
148148
```
149149
150-
by this line:
150+
- by this line:
151151
152152
```CSharp
153-
154-
services.AddMicrosoftWebAppAuthentication(Configuration);
155-
153+
services.AddMicrosoftWebAppAuthentication(Configuration);
156154
```
157155
158-
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.
156+
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.
159157
160-
1. Change the `Properties\launchSettings.json` file to ensure that you start your web app from <https://localhost:44321> as registered. For this:
158+
1. Change the `Properties\launchSettings.json` file to ensure that you start your web app from <https://localhost:44321> as registered. For this:
161159
- update the `sslPort` of the `iisSettings` section to be `44321`
162160
- in the `applicationUrl` property of use `https://localhost:44321`
163161
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ These steps are encapsulated in the [Microsoft.Identity.Web](..\..\Microsoft.Ide
236236
In order to be able to sign-in users from multiple tenants, the [/common endpoint](https://docs.microsoft.com/azure/active-directory/develop/howto-convert-app-to-be-multi-tenant#update-your-code-to-send-requests-to-common) must be used. In the sample, this endpoint is used as a result of setting the value for `TenantId` as `organizations` on the `appsettings.json` file, and configuring the middleware to read the values from it.
237237

238238
```csharp
239-
services.AddAuthentication(AzureADDefaults.AuthenticationScheme)
240-
.AddAzureAD(options => configuration.Bind(configSectionName, options));
239+
services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
240+
.AddMicrosoftWebApp(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).
@@ -282,7 +282,7 @@ options.TokenValidationParameters.IssuerValidator = AadIssuerValidator.GetIssuer
282282
To extend this validation to only Azure AD tenants registered in the application database, the event handler `OnTokenValidated` was configured to grab the `tenantId` from the token claims and check if it has an entry on the database. If it doesn't, a custom exception `UnauthorizedTenantException` is thrown, canceling the authentication, and the user is redirected to the `UnauthorizedTenant` view. At this stage, the user is not authenticated in the application.
283283

284284
```csharp
285-
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
285+
services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options =>
286286
{
287287
options.Events.OnTokenValidated = async context =>
288288
{
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets"
5+
}
6+
}
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"dependencies": {
3+
"secrets1": {
4+
"type": "secrets.user"
5+
}
6+
}
7+
}

5-WebApp-AuthZ/5-2-Groups/Startup.cs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,24 +38,13 @@ public void ConfigureServices(IServiceCollection services)
3838
// Sign-in users with the Microsoft identity platform
3939
services.AddMicrosoftWebAppAuthentication(Configuration)
4040
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { "User.Read", "Directory.Read.All" })
41-
42-
// If you want to use group ids/names in the Authorize attribute then uncomment the following lines:
43-
//services.Configure<OpenIdConnectOptions>(options =>
44-
// {
45-
// // Uncomment the following lines code instruct the asp.net core middleware to use the data in the "groups" claim in the [Authorize] attribute and for User.IsInrole()
46-
// // See https://docs.microsoft.com/en-us/aspnet/core/security/authorization/roles for more info.
47-
// // Use the groups claim for populating roles
48-
// options.TokenValidationParameters.RoleClaimType = "groups";
49-
// })
50-
5141
.AddInMemoryTokenCaches();
5242

5343
services.AddMSGraphService(Configuration);
5444

5545
services.Configure<OpenIdConnectOptions>(OpenIdConnectDefaults.AuthenticationScheme, options => {
56-
// Uncomment the following lines code instruct the asp.net core middleware to use the data in the "groups" claim in the [Authorize] attribute and for User.IsInrole()
46+
// The following code instructs the ASP.NET Core middleware to use the data in the "groups" claim in the [Authorize] attribute and for User.IsInRole()
5747
// See https://docs.microsoft.com/en-us/aspnet/core/security/authorization/roles for more info.
58-
// Use the groups claim for populating roles
5948
options.TokenValidationParameters.RoleClaimType = "groups";
6049
});
6150

0 commit comments

Comments
 (0)