summaryrefslogtreecommitdiffstats
path: root/server/src/Endpoints/Internal/Account/LogoutRoute.cs
blob: 4a06f4a284f9ab6790be6872117c03b870d4805e (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();
	}
}