backend + web: Protect Swagger UI behind admin login
This commit is contained in:
1 parent
d8de714481
commit
eddf5837eb
16 files changed
+158
-28
No files matched your search
@@ -0,0 +1,15 @@
|
||||
using Helpdesk.Web.Api;
|
||||
using Helpdesk.Web.Auth;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Helpdesk.Web.Controllers;
|
||||
|
||||
[Authorize(Roles = UserRoles.Admin)]
|
||||
[ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)]
|
||||
public sealed class SwaggerController(HelpdeskApiClient api) : Controller
|
||||
{
|
||||
[HttpGet("/swagger/v1/swagger.json")]
|
||||
public async Task<IActionResult> Document(CancellationToken ct) =>
|
||||
Content(await api.GetOpenApiAsync(ct), "application/json");
|
||||
}
|
||||
Reference in new issue
Block a user