You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.8 KiB

package ControllerSso
import (
"dsSso/Model"
"dsSso/Service/ServiceJoinApp"
"github.com/gin-gonic/gin"
"net/http"
)
//模块的路由配置
func Routers(r *gin.RouterGroup) {
rr := r.Group("")
//用于统一认证管理员登录
rr.GET("/login", login)
//根据appId获取接入第三方统一认证系统的信息
rr.GET("/getAppInfoById", GetAppInfoById)
return
}
// @Summary 接入系统管理中心维护的路由跳转
// @Description manager dsideal4r5t6y7u 为统一认证管理员默认帐号
// @Tags 接入系统维护类
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Success 200 {string} string
// @Router /sso/login [get]
func login(c *gin.Context) {
//如果没有本domain下的cookie,那么跳转到登录页
url := "/sso/static/index.html"
c.Redirect(302, url)
}
// @Summary 根据appId获取接入第三方统一认证系统的信息
// @Description 根据appId获取接入第三方统一认证系统的信息
// @Tags 接入系统维护类
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Param app_id query string true "系统app_id"
// @Success 200 {object} Model.AppInfo
// @Router /sso/getAppInfoById [get]
// @X-IntLimit ["app_id"]
func GetAppInfoById(c *gin.Context) {
//接收参数
appId := c.Query("app_id")
//获取信息
res := ServiceJoinApp.GetAppInfoById(appId)
if res != nil {
c.JSON(http.StatusOK, Model.AppInfo{
Code: http.StatusOK,
AppKey: res["app_key"].(string),
AppName: res["app_name"].(string),
AppSecret: res["app_secret"].(string),
RedirectUri: res["redirect_uri"].(string),
Msg: "获取信息成功!",
})
} else
{
c.JSON(http.StatusOK, Model.Res{
Code: http.StatusInternalServerError,
Msg: "未查询到数据!",
})
}
return
}