diff options
Diffstat (limited to 'src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs')
| -rw-r--r-- | src/Enmarcha.Backend/Controllers/Backoffice/LoginController.cs | 28 |
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"); + } +} + |
