mirror of https://github.com/veypi/OneAuth.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
1.0 KiB
Go
27 lines
1.0 KiB
Go
// Copyright (C) 2024 veypi <i@veypi.com>
|
|
// 2025-03-04 16:08:06
|
|
// Distributed under terms of the MIT license.
|
|
|
|
package oauth
|
|
|
|
import "github.com/veypi/vigo"
|
|
|
|
var Router = vigo.NewRouter()
|
|
|
|
func init() {
|
|
// === OAuth 公开端点(跳过认证)===
|
|
Router.Get("/authorize", "授权端点", vigo.SkipBefore, authorize)
|
|
Router.Post("/token", "令牌端点", vigo.SkipBefore, token)
|
|
Router.Post("/revoke", "撤销令牌", vigo.SkipBefore, revoke)
|
|
Router.Get("/userinfo", "用户信息(OIDC)", userInfo)
|
|
Router.Get("/.well-known/openid-configuration", "OIDC发现文档", vigo.SkipBefore, discovery)
|
|
|
|
// === OAuth 客户端管理(需要认证)===
|
|
clientRouter := Router.SubRouter("/clients")
|
|
clientRouter.Get("/", "OAuth客户端列表", listClients)
|
|
clientRouter.Post("/", "创建OAuth客户端", createClient)
|
|
clientRouter.Get("/{client_id}", "获取客户端详情", getClient)
|
|
clientRouter.Patch("/{client_id}", "更新OAuth客户端", updateClient)
|
|
clientRouter.Delete("/{client_id}", "删除OAuth客户端", deleteClient)
|
|
}
|