master
huanghai 5 years ago
parent 59e603062a
commit 90605a74b5

@ -743,11 +743,11 @@ func unBindWxUser(context *gin.Context) {
// @Tags 统一认证管理 // @Tags 统一认证管理
// @Accept application/x-www-form-urlencoded // @Accept application/x-www-form-urlencoded
// @Produce json // @Produce json
// @Param access_key query string true "access_key" // @Param access_key formData string true "access_key"
// @Param secret_key query string true "secret_key" // @Param secret_key formData string true "secret_key"
// @Param redirect_uri query string true "redirect_uri" // @Param redirect_uri formData string true "redirect_uri"
// @Success 200 {string} string // @Success 200 {string} string
// @Router /oauth2/AddClient [get] // @Router /oauth2/AddClient [post]
func AddClient(context *gin.Context) { func AddClient(context *gin.Context) {
ip := context.ClientIP() ip := context.ClientIP()
if ip != "127.0.0.1" { if ip != "127.0.0.1" {
@ -757,9 +757,9 @@ func AddClient(context *gin.Context) {
}) })
return return
} }
accessKey := context.Query("access_key") accessKey := context.PostForm("access_key")
secretKey := context.Query("secret_key") secretKey := context.PostForm("secret_key")
redirectUri := context.Query("redirect_uri") redirectUri := context.PostForm("redirect_uri")
RedisStorage.OAuth2RedisStorage.CreateClient( RedisStorage.OAuth2RedisStorage.CreateClient(
&osin.DefaultClient{ &osin.DefaultClient{
Id: accessKey, Id: accessKey,
@ -778,9 +778,9 @@ func AddClient(context *gin.Context) {
// @Tags 统一认证管理 // @Tags 统一认证管理
// @Accept application/x-www-form-urlencoded // @Accept application/x-www-form-urlencoded
// @Produce json // @Produce json
// @Param access_key query string true "access_key" // @Param access_key formData string true "access_key"
// @Success 200 {string} string // @Success 200 {string} string
// @Router /oauth2/DelClient [get] // @Router /oauth2/DelClient [post]
func DelClient(context *gin.Context) { func DelClient(context *gin.Context) {
ip := context.ClientIP() ip := context.ClientIP()
if ip != "127.0.0.1" { if ip != "127.0.0.1" {
@ -790,7 +790,7 @@ func DelClient(context *gin.Context) {
}) })
return return
} }
accessKey := context.Query("access_key") accessKey := context.PostForm("access_key")
RedisStorage.OAuth2RedisStorage.DeleteClient( RedisStorage.OAuth2RedisStorage.DeleteClient(
&osin.DefaultClient{ &osin.DefaultClient{
Id: accessKey, Id: accessKey,

@ -664,7 +664,7 @@ type swaggerInfo struct {
// SwaggerInfo holds exported Swagger Info so clients can modify it // SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{ var SwaggerInfo = swaggerInfo{
Version: "2.0", Version: "2.0",
Host: "10.10.14.187:8000", Host: "127.0.0.1:8000",
BasePath: "", BasePath: "",
Schemes: []string{}, Schemes: []string{},
Title: "东师理想统一认证中心(OAuth2+Sso)", Title: "东师理想统一认证中心(OAuth2+Sso)",

@ -7,7 +7,7 @@
"license": {}, "license": {},
"version": "2.0" "version": "2.0"
}, },
"host": "10.10.14.187:8000", "host": "127.0.0.1:8000",
"paths": { "paths": {
"/oauth2/AddClient": { "/oauth2/AddClient": {
"get": { "get": {

@ -32,7 +32,7 @@ definitions:
description: 个数 description: 个数
type: object type: object
type: object type: object
host: 10.10.14.187:8000 host: 127.0.0.1:8000
info: info:
contact: {} contact: {}
description: 参考自xxl-sso description: 参考自xxl-sso

@ -56,7 +56,7 @@ func startOAuth2Server() {
// @title 东师理想统一认证中心(OAuth2+Sso) // @title 东师理想统一认证中心(OAuth2+Sso)
// @version 2.0 // @version 2.0
// @description 参考自xxl-sso // @description 参考自xxl-sso
// @host 10.10.14.187:8000 // @host 127.0.0.1:8000
func main() { func main() {
// 发布模式 // 发布模式
//gin.SetMode(gin.ReleaseMode) //gin.SetMode(gin.ReleaseMode)

Loading…
Cancel
Save