Search⌘ K

Solution Review: Restricting Write Requests

Explore how to restrict write operations in ASP.NET Core Web API by applying authorization and authentication through JWTs and SSO. Understand the configuration of authority settings, use of [Authorize] and [AllowAnonymous] attributes, and how to handle access tokens to secure the Add method. This lesson guides you through a practical solution to enforce security while managing user access effectively.

We'll cover the following...

Overview

The complete solution can be found in the following playground:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
The final setup with the secured POST endpoint

Solving the challenge

Here are the steps to solve the challenge:

  • First, we configure the correct Authority setting on line 16 of the Program.cs ...