Skip to content

Commit b502c6d

Browse files
author
Kalyan Krishna
committed
merged
2 parents 1340b2c + d45d76a commit b502c6d

File tree

5 files changed

+12
-25
lines changed

5 files changed

+12
-25
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@ These steps are encapsulated in the [Microsoft.Identity.Web](https://github.com/
232232

233233
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.
234234

235-
NOTE: Guest users in a tenant will not be authenticated if the `https://login.microsoftonline.com/common/` endpoint is used as the authority to sign in users. `TenantId` will be required for those users.
236-
237235
```csharp
238236
services.AddSignIn(Configuration);
239237
```

4-WebApp-your-API/4-3-AnyOrg/Readme.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ As a first step you'll need to:
146146
1. Select **New registration**.
147147
1. In the **Register an application page** that appears, enter your application's registration information:
148148
- In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example `WebApi-MultiTenant-v2`.
149-
- Under **Supported account types**, select **Accounts in any organizational directory and personal Microsoft accounts (e.g. Skype, Xbox, Outlook.com)**.
149+
- Under **Supported account types**, select **Accounts in any organizational directory**.
150150
- In the **Redirect URI** section, select **Web** in the combo-box and enter the following redirect URI: `https://localhost:44351/api/Home`.
151151
1. Select **Register** to create the application.
152152
1. In the app's registration screen, find and note the **Application (client) ID**. You use this value in your app's configuration file(s) later in your code.
@@ -195,7 +195,7 @@ Open the project in your IDE (like Visual Studio) to configure the code.
195195
1. Select **New registration**.
196196
1. In the **Register an application page** that appears, enter your application's registration information:
197197
- In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example `WebApp-MultiTenant-v2`.
198-
- Under **Supported account types**, select **Accounts in any organizational directory and personal Microsoft accounts (e.g. Skype, Xbox, Outlook.com)**.
198+
- Under **Supported account types**, select **Accounts in any organizational directory**.
199199
- In the **Redirect URI (optional)** section, select **Web** in the combo-box and enter the following redirect URI: `https://localhost:44321/`.
200200
> Note that there are more than one redirect URIs used in this sample. You'll need to add them from the **Authentication** tab later after the app has been created successfully.
201201
1. Select **Register** to create the application.
@@ -205,9 +205,6 @@ Open the project in your IDE (like Visual Studio) to configure the code.
205205
- In the **Redirect URIs** section, enter the following redirect URIs.
206206
- `https://localhost:44321/signin-oidc`
207207
- In the **Logout URL** section, set it to `https://localhost:44321/signout-oidc`.
208-
- In the **Implicit grant** section, check **ID tokens** as this sample requires
209-
the [Implicit grant flow](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-implicit-grant-flow) to be enabled to
210-
sign-in the user, and call an API.
211208
1. Select **Save** to save your changes.
212209
1. In the app's registration screen, click on the **Certificates & secrets** blade in the left to open the page where we can generate secrets and upload certificates.
213210
1. In the **Client secrets** section, click on **New client secret**:
@@ -219,7 +216,7 @@ Open the project in your IDE (like Visual Studio) to configure the code.
219216
- Click the **Add a permission** button and then,
220217
- Ensure that the **My APIs** tab is selected.
221218
- In the list of APIs, select the API `WebApi-MultiTenant-v2`.
222-
- In the **Delegated permissions** section, select the **access_as_user** in the list. Use the search box if necessary.
219+
- In the **Delegated permissions** section, select the **Access 'WebApi-MultiTenant-v2'** in the list. Use the search box if necessary.
223220
- Click on the **Add permissions** button at the bottom.
224221

225222
##### Configure the Web App (WebApp-MultiTenant-v2) to use your app registration
@@ -258,7 +255,7 @@ This behavior is expected as the browser is not authenticated. The Web applicati
258255
##### Step 1. Install .NET Core dependencies
259256

260257
```console
261-
cd TodoListAPI
258+
cd TodoListService
262259
dotnet restore
263260
```
264261

@@ -351,15 +348,15 @@ Once it finishes, your applications service principal will be provisioned in tha
351348

352349
### Provisioning your Multi-tenant Apps in another Azure AD Tenant
353350

354-
Often the user-based consent will be disabled in an Azure AD tenant or your application will be requesting permissions that requires a tenant-admin consent. In these scenarios, your application will need to utilize the `/adminconsent` endpoint to provision both the **ToDoListClient** and the **TodoListAPI** before the users from that tenant are able to sign-in to your app.
351+
Often the user-based consent will be disabled in an Azure AD tenant or your application will be requesting permissions that requires a tenant-admin consent. In these scenarios, your application will need to utilize the `/adminconsent` endpoint to provision both the **ToDoListClient** and the **TodoListService** before the users from that tenant are able to sign-in to your app.
355352

356-
When provisioning, you have to take care of the dependency in the topology where the **ToDoListClient** is dependent on **TodoListAPI**. So in such a case, you would provision the **TodoListAPI** before the **ToDoListClient**.
353+
When provisioning, you have to take care of the dependency in the topology where the **ToDoListClient** is dependent on **TodoListService**. So in such a case, you would provision the **TodoListService** before the **ToDoListClient**.
357354

358355
### Code for the Web App (TodoListClient)
359356

360357
####
361358

362-
In `Startup.cs`, below lines of code enables Microsoft identity platform endpoint. This endpoint is capable of signing-in users both with their Work and School and Microsoft Personal accounts.
359+
In `Startup.cs`, below lines of code enables Microsoft identity platform endpoint. This endpoint is capable of signing-in users both with their Work and School.
363360
```csharp
364361
services.AddMicrosoftWebAppAuthentication(Configuration)
365362
.AddMicrosoftWebAppCallsWebApi(Configuration, new string[] { Configuration["TodoList:TodoListScope"] })
@@ -469,7 +466,7 @@ public IActionResult AdminConsent()
469466

470467
#### Choosing which scopes to expose
471468

472-
This sample exposes a delegated permission (access_as_user) that will be presented in the access token claim. The method `AddProtectedWebApi` does not validate the scope, but Microsoft.Identity.Web has a HttpContext extension method, `VerifyUserHasAnyAcceptedScope`, where you can validate the scope as below:
469+
This sample exposes a delegated permission (access_as_user) that will be presented in the access token claim. The method `AddMicrosoftWebApi` does not validate the scope, but Microsoft.Identity.Web has a HttpContext extension method, `VerifyUserHasAnyAcceptedScope`, where you can validate the scope as below:
473470

474471
```csharp
475472
HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi);

