refactor(xPack): 接入oidc单点登录

This commit is contained in:
Captain.B 2021-01-22 19:28:13 +08:00
parent 2cdf1e6730
commit c71b1d49f3
4 changed files with 25 additions and 3 deletions

View File

@ -27,6 +27,7 @@ public class ShiroUtils {
filterChainDefinitionMap.put("/jmeter/download/**", "anon");
filterChainDefinitionMap.put("/authsource/list/allenable", "anon");
filterChainDefinitionMap.put("/sso/signin", "anon");
filterChainDefinitionMap.put("/sso/callback", "anon");
// for swagger
filterChainDefinitionMap.put("/swagger-ui.html", "anon");
filterChainDefinitionMap.put("/swagger-ui/**", "anon");

@ -1 +1 @@
Subproject commit 8d175b5363274672ff33a5883b730e8aaa823f8d
Subproject commit 86f74f5e33eee90a9eba4019f67a470059e4d485

@ -1 +1 @@
Subproject commit 8a6a9ae708306eaf436f35394b71927cec075b0e
Subproject commit 9e64da846793401150260fc50262d82932cf5d8a

View File

@ -15,7 +15,7 @@
</div>
<div class="form">
<el-form-item v-slot:default>
<el-radio-group v-model="form.authenticate">
<el-radio-group v-model="form.authenticate" @change="redirectAuth(form.authenticate)">
<el-radio label="LDAP" size="mini" v-if="openLdap">LDAP</el-radio>
<el-radio label="LOCAL" size="mini" v-if="openLdap">普通登录</el-radio>
<el-radio :label="auth.id" size="mini" v-for="auth in authSources" :key="auth.id">{{ auth.type }} {{ auth.name }}</el-radio>
@ -172,6 +172,27 @@ export default {
} else {
window.location.href = "/"
}
},
redirectAuth(authId) {
if (authId === 'LDAP' || authId === 'LOCAL') {
return;
}
let source = this.authSources.filter(auth => auth.id === authId)[0];
if (source.type === 'CAS') {
return;
}
this.$confirm(this.$t('即将跳转到认证源页面进行认证'), '', {
confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: this.$t('commons.cancel'),
type: 'warning'
}).then(() => {
let config = JSON.parse(source.configuration);
let url = config.authUrl + "/auth?client_id=" + config.clientId + "&redirect_uri=" + config.redirectUrl +
"&response_type=code&scope=openid+profile+email+offline_access&state=" + authId;
window.location.href = url;
}).catch(() => {
this.form.authenticate = 'LOCAL';
});
}
}
}