fix(系统设置): 登录认证源被关闭后依然可以进行认证的问题
--bug=1020042 --user=李玉号 【系统设置】禁用OAuth2-登录ms一直是加载状态 https://www.tapd.cn/55049933/s/1301188
This commit is contained in:
parent
d16ef035c7
commit
3ff7a340a1
|
@ -119,6 +119,10 @@ public class LoginController {
|
||||||
return Mono.just(ResultHolder.success(authSourceService.listAllEnable()));
|
return Mono.just(ResultHolder.success(authSourceService.listAllEnable()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("authsource/{authId}")
|
||||||
|
public Mono<ResultHolder> getAuthSource(@PathVariable("authId") String authId) {
|
||||||
|
return Mono.just(ResultHolder.success(authSourceService.getAuthSource(authId)));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/services")
|
@GetMapping(value = "/services")
|
||||||
public Mono<ResultHolder> getServices() {
|
public Mono<ResultHolder> getServices() {
|
||||||
|
|
|
@ -57,6 +57,10 @@ export function getAuthSources() {
|
||||||
return get('/authsource/list/allenable')
|
return get('/authsource/list/allenable')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getAuthSource(id) {
|
||||||
|
return get('/authsource/' + id)
|
||||||
|
}
|
||||||
|
|
||||||
export function getProjectMemberOption() {
|
export function getProjectMemberOption() {
|
||||||
return get('/user/project/member/option');
|
return get('/user/project/member/option');
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,9 +59,17 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getCurrentUserId, publicKeyEncrypt} from "../../utils/token";
|
import {getCurrentUserId, publicKeyEncrypt} from "../../utils/token";
|
||||||
import {CURRENT_LANGUAGE, DEFAULT_LANGUAGE, PRIMARY_COLOR} from "../../utils/constants";
|
import {DEFAULT_LANGUAGE, PRIMARY_COLOR} from "../../utils/constants";
|
||||||
import {hasLicense, hasPermissions, saveLicense} from "../../utils/permission";
|
import {hasLicense, hasPermissions, saveLicense} from "../../utils/permission";
|
||||||
import {checkLdapOpen, getAuthSources, getDisplayInfo, getLanguage, getSystemTheme, saveBaseUrl} from "../../api/user";
|
import {
|
||||||
|
checkLdapOpen,
|
||||||
|
getAuthSource,
|
||||||
|
getAuthSources,
|
||||||
|
getDisplayInfo,
|
||||||
|
getLanguage,
|
||||||
|
getSystemTheme,
|
||||||
|
saveBaseUrl
|
||||||
|
} from "../../api/user";
|
||||||
import {useUserStore} from "@/store"
|
import {useUserStore} from "@/store"
|
||||||
import {checkMicroMode, operationConfirm} from "../../utils";
|
import {checkMicroMode, operationConfirm} from "../../utils";
|
||||||
import {getModuleList} from "../../api/module";
|
import {getModuleList} from "../../api/module";
|
||||||
|
@ -291,38 +299,47 @@ export default {
|
||||||
if (authId === 'LDAP' || authId === 'LOCAL') {
|
if (authId === 'LDAP' || authId === 'LOCAL') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let source = this.authSources.filter(auth => auth.id === authId)[0];
|
getAuthSource(authId).then(res => {
|
||||||
// 以前的cas登录
|
if (!res || !res.data) {
|
||||||
if (source.type === 'CAS') {
|
|
||||||
let config = JSON.parse(source.configuration);
|
|
||||||
if (config.casServerUrl && !config.loginUrl) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
if (res.data.status !== 'ENABLE') {
|
||||||
operationConfirm(this, this.$t('commons.auth_redirect_tip'), () => {
|
this.$message.error(this.$t('login.auth_not_enable'));
|
||||||
let config = JSON.parse(source.configuration);
|
return;
|
||||||
let redirectUrl = eval('`' + config.redirectUrl + '`');
|
}
|
||||||
let url;
|
let source = this.authSources.filter(auth => auth.id === authId)[0];
|
||||||
|
// 以前的cas登录
|
||||||
if (source.type === 'CAS') {
|
if (source.type === 'CAS') {
|
||||||
url = config.loginUrl + "?service=" + encodeURIComponent(redirectUrl);
|
let config = JSON.parse(source.configuration);
|
||||||
|
if (config.casServerUrl && !config.loginUrl) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (source.type === 'OIDC') {
|
operationConfirm(this, this.$t('commons.auth_redirect_tip'), () => {
|
||||||
url = config.authUrl + "?client_id=" + config.clientId + "&redirect_uri=" + redirectUrl +
|
let config = JSON.parse(source.configuration);
|
||||||
"&response_type=code&scope=openid+profile+email&state=" + authId;
|
let redirectUrl = eval('`' + config.redirectUrl + '`');
|
||||||
}
|
let url;
|
||||||
if (source.type === 'OAuth2') {
|
if (source.type === 'CAS') {
|
||||||
url = config.authUrl
|
url = config.loginUrl + "?service=" + encodeURIComponent(redirectUrl);
|
||||||
+ "?client_id=" + config.clientId
|
}
|
||||||
+ "&scope=" + config.scope
|
if (source.type === 'OIDC') {
|
||||||
+ "&response_type=code"
|
url = config.authUrl + "?client_id=" + config.clientId + "&redirect_uri=" + redirectUrl +
|
||||||
+ "&redirect_uri=" + redirectUrl
|
"&response_type=code&scope=openid+profile+email&state=" + authId;
|
||||||
+ "&state=" + authId;
|
}
|
||||||
}
|
if (source.type === 'OAuth2') {
|
||||||
if (url) {
|
url = config.authUrl
|
||||||
window.location.href = url;
|
+ "?client_id=" + config.clientId
|
||||||
}
|
+ "&scope=" + config.scope
|
||||||
}, () => {
|
+ "&response_type=code"
|
||||||
this.form.authenticate = 'LOCAL';
|
+ "&redirect_uri=" + redirectUrl
|
||||||
|
+ "&state=" + authId;
|
||||||
|
}
|
||||||
|
if (url) {
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
}, () => {
|
||||||
|
this.form.authenticate = 'LOCAL';
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,6 +490,7 @@ const message = {
|
||||||
},
|
},
|
||||||
login: {
|
login: {
|
||||||
normal_Login: "Normal Login",
|
normal_Login: "Normal Login",
|
||||||
|
auth_not_enable: "Authentication is not enabled"
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: 'Authorization management',
|
title: 'Authorization management',
|
||||||
|
|
|
@ -493,6 +493,7 @@ const message = {
|
||||||
},
|
},
|
||||||
login: {
|
login: {
|
||||||
normal_Login: "普通登录",
|
normal_Login: "普通登录",
|
||||||
|
auth_not_enable: "认证未开启"
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: '授权管理',
|
title: '授权管理',
|
||||||
|
|
|
@ -493,6 +493,7 @@ const message = {
|
||||||
},
|
},
|
||||||
login: {
|
login: {
|
||||||
normal_Login: "普通登錄",
|
normal_Login: "普通登錄",
|
||||||
|
auth_not_enable: "認證未開啟"
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
title: '授權管理',
|
title: '授權管理',
|
||||||
|
|
Loading…
Reference in New Issue