4-WebApp-your-API/4-3-AnyOrg/ToDoListClient/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"ClientId": "[Enter the Client Id (Application ID obtained from the Azure portal), e.g. ba74781c2-53c2-442a-97c2-3d60re42f403]",
77
"ClientSecret": "[Copy the client secret added to the app from the Azure portal]",
88
"CallbackPath": "/signin-oidc",
9-
"SignedOutCallbackPath ": "/signout-callback-oidc"
9+
"SignedOutCallbackPath": "/signout-callback-oidc"
1010
},
1111
"Logging": {
1212
"LogLevel": {

4-WebApp-your-API/4-3-AnyOrg/TodoListService/Properties/launchSettings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"environmentVariables": {
2424
"ASPNETCORE_ENVIRONMENT": "Development"
2525
},
26-
"applicationUrl": "http://localhost:1040/"
26+
"applicationUrl": "https://localhost:44351/",
27+
"sslPort": 44351
2728
}
2829
}
2930
}

4-WebApp-your-API/4-3-AnyOrg/TodoListService/appsettings.json

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,7 @@
77
"ClientSecret": "[Copy the client secret added to the app from the Azure portal]",
88
"GraphAPI": "https://graph.microsoft.com/v1.0"
99
},
10-
"Kestrel": {
11-
"Endpoints": {
12-
"Http": {
13-
"Url": "http://localhost:1040"
14-
},
15-
"Https": {
16-
"Url": "https://localhost:44351"
17-
}
18-
}
19-
},
10+
"https_port": 44351,
2011
"Logging": {
2112
"LogLevel": {
2213
"Default": "Information",

0 commit comments

Comments
 (0)