做统一认证登录

This commit is contained in:
2026-09-19 21:44:04 +08:00
parent 1a4471e34d
commit fa281363fb
78 changed files with 8127 additions and 1442 deletions
+34
View File
@@ -0,0 +1,34 @@
// Package auth 统一认证中心(UAC)路由:api.yunzer.cn/auth
//
// 重要:该路由组必须在 router.go 的所有运行模式下都注册
// (platform / backend / index / api / app / all),
// 否则对应模式下认证中心不可用。
package auth
import (
authctl "server/controllers/auth"
beego "github.com/beego/beego/v2/server/web"
)
// Register 注册认证中心路由
func Register() {
// ---- OIDC 标准端点 ----
beego.Router("/auth/.well-known/openid-configuration", &authctl.AuthOidcController{}, "get:Discovery")
beego.Router("/auth/jwks.json", &authctl.AuthOidcController{}, "get:JWKS")
beego.Router("/auth/authorize", &authctl.AuthOidcController{}, "get:Authorize")
beego.Router("/auth/token", &authctl.AuthOidcController{}, "post:Token")
beego.Router("/auth/userinfo", &authctl.AuthOidcController{}, "get:UserInfo;post:UserInfo")
beego.Router("/auth/introspect", &authctl.AuthOidcController{}, "post:Introspect")
beego.Router("/auth/revoke", &authctl.AuthOidcController{}, "post:Revoke")
// ---- 登录与会话 ----
// 注意:beego 同一路径重复 Router 会覆盖,故 /auth/logout 只注册一次
beego.Router("/auth/login", &authctl.AuthLoginController{}, "get:LoginPage;post:LoginSubmit")
beego.Router("/auth/logout", &authctl.AuthLoginController{}, "get:LogoutPage;post:LogoutAction")
beego.Router("/auth/tenants", &authctl.AuthLoginController{}, "get:Tenants")
beego.Router("/auth/switch-tenant", &authctl.AuthLoginController{}, "post:SwitchTenant")
beego.Router("/auth/sessions", &authctl.AuthLoginController{}, "get:Sessions")
beego.Router("/auth/sessions/kick", &authctl.AuthLoginController{}, "post:KickSession")
beego.Router("/auth/verify-config", &authctl.AuthLoginController{}, "get:VerifyConfig")
}