swagger-ui - 如何在隐式 Oauth2 流的授权 URL 中将 response_type 更改为 id_token
问题描述
我有以下 OpenAPI 配置
new OpenAPI()
.components(
new Components()
.addSecuritySchemes("oAuthScheme", new SecurityScheme()
.type(SecurityScheme.Type.OAUTH2)
.description("This API uses OAuth 2 with the implicit grant flow.")
.flows(new OAuthFlows()
.implicit(new OAuthFlow()
.authorizationUrl("http://example.com/oauth2/default/v1/authorize")
.scopes(new Scopes()
.addString("openid", "read user information")
)
)
)
)
)
当我单击招摇 UI 上的授权按钮时,它正在生成以下 URL
http://example.com/oauth2/default/v1/authorize?nonce=nonce&response_type=token&client_id=client-id&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fswagger-ui%2Foauth2-redirect.html&scope=openid&state=U2F0IEphbiAwMiAyMDIxID
我想要 response_type 作为 id_token 代替令牌。有什么办法可以改变吗?
解决方案
看来您正在使用 openidconnect。
您应该切换到 SecurityScheme = OPENIDCONNECT 并填写您的 openIdConnectUrl 网址。结果,您将在响应中获得 id_token。
推荐阅读
- php - 如何将 file_get_contents 与代理一起使用?
- c# - Autofac 在线路服务端的每个 DataContract 中注入 NLog 实例
- angular - Angular 5 localize-router 使用国家/语言代码设置路由
- command-line - Grunt exec - Gzip 目录中所有缩小的 css 和 js 文件
- android - 单击设备/手机的后退按钮时如何同时隐藏键盘和按钮
- c# - 与依赖项共享库
- angularjs - AngularJS $rootScope.$broadcast
- angular - 如何预选自动完成?
- performance - 一个程序如何同时为多个用户提供服务?
- javascript - angularjs 函数如何使用 angularjs 指令返回 html 代码