Config and swagger upgrade
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user