简体   繁体   English

使Swagger UI oauth2与oidc-provider一起使用

[英]Getting Swagger UI oauth2 work with oidc-provider

I am trying to get Swagger UI to successfully authorize to a oidc-provider instance. 我正在尝试使Swagger UI成功授权给oidc-provider实例。

I have set up a minimal (as possible) instance on glitch here: https://glitch.com/~copper-vise 我在这里设置了一个关于故障的最小(尽可能)实例: https : //glitch.com/~copper-vise

What it does is: 它的作用是:

  • have swagger UI on /doc serving the definition from the swagger.yaml file 在/ doc上使用swagger UI,以提供来自swagger.yaml文件的定义
  • run the oidc provider with minimal configuration and dev interactions. 以最少的配置和开发人员交互运行oidc提供程序。

The problem is that I don't seem to be able to get the two work together. 问题是我似乎无法将两者结合起来。 It seems like it could be a Swagger UI bug, but considering my lack of experience with oidc it might simply be a configuration issue. 看来这可能是Swagger UI的错误,但是考虑到我对odc缺乏经验,这可能只是配置问题。

To try, click the "Authorize" button on the swagger interface , use foo and bar for the client_id and client_secret , check at least the openid scope and click "Authorize". 要尝试,请在swagger界面上单击“授权”按钮,对client_idclient_secret使用foobar ,至少检查openid范围,然后单击“授权”。 At this point you should get a login prompt. 此时,您应该会看到一个登录提示。 Enter anything you like and login. 输入您喜欢的任何内容并登录。 At this point the swagger UI should be having a token, but I never got it that far. 在这一点上,庄重的UI应该有一个令牌,但是我还没有做到这一点。

What I'm getting instead is a invalid_client error, it seems like the oidc-provider expects an authorization request header that the Swagger UI is not providing. 相反,我得到的是invalid_client错误,似乎oidc-provider期望Swagger UI不提供授权请求标头。 The "implicit" flow does not seem to work at all either. “隐式”流程似乎也不起作用。 As far as I can tell , these are the two flows that the oidc-provider supports (with this configuration?). 我所知 ,这是oidc-provider支持的两个流程(使用此配置?)。

I'm stuck, not sure where to go from here. 我被困住了,不知道从这里去哪里。 It seems like the right combination of the openapi securitySchemes configuration in the swagger.yaml file and the oidc-provider and client options should get this running. 似乎swagger.yaml文件中的openapi securitySchemes配置以及oidc-provider和client选项的正确组合应该可以使它运行。

It seems swagger is sending client_secret_post client authentication, the default on the IdP is client_secret_basic . 似乎大张旗鼓地发送client_secret_post客户端身份验证,IdP上的默认值为client_secret_basic If you change the client configuration on the IdP to match the scheme the client is actually using it'll work. 如果您更改IdP上的客户端配置以匹配该方案,则该客户端实际正在使用该方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 oidc-provider 访问 UserInfo enpoint 时提供的令牌无效 - Invalid token provided in oidc-provider accessing UserInfo enpoint 我如何使用前置和后置中间件 | oidc 提供者 panva - How I can use Pre and post-middlewares | oidc-provider panva 如何在节点 oidc-provider 中为 client_credentials 流定义 JWT 令牌模式 - How to define JWT token mode for client_credentials flow in node oidc-provider 带有Satellizer的OAuth2和通用OAuth2提供程序 - OAuth2 with Satellizer and a generic OAuth2 provider 在 Google Oauth2 登录后将 JWT 传递给 UI 应用程序 - Passing JWT to UI application after Google Oauth2 login Passport(oAuth2)如何与GraphQL(TypeGraphQL)一起使用? - How does Passport (oAuth2) work with GraphQL (TypeGraphQL)? 在Heroku上获取Google OAuth2回调时的循环结构 - Circular structure when getting Google OAuth2 callback on Heroku 为什么我收到此 Facebook Passport oauth2 响应错误? - Why am I getting this Facebook Passport oauth2 response error? NodeJS OIDC 提供程序获取音频和资源服务器错误从 6.x 升级到 7.x - NodeJS OIDC Provider getting aud and resource server errors upgrade from 6.x to 7.x 带有Node.js的邮递员OAuth2 - Postman oauth2 with nodejs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM