From the course: Security in ASP.NET Core
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Adding authorization - ASP.NET Tutorial
From the course: Security in ASP.NET Core
Adding authorization
- So now that users can log in, we should provide them with extra features. How about content that's only available to them? That's not available for anonymous users. So I am setting up a new razor page and yeah, an empty page I think we'll do. And I can call this privileged. And this is essentially the page where we could do something silly like having a header and the head says, welcome, and then we can access the current user. So, and then the identity of that user, and then the name. And of course add user is the logical choice here. And once we've done this, we just have to make sure that only authenticated users can access that page. We are working with a model here, as you can see, and in that model we can can configure this. So we are just adding the authorized attribute. The authorized attribute is also something that we have been using in the previous web application, but back then we had our own custom boiler plate implementation. But here we are just standing on the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.