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 { ...@@ -17,7 +17,7 @@ export default {
// }, // },
{ {
name: 'civ_pandawork', name: 'civ_pandawork',
entry: `//${window.location.hostname}:8081/civ_pandawork`, entry: `//${window.location.hostname}:8082/civ_pandawork`,
container: '#micro-container', container: '#micro-container',
activeRule: '/civbase/civ_pandawork', activeRule: '/civbase/civ_pandawork',
}, },
......
...@@ -6320,9 +6320,9 @@ ...@@ -6320,9 +6320,9 @@
} }
}, },
"@wisdom-utils/utils": { "@wisdom-utils/utils": {
"version": "0.0.56", "version": "0.0.61",
"resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.56.tgz", "resolved": "https://g.civnet.cn:4873/@wisdom-utils%2futils/-/utils-0.0.61.tgz",
"integrity": "sha512-blp6F3pOLzcOBovFV/VYylY/GlskspzGhzemNhttg9dvAxfX+AT42VchCJYABExobZjxpYCPUgi4XrdlyFpsyA==", "integrity": "sha512-DxnQrMnta776pZRWVrKmo3AN/lf8k20huwe3jwV8ch5AP5cSsrAxWIO45SnCQGul88ijlW1Yopfa/l2FO2NG3w==",
"requires": { "requires": {
"@ahooksjs/use-request": "^2.0.0", "@ahooksjs/use-request": "^2.0.0",
"axios": "^0.21.1", "axios": "^0.21.1",
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
"@wisdom-map/util": "^1.0.27-0", "@wisdom-map/util": "^1.0.27-0",
"@wisdom-utils/components": "0.0.14", "@wisdom-utils/components": "0.0.14",
"@wisdom-utils/runtime": "0.0.15", "@wisdom-utils/runtime": "0.0.15",
"@wisdom-utils/utils": "0.0.59", "@wisdom-utils/utils": "0.0.61",
"animate.css": "^4.1.1", "animate.css": "^4.1.1",
"antd": "^4.16.13", "antd": "^4.16.13",
"compression": "1.7.4", "compression": "1.7.4",
......
...@@ -8,9 +8,13 @@ const { warning } = Modal; ...@@ -8,9 +8,13 @@ const { warning } = Modal;
// eslint-disable-next-line no-return-await // eslint-disable-next-line no-return-await
instanceRequest.reportCodeError = true; instanceRequest.reportCodeError = true;
instanceRequest.transformRequestURL = function(url) { 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)) { 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; return url;
} }
......
...@@ -12,7 +12,7 @@ import 'sanitize.css/sanitize.css'; ...@@ -12,7 +12,7 @@ import 'sanitize.css/sanitize.css';
// import './vm'; // import './vm';
import React from 'react'; import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import { event } from 'microser-data';
import { Button, ConfigProvider, message, notification } from 'antd'; import { Button, ConfigProvider, message, notification } from 'antd';
import { ConnectedRouter } from 'connected-react-router/immutable'; import { ConnectedRouter } from 'connected-react-router/immutable';
import Immutable from 'immutable'; import Immutable from 'immutable';
...@@ -182,6 +182,7 @@ const initGlobalConfig = () => { ...@@ -182,6 +182,7 @@ const initGlobalConfig = () => {
render({ appContent: '', loading: true }); render({ appContent: '', loading: true });
}) })
.catch(error => { .catch(error => {
console.log(error);
store.dispatch(actionCreators.getConfigError(error)); store.dispatch(actionCreators.getConfigError(error));
}); });
} }
...@@ -229,7 +230,7 @@ initLocale(); ...@@ -229,7 +230,7 @@ initLocale();
window.share && window.share.event && window.share.event.on('triggerMicro', () => { window.share && window.share.event && window.share.event.on('triggerMicro', () => {
initMicroApps(loader, store); initMicroApps(loader, store);
}); });
window.share && window.share.event && window.share.event.on('initConfig', () => { event.on('initConfig', () => {
initGlobalConfig(); initGlobalConfig();
}); });
......
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { event } from 'microser-data';
import { import {
CLEAR_RCENT_KEYWORD, CLEAR_RCENT_KEYWORD,
COMPLEX_CONFIG, COMPLEX_CONFIG,
...@@ -179,9 +179,10 @@ export function logout(data) { ...@@ -179,9 +179,10 @@ export function logout(data) {
}); });
window.globalConfig.token = null; window.globalConfig.token = null;
window.globalConfig.access_token = null; window.globalConfig.access_token = null;
window.globalConfig.hasGateWay = false; // window.globalConfig.hasGateWay = ;
} }
Cookies.set('token', '', { Cookies.set('token', '', {
path: '/', path: '/',
}); });
...@@ -199,6 +200,7 @@ export function logout(data) { ...@@ -199,6 +200,7 @@ export function logout(data) {
localStorage.removeItem('access_token'); localStorage.removeItem('access_token');
// eslint-disable-next-line no-undef,no-restricted-globals // eslint-disable-next-line no-undef,no-restricted-globals
createStoreage.remove(`__PANDA_STORE__${location.hostname}`); createStoreage.remove(`__PANDA_STORE__${location.hostname}`);
event.emit('initConfig');
return { return {
type: LOGINOUT, type: LOGINOUT,
data: { data: {
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
event: new EventEmitter(), event: new EventEmitter(),
}; };
window.share.event.setMaxListeners(1000); window.share.event.setMaxListeners(50000);
window.umi_plugin_ant_themeVar = [ window.umi_plugin_ant_themeVar = [
{ key: 'dark', fileName: 'dark.css', theme: 'dark' }, { key: 'dark', fileName: 'dark.css', theme: 'dark' },
......
...@@ -30,7 +30,6 @@ class SecurityLayout extends React.Component { ...@@ -30,7 +30,6 @@ class SecurityLayout extends React.Component {
if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) { if(_.isNull(global.token) || (global.hasGateWay && _.isNull(global.access_token))) {
this.props.updateCurrentIndex && this.props.updateCurrentIndex(0); 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'; const client = _.isNull(global.client) || _.isUndefined(global.client) ? global.client: 'city';
return ( return (
<Redirect to={`/user/login?client=${client}`} /> <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