32 lines
830 B
Plaintext
32 lines
830 B
Plaintext
/*
|
|
* Copyright (c) 2025 SimcuTeam. All rights reserved.
|
|
* 遵循 MIT 许可证。
|
|
* Controllers/SimApiAuthController:认证相关内置路由。
|
|
*/
|
|
|
|
package simcu::simapi.controllers
|
|
|
|
import simcu::simapi.communications.*
|
|
import simcu::simapi.helpers.*
|
|
|
|
/**
|
|
* 认证控制器:退出登录。
|
|
*/
|
|
public class SimApiAuthController <: SimApiBaseController {
|
|
private let _auth: SimApiAuth
|
|
|
|
public init(auth: SimApiAuth) {
|
|
this._auth = auth
|
|
}
|
|
|
|
/**
|
|
* POST /auth/logout:退出登录(void 自动封装为 SimApiBaseResponse())。
|
|
* 动态注册:路由路径由 SimApiRouteOptions.logoutRoute 决定(见 simapi_extensions.cj)。
|
|
*/
|
|
public func logout(): Unit {
|
|
if (let Some(token) <- request.headers.get("Token")) {
|
|
_auth.logout(token)
|
|
}
|
|
}
|
|
}
|