For a Web API, you're required to ensure that only authenticated users can access specific endpoints, but some endpoints should be public. How would you achieve this in ASP.NET Core?
- Use Authentication Filters
- Use Authorization Filters
- Configure Middleware
- Use Role-Based Authorization
To control access to specific endpoints in an ASP.NET Core Web API, you'd use Authorization Filters. You can apply policies to controllers or actions, and these filters can determine whether a user is authorized to access the resource based on their identity and role. To make some endpoints public, you can use AllowAnonymous attribute or configure policies accordingly.
Loading...
Related Quiz
- Which of the following would NOT typically be found in the project.json file?
- Tag Helpers are processed in the order determined by the _______ property, allowing you to control the order in which multiple tag helpers are applied to an element.
- The _________ file was a unique feature in the early versions of ASP.NET Core but was later replaced in .NET Core 2.0 and beyond.
- How does the "Worker Service" template in ASP.NET Core differ from the traditional web application templates?
- Which of the following is NOT a standard provider for ASP.NET Core Identity user authentication?