Add APIKey authentication

This commit is contained in:
2023-11-22 20:53:06 -05:00
parent 38c3895459
commit 15f8385005
10 changed files with 179 additions and 26 deletions

View File

@@ -1,24 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using TodoApi.Helpers;
using TodoApi.Models;
namespace TodoApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class TodoItemsController : ControllerBase
[ApiKey]
public class TodoItemsController(TodoContext context) : ControllerBase
{
private readonly TodoContext _context;
public TodoItemsController(TodoContext context)
{
_context = context;
}
private readonly TodoContext _context = context;
// GET: api/TodoItems
[HttpGet]