fix 兼容 oauth2 登录没有 state 场景

This commit is contained in:
bwcx_jzy 2023-03-27 20:29:03 +08:00
parent 9b2eff8faf
commit 472e580a25
No known key found for this signature in database
GPG Key ID: 5E48E9372088B9E5
4 changed files with 13 additions and 4 deletions

View File

@ -8,6 +8,7 @@
1. 【server】优化 删除管理脚本中的 `-XX:+AggressiveOpts` 参数
(感谢 [@牛孝祖](https://gitee.com/niuxiaozu) [Gitee issues I6PUNM](https://gitee.com/dromara/Jpom/issues/I6PUNM)
2. 【server】修复 兼容 oauth2 登录没有 state 场景(感谢@酱总)
------

View File

@ -30,7 +30,7 @@
19. 前端表格用户自定义列显示
20. 导入云效仓库
21. 清理触发器表
22. 稳定版/体验版
22. ~~稳定版/体验版~~
23. 插件端自定义发布文件
24. 节点取消,白名单配置和下载白名单(统一到服务端工作空间配置)
25. 仓库、构建、分发、项目导入导出

View File

@ -247,7 +247,7 @@ public class LoginControl extends BaseServerController {
*/
@GetMapping(value = "oauth2-url")
@NotLogin
public JsonMessage<JSONObject> oauth2Login(HttpServletRequest request) {
public JsonMessage<JSONObject> oauth2LoginUrl(HttpServletRequest request) {
String authorize = oauth2CustomAuthSource.getAuthOauth2Request().authorize(null);
JSONObject jsonObject = new JSONObject();
jsonObject.put("toUrl", authorize);
@ -269,7 +269,15 @@ public class LoginControl extends BaseServerController {
HttpServletRequest request) {
AuthCallback authCallback = new AuthCallback();
authCallback.setCode(code);
authCallback.setState(state);
if (StrUtil.isEmpty(state)) {
// 临时兼容没有 state 的情况
String uuid = IdUtil.fastSimpleUUID();
oauth2CustomAuthSource.getAuthOauth2Request().authorize(uuid);
authCallback.setState(uuid);
} else {
authCallback.setState(state);
}
AuthResponse<?> authResponse = oauth2CustomAuthSource.getAuthOauth2Request().login(authCallback);
if (authResponse.ok()) {
AuthUser authUser = (AuthUser) authResponse.getData();

View File

@ -16,7 +16,7 @@
<template slot="title">
<a-space>
<a-dropdown :disabled="!this.tempNode.nextPath">
<a-button size="small" type="primary" @click="(e) => e.preventDefault()">上传</a-button>
<a-button size="small" type="primary" @click="(e) => e.preventDefault()">上传小文件</a-button>
<a-menu slot="overlay">
<a-menu-item @click="handleUpload">
<a-space><a-icon type="file-add" />上传文件</a-space>