mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
perf(X-Pack): CAS和OIDC插件自动化配置
This commit is contained in:
parent
d83ea8a076
commit
f732b290db
@ -3,3 +3,5 @@ VALUES (1048232869488627719, 'basic.defaultSort', '1', 'text', 13);
|
||||
|
||||
INSERT INTO `core_menu` VALUES (70, 0, 1, 'msg', NULL, 200, NULL, '/msg', 1, 1, 0);
|
||||
INSERT INTO `core_menu` VALUES (71, 70, 2, 'msg-fill', 'msg/fill', 1, 'icon_msg_fill', '/msg-fill', 0, 1, 0);
|
||||
|
||||
UPDATE `xpack_setting_authentication` set `synced` = 0 where `name` = 'oidc' or name = 'cas';
|
@ -118,9 +118,6 @@ service.interceptors.request.use(
|
||||
const val = mapping[key] || key
|
||||
;(config.headers as AxiosRequestHeaders)['Accept-Language'] = val
|
||||
}
|
||||
;(config.headers as AxiosRequestHeaders)['out_auth_platform'] = wsCache.get('out_auth_platform')
|
||||
? wsCache.get('out_auth_platform')
|
||||
: 'default'
|
||||
|
||||
if (config.method === 'get' && config.params) {
|
||||
let url = config.url as string
|
||||
|
@ -24,21 +24,20 @@ export const logoutHandler = (justClean?: boolean) => {
|
||||
}
|
||||
let pathname = window.location.pathname
|
||||
if (pathname) {
|
||||
if (pathname.includes('oidcbi/') || pathname.includes('casbi/')) {
|
||||
if (pathname.includes('oidcbi/')) {
|
||||
pathname = pathname.replace('oidcbi/', '')
|
||||
pathname = pathname.substring(0, pathname.length - 1)
|
||||
window.location.href = pathname + '/oidcbi/oidc/logout'
|
||||
return
|
||||
} else if (pathname.includes('casbi/')) {
|
||||
pathname = pathname.replace('casbi/', '')
|
||||
pathname = pathname.substring(0, pathname.length - 1)
|
||||
const uri = window.location.href
|
||||
window.location.href = pathname + '/casbi/cas/logout?service=' + uri
|
||||
return
|
||||
}
|
||||
pathname = pathname.substring(0, pathname.length - 1)
|
||||
}
|
||||
if (wsCache.get('out_auth_platform') === 'cas') {
|
||||
const uri = window.location.href
|
||||
window.location.href = pathname + '/casbi/cas/logout?service=' + uri
|
||||
return
|
||||
}
|
||||
if (wsCache.get('out_auth_platform') === 'oidc') {
|
||||
window.location.href = pathname + '/oidcbi/oidc/logout'
|
||||
return
|
||||
}
|
||||
if (wsCache.get('custom_auth_logout_url')) {
|
||||
window.location.href = wsCache.get('custom_auth_logout_url')
|
||||
}
|
||||
|
@ -29,12 +29,7 @@ const embeddedStore = useEmbedded()
|
||||
|
||||
const favorited = ref(false)
|
||||
const preview = () => {
|
||||
const href = window.location.href
|
||||
let baseUrl = isDataEaseBi.value ? embeddedStore.baseUrl : href.substring(0, href.indexOf('#'))
|
||||
if (baseUrl.includes('oidcbi/') || baseUrl.includes('casbi/')) {
|
||||
baseUrl = baseUrl.replace('oidcbi/', '')
|
||||
baseUrl = baseUrl.replace('casbi/', '')
|
||||
}
|
||||
const baseUrl = isDataEaseBi.value ? embeddedStore.baseUrl : ''
|
||||
const url = baseUrl + '#/preview?dvId=' + dvInfo.value.id + '&ignoreParams=true'
|
||||
const newWindow = window.open(url, '_blank')
|
||||
initOpenHandler(newWindow)
|
||||
|
@ -1,75 +0,0 @@
|
||||
import { useCache } from '@/hooks/web/useCache'
|
||||
import { platformLoginApi } from '@/api/login'
|
||||
import { useUserStoreWithOut } from '@/store/modules/user'
|
||||
import router from '@/router'
|
||||
const { wsCache } = useCache()
|
||||
const userStore = useUserStoreWithOut()
|
||||
|
||||
export const toPlatformPage = val => {
|
||||
const curOrigin = window.location.origin
|
||||
const curLocation = getCurLocation()
|
||||
if (val === 0) {
|
||||
wsCache.set('out_auth_platform', 'default')
|
||||
} else if (val === 1) {
|
||||
wsCache.set('out_auth_platform', 'ldap')
|
||||
// window.location.href = curOrigin + '/ldapbi/#' + curLocation
|
||||
} else if (val === 2) {
|
||||
wsCache.set('out_auth_platform', 'oidc')
|
||||
window.location.href = curOrigin + '/oidcbi/#' + curLocation
|
||||
} else if (val === 3) {
|
||||
wsCache.set('out_auth_platform', 'cas')
|
||||
window.location.href = curOrigin + '/casbi/#' + curLocation
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
export const setLoginForm = state => {
|
||||
const platform = wsCache.get('out_auth_platform')
|
||||
state.loginForm.loginType = 0
|
||||
if (platform === 'default') {
|
||||
state.loginForm.loginType = 0
|
||||
}
|
||||
if (platform === 'ldap') {
|
||||
state.loginForm.loginType = 1
|
||||
}
|
||||
if (platform === 'oidc') {
|
||||
state.loginForm.loginType = 2
|
||||
}
|
||||
if (platform === 'cas') {
|
||||
state.loginForm.loginType = 3
|
||||
}
|
||||
}
|
||||
|
||||
const platformLogin = origin => {
|
||||
platformLoginApi(origin).then(res => {
|
||||
const token = res.data
|
||||
userStore.setToken(token)
|
||||
const queryRedirectPath = getCurLocation()
|
||||
router.push({ path: queryRedirectPath })
|
||||
})
|
||||
}
|
||||
|
||||
export const callback = () => {
|
||||
const pathname = window.location.pathname
|
||||
let origin = 0
|
||||
if (pathname.startsWith('/casbi')) {
|
||||
origin = 3
|
||||
}
|
||||
if (pathname.startsWith('/oidcbi')) {
|
||||
origin = 2
|
||||
}
|
||||
if (pathname.startsWith('/ldapbi')) {
|
||||
origin = 1
|
||||
}
|
||||
if (origin) {
|
||||
platformLogin(origin)
|
||||
}
|
||||
}
|
||||
|
||||
const getCurLocation = () => {
|
||||
let queryRedirectPath = '/workbranch/index'
|
||||
if (router.currentRoute.value.query.redirect) {
|
||||
queryRedirectPath = router.currentRoute.value.query.redirect as string
|
||||
}
|
||||
return queryRedirectPath
|
||||
}
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 5465e5d32d526fe9290258e453d6d93fd221283a
|
||||
Subproject commit cd39f4ce5c213ccfc1f3847c8bdcfce7d78e673f
|
Loading…
Reference in New Issue
Block a user