Skip to content

Commit 9325fd2

Browse files
committed
Updated attributes
1 parent 94311a9 commit 9325fd2

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

4-WebApp-your-API/4-3-AnyOrg/ToDoListClient/Controllers/ToDoListController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
namespace ToDoListClient.Controllers
1717
{
18+
[Authorize]
1819
public class ToDoListController : Controller
1920
{
2021
private IToDoListService _todoListService;
@@ -24,7 +25,6 @@ public ToDoListController(IToDoListService todoListService)
2425
_todoListService = todoListService;
2526
}
2627
// GET: TodoList
27-
[AuthorizeForScopes(ScopeKeySection = "TodoList:TodoListScope")]
2828
public async Task<ActionResult> Index()
2929
{
3030

4-WebApp-your-API/4-3-AnyOrg/ToDoListClient/Startup.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public void ConfigureServices(IServiceCollection services)
3333
// Handling SameSite cookie according to https://docs.microsoft.com/en-us/aspnet/core/security/samesite?view=aspnetcore-3.1
3434
options.HandleSameSiteCookieCompatibility();
3535
});
36-
services.AddSignIn(Configuration).
37-
AddWebAppCallsProtectedWebApi(Configuration, new string[] { Configuration["TodoList:TodoListScope"] }).
38-
AddInMemoryTokenCaches();
36+
services.AddSignIn(Configuration)
37+
.AddWebAppCallsProtectedWebApi(Configuration, new string[] { Configuration["TodoList:TodoListScope"] })
38+
.AddInMemoryTokenCaches();
3939
services.AddTodoListService(Configuration);
4040
services.AddControllersWithViews(options =>
4141
{

4-WebApp-your-API/4-3-AnyOrg/TodoListService/Controllers/TodoListController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public async Task<ActionResult<TodoItem>> GetTodoItem(int id)
6565

6666
return todoItem;
6767
}
68-
[HttpGet("/api/todolist/getallusers")]
68+
[HttpGet("getallusers")]
6969
public async Task<ActionResult<IEnumerable<string>>> GetAllTodoItem()
7070
{
7171
HttpContext.VerifyUserHasAnyAcceptedScope(scopeRequiredByApi);
@@ -169,7 +169,7 @@ public async Task<List<string>> CallGraphApiOnBehalfOfUser()
169169
catch (MsalUiRequiredException ex)
170170
{
171171
_tokenAcquisition.ReplyForbiddenWithWwwAuthenticateHeader(scopes, ex);
172-
return null;
172+
throw (ex);
173173
}
174174
}
175175
private static async Task<IEnumerable<User>> CallGraphApiOnBehalfOfUser(string accessToken)

4-WebApp-your-API/4-3-AnyOrg/TodoListService/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public void ConfigureServices(IServiceCollection services)
2727
{
2828
// Setting configuration for protected web api
2929

30-
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme).
31-
AddProtectedWebApi(Configuration);
30+
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
31+
.AddProtectedWebApi(Configuration);
3232

3333
// Comment above lines of code and uncomment this section if you would like to validate ID tokens for allowed tenantIds
3434
//services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)

0 commit comments

Comments
 (0)