add:开发模式不做身份验证

This commit is contained in:
Yutousama 2022-07-16 16:13:28 +08:00
parent 39d4edebae
commit e17095cc7e
2 changed files with 4 additions and 0 deletions

View File

@ -46,6 +46,7 @@ public class RoleAccessDecisionManager implements AccessDecisionManager {
return; return;
} }
if("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) { if("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
authentication.setAuthenticated(true);
return; return;
} }
if(url.endsWith(".ts")||url.endsWith(".m3u8")){ if(url.endsWith(".ts")||url.endsWith(".m3u8")){

View File

@ -434,6 +434,9 @@ public class Tools {
} }
public static String getLoginUser() { public static String getLoginUser() {
if("dev".equals(ConfigTools.load(ConfigTools.CONFIG, "model"))) {
return "admin";
}
Object user = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); Object user = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if (user instanceof String) { if (user instanceof String) {
return (String) user; return (String) user;