Skip to content

Commit 9c7c489

Browse files
author
John Luo
committed
Use default-scopes for validation
1 parent 82af6a3 commit 9c7c489

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/.template.config/template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@
340340
"type": "parameter",
341341
"datatype": "string",
342342
"replaces": "api-scope",
343-
"defaultValue": "user_impersonation",
343+
"defaultValue": "access_as_user",
344344
"description": "The API scope the client needs to request to provision an access token. (use with IndividualB2C, SingleOrg)."
345345
},
346346
"TenantId": {

src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Server/Controllers/WeatherForecastController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
using Microsoft.Graph;
1616
#endif
1717
using Microsoft.AspNetCore.Mvc;
18-
#if (OrganizationalAuth || (IndividualB2CAuth && !Hosted))
18+
#if (OrganizationalAuth || IndividualB2CAuth)
1919
using Microsoft.Identity.Web.Resource;
2020
#endif
2121
using Microsoft.Extensions.Logging;
@@ -38,7 +38,7 @@ public class WeatherForecastController : ControllerBase
3838
private readonly ILogger<WeatherForecastController> _logger;
3939

4040
// The Web API will only accept tokens 1) for users, and 2) having the access_as_user scope for this API
41-
static readonly string[] scopeRequiredByApi = new string[] { "access_as_user" };
41+
static readonly string[] scopeRequiredByApi = new string[] { "api-scope" };
4242

4343
#if (GenerateApi)
4444
private readonly IDownstreamWebApi _downstreamWebApi;
@@ -101,7 +101,7 @@ public WeatherForecastController(ILogger<WeatherForecastController> logger)
101101
[HttpGet]
102102
public IEnumerable<WeatherForecast> Get()
103103
{
104-
#if (OrganizationalAuth || (IndividualB2CAuth && !Hosted))
104+
#if (OrganizationalAuth || IndividualB2CAuth)
105105
HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi);
106106

107107
#endif

0 commit comments

Comments
 (0)