mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-02 03:48:05 +08:00
fix Oauth2 新增钉钉扫码登录
This commit is contained in:
parent
6d5b9dab3e
commit
161812b94a
@ -4,6 +4,8 @@
|
||||
|
||||
### 🐣 新增功能
|
||||
|
||||
1. 【server】新增 Oauth2 新增钉钉扫码登录
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
1. 【agent】优化 DSL 项目支持配置在特定目录执行脚本(run.execPath)
|
||||
|
@ -11,6 +11,7 @@ package org.dromara.jpom.oauth2;
|
||||
|
||||
import me.zhyd.oauth.config.AuthSource;
|
||||
import me.zhyd.oauth.request.AuthDefaultRequest;
|
||||
import org.dromara.jpom.oauth2.platform.Oauth2MaxKeyConfig;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
|
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Of Him Code Technology Studio
|
||||
* Jpom is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
package org.dromara.jpom.oauth2.platform;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.zhyd.oauth.config.AuthDefaultSource;
|
||||
import me.zhyd.oauth.request.AuthDingTalkRequest;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import org.dromara.jpom.oauth2.BaseOauth2Config;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* @author bwcx_jzy
|
||||
* @see AuthDefaultSource#DINGTALK
|
||||
* @since 2024/04/05
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class DingTalkOauth2Config extends BaseOauth2Config {
|
||||
|
||||
public static final String KEY = "OAUTH_CONFIG_DINGTALK_OAUTH2";
|
||||
|
||||
@Override
|
||||
public String provide() {
|
||||
return "dingtalk";
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequest authRequest() {
|
||||
Assert.state(this.enabled(), "没有开启此 " + this.provide() + " oauth2");
|
||||
return new AuthDingTalkRequest(this.authConfig());
|
||||
}
|
||||
}
|
@ -7,12 +7,13 @@
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
package org.dromara.jpom.oauth2;
|
||||
package org.dromara.jpom.oauth2.platform;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.zhyd.oauth.request.AuthGiteeRequest;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import org.dromara.jpom.oauth2.BaseOauth2Config;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
@ -7,12 +7,13 @@
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
package org.dromara.jpom.oauth2;
|
||||
package org.dromara.jpom.oauth2.platform;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.zhyd.oauth.request.AuthGithubRequest;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import org.dromara.jpom.oauth2.BaseOauth2Config;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
@ -7,13 +7,16 @@
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
package org.dromara.jpom.oauth2;
|
||||
package org.dromara.jpom.oauth2.platform;
|
||||
|
||||
import cn.hutool.core.lang.RegexPool;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import org.dromara.jpom.oauth2.AuthOauth2MaxKeyRequest;
|
||||
import org.dromara.jpom.oauth2.BaseOauth2Config;
|
||||
import org.dromara.jpom.oauth2.Oauth2MaxKeyAuthSource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
1
web-vue/src/assets/images/dingtalk.svg
Normal file
1
web-vue/src/assets/images/dingtalk.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1712310744977" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1462" width="200" height="200" xmlns:xlink="http://www.w3.org/1999/xlink"><path d="M849.92 51.2H174.08c-67.8656 0-122.88 55.0144-122.88 122.88v675.84c0 67.8656 55.0144 122.88 122.88 122.88h675.84c67.8656 0 122.88-55.0144 122.88-122.88V174.08c0-67.8656-55.0144-122.88-122.88-122.88z m-97.17248 383.4112c-1.00352 4.61824-3.61472 10.84928-7.22944 19.18976l-0.50688 0.50176c-21.69856 46.01344-77.66016 136.13568-77.66016 136.13568l-0.50688-0.50176-16.57344 28.43136h79.17056L578.33472 819.2l34.16064-136.63744h-62.09024l21.69856-90.624c-17.58208 4.1216-38.28224 9.85088-62.592 18.08384 0 0-33.15712 19.18976-95.24736-37.26848 0 0-41.89696-37.2736-17.58208-46.01344 10.34752-4.1216 50.23232-8.84736 81.78176-12.95872 42.3936-5.72928 68.81792-8.84736 68.81792-8.84736s-130.90816 2.10944-161.95584-3.10784c-31.04256-4.62336-70.4256-56.97024-78.6688-102.48192 0 0-12.95872-24.81664 27.9296-12.95872 40.39168 11.8528 210.18112 46.01344 210.18112 46.01344S324.2496 365.2864 309.78048 348.70784c-14.46912-16.57856-42.99776-90.01984-39.38304-135.13216 0 0 1.50528-11.35104 12.95872-8.23808 0 0 162.55488 74.5472 273.77664 114.93376 111.8208 41.40032 208.57344 62.09536 195.61472 114.33984z" fill="#3296FA" p-id="1463"></path></svg>
|
After Width: | Height: | Size: 1.4 KiB |
@ -47,6 +47,11 @@
|
||||
<img alt="github" :src="githubImg" />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
<div v-if="enabledOauth2Provides.includes('dingtalk')" class="oauth2-item">
|
||||
<a-tooltip title="dingtalk" @click="toOauth2Url('dingtalk')">
|
||||
<img alt="dingtalk" :src="dingtalkImg" />
|
||||
</a-tooltip>
|
||||
</div>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</template>
|
||||
@ -86,6 +91,7 @@ import sha1 from 'js-sha1'
|
||||
import defaultBg from '@/pages/layout/default-bg.vue'
|
||||
import maxkeyImg from '@/assets/images/maxkey.png'
|
||||
import giteeImg from '@/assets/images/gitee.svg'
|
||||
import dingtalkImg from '@/assets/images/dingtalk.svg'
|
||||
import githubImg from '@/assets/images/github.png'
|
||||
import { useGuideStore } from '@/stores/guide'
|
||||
import { Button } from 'ant-design-vue'
|
||||
|
@ -2,6 +2,41 @@
|
||||
<div>
|
||||
<a-alert message="账号如果开启 MFA(两步验证),使用 Oauth2 登录不会验证 MFA(两步验证)" type="info" show-icon />
|
||||
<a-tabs>
|
||||
<a-tab-pane key="dingtalk" tab="钉钉扫码 Oauth2">
|
||||
<a-form ref="editForm" :model="dingtalk" :rules="rules" :label-col="{ span: 4 }" :wrapper-col="{ span: 16 }">
|
||||
<a-form-item label="是否开启" name="enabled">
|
||||
<a-switch v-model:checked="dingtalk.enabled" checked-children="启用" un-checked-children="停用" />
|
||||
</a-form-item>
|
||||
<a-form-item label="客户端ID" name="clientId">
|
||||
<a-input v-model:value="dingtalk.clientId" type="text" placeholder="请输入客户端ID [clientId]" />
|
||||
</a-form-item>
|
||||
<a-form-item label="客户端密钥" name="clientSecret">
|
||||
<a-input-password v-model:value="dingtalk.clientSecret" placeholder="请输入客户端密钥 [clientSecret]" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label="回调 url" name="redirectUri">
|
||||
<template #help>参考地址:{{ `${host}/oauth2-dingtalk` }}</template>
|
||||
<a-input
|
||||
v-model:value="dingtalk.redirectUri"
|
||||
type="text"
|
||||
placeholder="请输入回调重定向 url [redirectUri]"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="登录url">
|
||||
<a-input :value="`${this.host}/oauth2-render-github`" type="text" />
|
||||
</a-form-item> -->
|
||||
<a-form-item label="自动创建用户" name="autoCreteUser">
|
||||
<a-switch v-model:checked="dingtalk.autoCreteUser" checked-children="启用" un-checked-children="停用" />
|
||||
</a-form-item>
|
||||
<a-form-item label="忽略校验 state" name="ignoreCheckState">
|
||||
<a-switch v-model:checked="dingtalk.ignoreCheckState" checked-children="忽略" un-checked-children="校验" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :wrapper-col="{ span: 14, offset: 4 }">
|
||||
<a-button type="primary" class="btn" @click="onSubmit('dingtalk')">提交</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="maxkey" tab="MaxKey Oauth2">
|
||||
<a-form ref="editForm" :model="maxkey" :rules="rules" :label-col="{ span: 4 }" :wrapper-col="{ span: 16 }">
|
||||
<a-form-item label="是否开启" name="enabled">
|
||||
@ -120,8 +155,9 @@ export default {
|
||||
maxkey: {},
|
||||
gitee: {},
|
||||
github: {},
|
||||
dingtalk: {},
|
||||
rules: {},
|
||||
provides: ['gitee', 'maxkey', 'github'],
|
||||
provides: ['gitee', 'maxkey', 'github', 'dingtalk'],
|
||||
host: ''
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user