Commit 626fe339 authored by 邓晓峰's avatar 邓晓峰

fix: 过滤GetConfig进行鉴权验证

parent 8637940b
Pipeline #39128 passed with stages
in 23 minutes 55 seconds
......@@ -17,7 +17,7 @@ export default {
// },
{
name: 'civ_pandawork',
entry: `//${window.location.hostname}:8081/civ_pandawork`,
entry: `//${window.location.hostname}:8082/civ_pandawork`,
container: '#micro-container',
activeRule: '/civbase/civ_pandawork',
},
......
......@@ -6320,9 +6320,9 @@
}
},
"@wisdom-utils/utils": {
"version": "0.0.56",
"resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.56.tgz",
"integrity": "sha512-blp6F3pOLzcOBovFV/VYylY/GlskspzGhzemNhttg9dvAxfX+AT42VchCJYABExobZjxpYCPUgi4XrdlyFpsyA==",
"version": "0.0.61",
"resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.61.tgz",
"integrity": "sha512-DxnQrMnta776pZRWVrKmo3AN/lf8k20huwe3jwV8ch5AP5cSsrAxWIO45SnCQGul88ijlW1Yopfa/l2FO2NG3w==",
"requires": {
"@ahooksjs/use-request": "^2.0.0",
"axios": "^0.21.1",
......@@ -104,7 +104,7 @@
"@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.0.59",
"@wisdom-utils/utils": "0.0.61",
"animate.css": "^4.1.1",
"antd": "^4.16.13",
"compression": "1.7.4",
......
......@@ -8,9 +8,13 @@ const { warning } = Modal;
// eslint-disable-next-line no-return-await
instanceRequest.reportCodeError = true;
instanceRequest.transformRequestURL = function(url) {
debugger
const excludeURL = ['/PandaCore/GCK/Basis/GateWayConfig', '/CityInterface/rest/services.svc/GetConfig'];
if(excludeURL.includes(url)) {
return url;
}
if (window.globalConfig && window.globalConfig.hasGateWay && /^\/(cityinterface|CityInterface|CityServer|PandaInformatization)/.test(url)) {
return '/GateWay' + url;
return /\/CityInterface\/rest\/services.svc\/GetConfig/.test(url) ? url ? /^\/GateWay/.test(url) ? url : '/GateWay' + url: '/GateWay' + url: '/GateWay' + url;
}
return url;
}
......
......@@ -12,7 +12,7 @@ import 'sanitize.css/sanitize.css';
// import './vm';
import React from 'react';
import ReactDOM from 'react-dom';
import { event } from 'microser-data';
import { Button, ConfigProvider, message, notification } from 'antd';
import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable';
......@@ -182,6 +182,7 @@ const initGlobalConfig = () => {
render({ appContent: '', loading: true });
})
.catch(error => {
console.log(error);
store.dispatch(actionCreators.getConfigError(error));
});
}
......@@ -229,7 +230,7 @@ initLocale();
window.share && window.share.event && window.share.event.on('triggerMicro', () => {
initMicroApps(loader, store);
});
window.share && window.share.event && window.share.event.on('initConfig', () => {
event.on('initConfig', () => {
initGlobalConfig();
});
......
import Cookies from 'js-cookie';
import { event } from 'microser-data';
import {
CLEAR_RCENT_KEYWORD,
COMPLEX_CONFIG,
......@@ -179,9 +179,10 @@ export function logout(data) {
});
window.globalConfig.token = null;
window.globalConfig.access_token = null;
window.globalConfig.hasGateWay = false;
// window.globalConfig.hasGateWay = ;
}
Cookies.set('token', '', {
path: '/',
});
......@@ -199,6 +200,7 @@ export function logout(data) {
localStorage.removeItem('access_token');
// eslint-disable-next-line no-undef,no-restricted-globals
createStoreage.remove(`__PANDA_STORE__${location.hostname}`);
event.emit('initConfig');
return {
type: LOGINOUT,
data: {
......
......@@ -19,7 +19,7 @@
event: new EventEmitter(),
};
window.share.event.setMaxListeners(1000);
window.share.event.setMaxListeners(50000);
window.umi_plugin_ant_themeVar = [
{ key: 'dark', fileName: 'dark.css', theme: 'dark' },
......
......@@ -30,7 +30,6 @@ class SecurityLayout extends React.Component {
if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0);
window.share && window.share.event && window.share.event.emit('initConfig');
const client = _.isNull(global.client) || _.isUndefined(global.client) ? global.client: 'city';
return (
<Redirect to={`/user/login?client=${client}`} />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment