Added authentication

This commit is contained in:
2026-06-21 20:10:02 +02:00
parent efe63211ed
commit a50be1ec0b
50 changed files with 2596 additions and 328 deletions
@@ -2,6 +2,9 @@
using Microsoft.AspNetCore.Mvc;
using SampleApi.Models;
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
namespace SampleApi.Controllers
{
[ApiController]
@@ -2,6 +2,9 @@
using Microsoft.AspNetCore.Mvc;
using SampleApi.Models;
// This file is part of the EonaCat project(s) which is released under the Apache License.
// See the LICENSE file or go to https://EonaCat.com/license for full license details.
namespace SampleApi.Controllers
{
[ApiController]
@@ -35,6 +38,7 @@ namespace SampleApi.Controllers
}
[HttpPost]
[DoxaApiAuth("bearer")]
[DoxaApiExample("""
{
"name": "Grace Hopper",
@@ -59,6 +63,7 @@ namespace SampleApi.Controllers
}
[HttpPatch("{id}")]
[DoxaApiAuth("bearer")]
public ActionResult<User> Update(Guid id, [FromBody] UpdateUserRequest request)
{
var user = _users.FirstOrDefault(u => u.Id == id);
@@ -86,6 +91,7 @@ namespace SampleApi.Controllers
}
[HttpDelete("{id}")]
[DoxaApiAuth("apiKey")]
[Obsolete("Use POST /api/users/{id}/archive instead.")]
public IActionResult Delete(Guid id)
{
@@ -99,4 +105,4 @@ namespace SampleApi.Controllers
return NoContent();
}
}
}
}