add oauth loginlog & fix bugs
This commit is contained in:
@@ -25,6 +25,8 @@ func Init(g *gin.Engine) {
|
||||
TagBind(adg)
|
||||
AddressBookBind(adg)
|
||||
PeerBind(adg)
|
||||
OauthBind(adg)
|
||||
LoginLogBind(adg)
|
||||
|
||||
rs := &admin.Rustdesk{}
|
||||
adg.GET("/server-config", rs.ServerConfig)
|
||||
@@ -44,6 +46,7 @@ func UserBind(rg *gin.RouterGroup) {
|
||||
cont := &admin.User{}
|
||||
aR.GET("/current", cont.Current)
|
||||
aR.POST("/changeCurPwd", cont.ChangeCurPwd)
|
||||
aR.POST("/myOauth", cont.MyOauth)
|
||||
}
|
||||
aRP := rg.Group("/user").Use(middleware.AdminPrivilege())
|
||||
{
|
||||
@@ -104,6 +107,35 @@ func PeerBind(rg *gin.RouterGroup) {
|
||||
}
|
||||
}
|
||||
|
||||
func OauthBind(rg *gin.RouterGroup) {
|
||||
aR := rg.Group("/oauth")
|
||||
{
|
||||
cont := &admin.Oauth{}
|
||||
aR.POST("/confirm", cont.Confirm)
|
||||
aR.POST("/bind", cont.ToBind)
|
||||
aR.POST("/bindConfirm", cont.BindConfirm)
|
||||
aR.POST("/unbind", cont.Unbind)
|
||||
aR.GET("/info", cont.Info)
|
||||
}
|
||||
arp := aR.Use(middleware.AdminPrivilege())
|
||||
{
|
||||
cont := &admin.Oauth{}
|
||||
arp.GET("/list", cont.List)
|
||||
arp.GET("/detail/:id", cont.Detail)
|
||||
arp.POST("/create", cont.Create)
|
||||
arp.POST("/update", cont.Update)
|
||||
arp.POST("/delete", cont.Delete)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
func LoginLogBind(rg *gin.RouterGroup) {
|
||||
aR := rg.Group("/login_log")
|
||||
cont := &admin.LoginLog{}
|
||||
aR.GET("/list", cont.List)
|
||||
aR.POST("/delete", cont.Delete)
|
||||
}
|
||||
|
||||
/*
|
||||
func FileBind(rg *gin.RouterGroup) {
|
||||
aR := rg.Group("/file")
|
||||
|
||||
@@ -19,7 +19,7 @@ func ApiInit(g *gin.Engine) {
|
||||
|
||||
frg := g.Group("/api")
|
||||
|
||||
frg.Use(middleware.Cors())
|
||||
//frg.Use(middleware.Cors())
|
||||
frg.OPTIONS("/*any", nil)
|
||||
|
||||
i := &api.Index{}
|
||||
@@ -34,6 +34,16 @@ func ApiInit(g *gin.Engine) {
|
||||
frg.POST("/login", l.Login)
|
||||
|
||||
}
|
||||
{
|
||||
o := &api.Oauth{}
|
||||
// [method:POST] [uri:/api/oidc/auth]
|
||||
frg.POST("/oidc/auth", o.OidcAuth)
|
||||
// [method:GET] [uri:/api/oidc/auth-query?code=abc&id=xxxxx&uuid=xxxxx]
|
||||
frg.GET("/oidc/auth-query", o.OidcAuthQuery)
|
||||
//api/oauth/callback
|
||||
frg.GET("/oauth/callback", o.OauthCallback)
|
||||
frg.GET("/oauth/login", o.OauthCallback)
|
||||
}
|
||||
{
|
||||
pe := &api.Peer{}
|
||||
//提交系统信息
|
||||
|
||||
Reference in New Issue
Block a user