aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/src/Endpoints/Internal/Account/LogoutRoute.cs
blob: 042d729ee427bfd358b19c2fc7186013edb7ae62 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace IOL.GreatOffice.Api.Endpoints.Internal.Account;

public class LogoutRoute : RouteBaseAsync.WithoutRequest.WithActionResult
{
    private readonly UserService _userService;

    public LogoutRoute(UserService userService) {
        _userService = userService;
    }

    /// <summary>
    /// Logout a user.
    /// </summary>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    [AllowAnonymous]
    [HttpGet("~/_/account/logout")]
    public override async Task<ActionResult> HandleAsync(CancellationToken cancellationToken = default) {
        await _userService.LogOutUser(HttpContext);
        return Ok();
    }
}