Skip to content

Commit c627919

Browse files
author
Tiago Brenck
authored
Merge pull request #215 from Azure-Samples/tibre/multiTenantSample
National clouds readme
2 parents 98d5240 + b9f5090 commit c627919

File tree

5 files changed

+421
-27
lines changed

5 files changed

+421
-27
lines changed

2-WebApp-graph-user/2-3-Multi-Tenant/Controllers/OnboardingController.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2727
using Microsoft.AspNetCore.Authorization;
2828
using Microsoft.AspNetCore.Http.Extensions;
2929
using Microsoft.AspNetCore.Mvc;
30+
using Microsoft.Extensions.Configuration;
3031
using Microsoft.Extensions.Options;
3132
using System;
3233
using System.Linq;
@@ -41,11 +42,13 @@ public class OnboardingController : Controller
4142
{
4243
private readonly SampleDbContext dbContext;
4344
private readonly AzureADOptions azureADOptions;
45+
private readonly IConfiguration configuration;
4446

45-
public OnboardingController(SampleDbContext dbContext, IOptions<AzureADOptions> azureADOptions)
47+
public OnboardingController(SampleDbContext dbContext, IOptions<AzureADOptions> azureADOptions, IConfiguration configuration)
4648
{
4749
this.dbContext = dbContext;
4850
this.azureADOptions = azureADOptions.Value;
51+
this.configuration = configuration;
4952
}
5053

5154
[HttpGet]
@@ -86,7 +89,7 @@ public IActionResult Onboard()
8689
Uri.EscapeDataString(azureADOptions.ClientId), // The application Id as obtained from the Azure Portal
8790
Uri.EscapeDataString(currentUri + "Onboarding/ProcessCode"), // Uri that the admin will be redirected to after the consent
8891
Uri.EscapeDataString(stateMarker), // The state parameter is used to validate the response, preventing a man-in-the-middle attack, and it will also be used to identify this request in the ProcessCode action.
89-
Uri.EscapeDataString("https://graph.microsoft.com/.default")); // The scopes to be presented to the admin to consent. Here we are using the static scope '/.default' (https://docs.microsoft.com/azure/active-directory/develop/v2-permissions-and-consent#the-default-scope).
92+
Uri.EscapeDataString(configuration.GetValue<string>("GraphAPI:StaticScope"))); // The scopes to be presented to the admin to consent. Here we are using the static scope '/.default' (https://docs.microsoft.com/azure/active-directory/develop/v2-permissions-and-consent#the-default-scope).
9093

9194
return Redirect(authorizationRequest);
9295
}

0 commit comments

Comments
 (0)