From bee85bf92aab84087798ffa9f3f16336acef2fce Mon Sep 17 00:00:00 2001 From: Ariel Costas Guerrero Date: Thu, 19 Mar 2026 18:56:34 +0100 Subject: Basic backoffice for alert management --- .../Controllers/Backoffice/LoginController.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs (limited to 'src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs') diff --git a/src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs b/src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs new file mode 100644 index 0000000..1e9f12f --- /dev/null +++ b/src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs @@ -0,0 +1,28 @@ +using Microsoft.AspNetCore.Authentication; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace Enmarcha.Backend.Controllers.Backoffice; + +[Route("backoffice/auth")] +public class LoginController : Controller +{ + [HttpGet("login")] + [AllowAnonymous] + public IActionResult Login(string returnUrl = "/backoffice") + { + return Challenge(new AuthenticationProperties { RedirectUri = returnUrl }, "Auth0"); + } + + [HttpPost("logout")] + [ValidateAntiForgeryToken] + [Authorize(AuthenticationSchemes = "Backoffice")] + public IActionResult Logout() + { + return SignOut( + new AuthenticationProperties { RedirectUri = "/backoffice" }, + "Backoffice", + "Auth0"); + } +} + -- cgit v1.3