aboutsummaryrefslogtreecommitdiff
path: root/src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs
diff options
context:
space:
mode:
authorAriel Costas Guerrero <ariel@costas.dev>2026-03-19 18:56:34 +0100
committerAriel Costas Guerrero <ariel@costas.dev>2026-03-19 18:56:34 +0100
commitbee85bf92aab84087798ffa9f3f16336acef2fce (patch)
tree4fc8e2907e6618940cd9bdeb3da1a81172aab459 /src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs
parentfed5d57b9e5d3df7c34bccb7a120bfa274b2039a (diff)
Basic backoffice for alert management
Diffstat (limited to 'src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs')
-rw-r--r--src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs28
1 files changed, 28 insertions, 0 deletions
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");
+ }
+}
+