第三方sso登录插件,配置方法如下:
第一步: 在生成的配置文件config.json中加入如下配置:
"plugins": [
{
"name": "iam",
"options": {
"type": "sso",
"authServer": "http://sso.example.com/service/auth",
"tokenUrl": "http://sso.example.com/service/auth/token",
"userUrl": "http://sso.example.com/service/auth/user",
"clientID": "xxxxxxxxxxx",
"clientSecret": "xxxxxxxxxxxxxxx"
}
}
]
这里面的配置项含义如下:
-
type
登陆类型,目前只支持sso登陆 -
authServer
点击登陆按钮式需要跳转的url,用户通过该页面登录以后会向服务器发送一个code -
tokenUrl
服务端在获取code之后,可以通过这个url来获取token -
userUrl
服务端获取token后, 可以通过这个url来获取用户信息 -
clientID
获取code、token的请求参数 -
clientSecret
获取token的请求参数
第二步:在config.json 这层目录下运行 yapi plugin --name yapi-plugin-iam
重新下载插件
第三步: 重启服务器