WeBankFinTech / DataSphereStudio

DataSphereStudio is a one stop data application development& management portal, covering scenarios including data exchange, desensitization/cleansing, analysis/mining, quality measurement, visualization, and task scheduling.
https://github.com/WeBankFinTech/DataSphereStudio-Doc
Apache License 2.0
3.09k stars 1k forks source link

[Bug] 接口返回了SSOURL,DSS前端无法自动跳转 #494

Open liangqilang opened 2 years ago

liangqilang commented 2 years ago

Search before asking

DSS Component

dss-web/framework

What happened + What you expected to happen

后端接口返回了

{ "data": { "enableSSO": true, "SSOURL": "http://****/user/login?token=datastar&callback=http%3A%2F%2F192.168.1.64%3A8088%2Fapi%2Frest_j%2Fv1%2Fuser%2FcallBack" } }

前端不会自动跳转到SSO 登录页,目前是定向到了DSS 登录页。

Relevent platform

branch dev-1.0.1

Reproduction script

wds.linkis.gateway.conf.enable.sso=true wds.linkis.gateway.conf.sso.interceptor=****

Anything else

No response

Are you willing to submit a PR?

CCweixiao commented 2 years ago

可以参考我的文章 https://mp.weixin.qq.com/s/Qx-24QGbTYg3pdcWwsuvKg

CCweixiao commented 2 years ago

Search before asking

  • [x] I searched the issues and found no similar issues.

DSS Component

dss-web/framework

What happened + What you expected to happen

后端接口返回了

{ "data": { "enableSSO": true, "SSOURL": "http://****/user/login?token=datastar&callback=http%3A%2F%2F192.168.1.64%3A8088%2Fapi%2Frest_j%2Fv1%2Fuser%2FcallBack" } }

前端不会自动跳转到SSO 登录页,目前是定向到了DSS 登录页。

Relevent platform

branch dev-1.0.1

Reproduction script

wds.linkis.gateway.conf.enable.sso=true wds.linkis.gateway.conf.sso.interceptor=****

Anything else

No response

Are you willing to submit a PR?

  • [x] Yes I am willing to submit a PR!
const api = {
  instance: instance,
  error: {
    '-1': function(res) {
      console.log(res.data.data);
      if (res.data.data && res.data.data.enableSSO && res.data.data.SSOURL) {
        localStorage.setItem("enableSSO", res.data.data.enableSSO);
        localStorage.setItem("SSOURL", res.data.data.SSOURL);
        return window.location.replace(res.data.data.SSOURL);
      }
      router.push('/login');
      throw new Error('您尚未登录,请先登录!');
    },
  },
  constructionOfResponse: {
    codePath: 'status',
    successCode: '0',
    messagePath: 'message',
    resultPath: 'data',
  },
};
CCweixiao commented 2 years ago

if (res.data.data && res.data.data.enableSSO && res.data.data.SSOURL) {