Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 1ce5255

Browse files
authored
Merge pull request #299 from Azure-Samples/fix-api-permission-bug
Fix the token type helper method
2 parents a0bb7eb + d2f1f1a commit 1ce5255

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

3-Authorization-II/1-call-api/API/TodoListAPI/Controllers/TodoListController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private bool IsAppOnlyToken()
3838
else
3939
{
4040
// alternatively, if an AT contains the roles claim but no scp claim, that indicates it's an app token
41-
return HttpContext.User.Claims.Any(c => c.Type == "roles") && HttpContext.User.Claims.Any(c => c.Type != "scp");
41+
return HttpContext.User.Claims.Any(c => c.Type == "roles") && !HttpContext.User.Claims.Any(c => c.Type == "scp");
4242
}
4343
}
4444

3-Authorization-II/1-call-api/README-incremental.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ private bool IsAppOnlyToken()
324324
else
325325
{
326326
// alternatively, if an AT contains the roles claim but no scp claim, that indicates it's an app token
327-
return HttpContext.User.Claims.Any(c => c.Type == "roles") && HttpContext.User.Claims.Any(c => c.Type != "scp");
327+
return HttpContext.User.Claims.Any(c => c.Type == "roles") && !HttpContext.User.Claims.Any(c => c.Type == "scp");
328328
}
329329
}
330330
```

3-Authorization-II/1-call-api/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ private bool IsAppOnlyToken()
379379
else
380380
{
381381
// alternatively, if an AT contains the roles claim but no scp claim, that indicates it's an app token
382-
return HttpContext.User.Claims.Any(c => c.Type == "roles") && HttpContext.User.Claims.Any(c => c.Type != "scp");
382+
return HttpContext.User.Claims.Any(c => c.Type == "roles") && !HttpContext.User.Claims.Any(c => c.Type == "scp");
383383
}
384384
}
385385
```

6-AdvancedScenarios/2-call-api-mt/API/TodoListAPI/Controllers/TodoListController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ private bool IsAppOnlyToken()
3838
else
3939
{
4040
// alternatively, if an AT contains the roles claim but no scp claim, that indicates it's an app token
41-
return HttpContext.User.Claims.Any(c => c.Type == "roles") && HttpContext.User.Claims.Any(c => c.Type != "scp");
41+
return HttpContext.User.Claims.Any(c => c.Type == "roles") && !HttpContext.User.Claims.Any(c => c.Type == "scp");
4242
}
4343
}
4444

0 commit comments

Comments
 (0)