Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
94c3902c61
|
@ -1,5 +1,5 @@
|
||||||
package io.metersphere.commons.constants;
|
package io.metersphere.commons.constants;
|
||||||
|
|
||||||
public enum OssMode {
|
public enum SsoMode {
|
||||||
CAS,LOCAL
|
CAS,LOCAL
|
||||||
}
|
}
|
|
@ -29,7 +29,7 @@ import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnProperty(prefix="oss",name = "mode", havingValue = "local", matchIfMissing = true)
|
@ConditionalOnProperty(prefix="sso",name = "mode", havingValue = "local", matchIfMissing = true)
|
||||||
public class ShiroConfig implements EnvironmentAware {
|
public class ShiroConfig implements EnvironmentAware {
|
||||||
private Environment env;
|
private Environment env;
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,12 @@ public class IndexController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/oss/login")
|
@GetMapping(value = "/sso/login")
|
||||||
public String ossLogin() {
|
public String ossLogin() {
|
||||||
return "redirect:/";
|
return "redirect:/";
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/oss/logout")
|
@GetMapping(value = "/sso/logout")
|
||||||
public void ossLogout() {
|
public void ossLogout() {
|
||||||
SecurityUtils.getSubject().logout();
|
SecurityUtils.getSubject().logout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package io.metersphere.controller;
|
package io.metersphere.controller;
|
||||||
|
|
||||||
import io.metersphere.commons.constants.OssMode;
|
import io.metersphere.commons.constants.SsoMode;
|
||||||
import io.metersphere.commons.constants.UserSource;
|
import io.metersphere.commons.constants.UserSource;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
import io.metersphere.commons.user.SessionUser;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
|
@ -32,9 +32,9 @@ public class LoginController {
|
||||||
}
|
}
|
||||||
return ResultHolder.success(user);
|
return ResultHolder.success(user);
|
||||||
}
|
}
|
||||||
String ossMode = env.getProperty("oss.mode");
|
String ssoMode = env.getProperty("sso.mode");
|
||||||
if (ossMode != null && StringUtils.equalsIgnoreCase(OssMode.CAS.name(), ossMode)) {
|
if (ssoMode != null && StringUtils.equalsIgnoreCase(SsoMode.CAS.name(), ssoMode)) {
|
||||||
return ResultHolder.error("oss");
|
return ResultHolder.error("sso");
|
||||||
}
|
}
|
||||||
return ResultHolder.error("");
|
return ResultHolder.error("");
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,9 @@ public class LoginController {
|
||||||
|
|
||||||
@GetMapping(value = "/signout")
|
@GetMapping(value = "/signout")
|
||||||
public ResultHolder logout() {
|
public ResultHolder logout() {
|
||||||
String ossMode = env.getProperty("oss.mode");
|
String ssoMode = env.getProperty("sso.mode");
|
||||||
if (ossMode != null && StringUtils.equalsIgnoreCase(OssMode.CAS.name(), ossMode)) {
|
if (ssoMode != null && StringUtils.equalsIgnoreCase(SsoMode.CAS.name(), ssoMode)) {
|
||||||
return ResultHolder.error("oss");
|
return ResultHolder.error("sso");
|
||||||
} else {
|
} else {
|
||||||
SecurityUtils.getSubject().logout();
|
SecurityUtils.getSubject().logout();
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,9 +41,9 @@
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
window.location.href = "/login";
|
window.location.href = "/login";
|
||||||
} else {
|
} else {
|
||||||
if (response.data.message === 'oss') {
|
if (response.data.message === 'sso') {
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
window.location.href = "/oss/logout"
|
window.location.href = "/sso/logout"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
|
@ -88,8 +88,8 @@
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
this.$get("/isLogin").then(response => {
|
this.$get("/isLogin").then(response => {
|
||||||
if (!response.data.success) {
|
if (!response.data.success) {
|
||||||
if (response.data.message === 'oss') {
|
if (response.data.message === 'sso') {
|
||||||
window.location.href = "/oss/login"
|
window.location.href = "/sso/login"
|
||||||
} else {
|
} else {
|
||||||
this.ready = true;
|
this.ready = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue