xiangning 2548c3ed91 refactor(endpoints): 统一命名空间大小写规范
- 将 file 相关端点命名空间从小写改为首字母大写
- 将 im 相关端点命名空间从小写改为首字母大写
- 将 workflow 相关端点命名空间从小写改为首字母大写
- 将 rag 相关端点命名空间从小写改为首字母大写
- 将 platform 相关端点命名空间从小写改为首字母大写
- 保持代码功能不变,仅调整命名空间命名风格一致性
2026-07-03 17:12:48 +08:00

34 lines
940 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BuildFlow.Platform.Application.Auth.Commands;
using MediatR;
namespace BuildFlow.Host.Endpoints.Platform.Auth;
/// <summary>
/// 登出接口:撤销 refresh token 并清除 jwt Cookie。
/// 前端通过 baseRequestClient 调用(withCredentials: true 发送 Cookie)。
/// </summary>
public class LogoutEndpoint(IMediator mediator) : EndpointWithoutRequest<string>
{
public override void Configure()
{
Post("/auth/logout");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
// 从 Cookie 中读取 refresh token
var refreshToken = HttpContext.Request.Cookies["jwt"];
if (!string.IsNullOrEmpty(refreshToken))
{
await mediator.Send(new LogoutCommand(refreshToken), ct);
}
// 清除 Cookie
HttpContext.Response.Cookies.Delete("jwt");
await Send.OkAsync(string.Empty, ct);
}
}