Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Captain.B 2020-08-18 11:39:23 +08:00
commit 94c3902c61
6 changed files with 15 additions and 15 deletions

View File

@ -1,5 +1,5 @@
package io.metersphere.commons.constants;
public enum OssMode {
public enum SsoMode {
CAS,LOCAL
}

View File

@ -29,7 +29,7 @@ import java.util.Map;
import java.util.Objects;
@Configuration
@ConditionalOnProperty(prefix="oss",name = "mode", havingValue = "local", matchIfMissing = true)
@ConditionalOnProperty(prefix="sso",name = "mode", havingValue = "local", matchIfMissing = true)
public class ShiroConfig implements EnvironmentAware {
private Environment env;

View File

@ -24,12 +24,12 @@ public class IndexController {
}
}
@GetMapping(value = "/oss/login")
@GetMapping(value = "/sso/login")
public String ossLogin() {
return "redirect:/";
}
@GetMapping(value = "/oss/logout")
@GetMapping(value = "/sso/logout")
public void ossLogout() {
SecurityUtils.getSubject().logout();
}

View File

@ -1,6 +1,6 @@
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.user.SessionUser;
import io.metersphere.commons.utils.SessionUtils;
@ -32,9 +32,9 @@ public class LoginController {
}
return ResultHolder.success(user);
}
String ossMode = env.getProperty("oss.mode");
if (ossMode != null && StringUtils.equalsIgnoreCase(OssMode.CAS.name(), ossMode)) {
return ResultHolder.error("oss");
String ssoMode = env.getProperty("sso.mode");
if (ssoMode != null && StringUtils.equalsIgnoreCase(SsoMode.CAS.name(), ssoMode)) {
return ResultHolder.error("sso");
}
return ResultHolder.error("");
}
@ -52,9 +52,9 @@ public class LoginController {
@GetMapping(value = "/signout")
public ResultHolder logout() {
String ossMode = env.getProperty("oss.mode");
if (ossMode != null && StringUtils.equalsIgnoreCase(OssMode.CAS.name(), ossMode)) {
return ResultHolder.error("oss");
String ssoMode = env.getProperty("sso.mode");
if (ssoMode != null && StringUtils.equalsIgnoreCase(SsoMode.CAS.name(), ssoMode)) {
return ResultHolder.error("sso");
} else {
SecurityUtils.getSubject().logout();
}

View File

@ -41,9 +41,9 @@
localStorage.clear();
window.location.href = "/login";
} else {
if (response.data.message === 'oss') {
if (response.data.message === 'sso') {
localStorage.clear();
window.location.href = "/oss/logout"
window.location.href = "/sso/logout"
}
}
}).catch(error => {

View File

@ -88,8 +88,8 @@
beforeCreate() {
this.$get("/isLogin").then(response => {
if (!response.data.success) {
if (response.data.message === 'oss') {
window.location.href = "/oss/login"
if (response.data.message === 'sso') {
window.location.href = "/sso/login"
} else {
this.ready = true;
}