blob: 2a5a51526c5f71790216239aee15126113c4c822 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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");
}
}
|