1.0.0 • Published 4 years ago

yapi-plugin-oidc-tmp v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

yapi-plugin-oidc

第三方插件,OIDC登录,在生成的配置文件中,添加如下配置即可:

"plugins": [
    {
      "name": "oidc",
      "options": {
        "authUrl": "auth url",
        "tokenUrl": "token url",
        "userUrl": "user urll",
        "callbackUrl": "your_yapi_server_host/api/user/login_by_token",
        "clientId": "your client id",
        "clientSecret": "your client secret",
        "scope": "your scope",
        "emailKey" : "emailkey",
        "userKey" : "usernamekey",
        "emailPostfix" : "@yapi.com"
      }
    }
  ]

使用注意:

  • Oauth2服务器用户信息需要提供: emailusername两个字段,如果字段名不一致,可以通过emailKeyuserKey设置,如果没有电子邮箱字段,可以使用用户名字段+emailPostfix属性设置默认电子邮箱地址(电子邮箱是Yapi用户唯一标志)

这里面的配置项含义如下:

  • authUrl 授权URL
  • tokenUrl 获取access_token URL
  • userUrl 获取用户信息URL
  • callbackUrl 重定向回调URL
  • clientId clientId或者appId
  • clientSecret clientSecret或者appSecret
  • scope 授权范围
  • emailKey 用户信息电子邮件字段key
  • userKey 用户信息用户名字段key
  • emailPostfix 邮箱后缀
1.0.0

4 years ago