aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/src/Endpoints/Internal/Account/LogoutRoute.cs
blob: 295d9f66954989d2eacbea34b9f9dd316a976390 (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, cancellationToken);
        return Ok();
    }
}