Config and swagger upgrade

This commit is contained in:
ycc
2024-09-27 09:20:59 +02:00
parent 6f4a51e28e
commit 9bb7cd77c0
10 changed files with 799 additions and 205 deletions

View File

@@ -2,6 +2,7 @@ package controllers
import (
"fmt"
"net/http"
beego "github.com/beego/beego/v2/server/web"
)
@@ -11,6 +12,29 @@ type AuthController struct {
beego.Controller
}
// @Title Get
// @Description find auth by authid
// @Param authId path string true "the authid you want to get"
// @Success 200 {auth} models.auth
// @Failure 403 :authId is empty
// @router /discover/:url [get]
func (o *AuthController) GetConfig() {
url := o.Ctx.Input.Param(":url")
response, err := http.Get(url + "/.well-known/openid-configuration")
if err != nil {
fmt.Println(err)
}
fmt.Println(url)
// read response body
data := make([]byte, 1024)
_, err = response.Body.Read(data)
if err != nil {
fmt.Println(err)
}
o.Data["json"] = data
o.ServeJSON()
}
// @Title Create
// @Description create auths
// @Param body body []models.auth true "The auth content"