修正配置
This commit is contained in:
parent
d3f13e7cd8
commit
5076b8b010
|
|
@ -12,6 +12,7 @@ public class SystemUtils {
|
|||
|
||||
public static String windowsPath;
|
||||
|
||||
public static String otherPath;
|
||||
|
||||
public static String linuxPath;
|
||||
|
||||
|
|
@ -25,6 +26,11 @@ public class SystemUtils {
|
|||
SystemUtils.windowsPath = windowsPath;
|
||||
}
|
||||
|
||||
@Value("${file.upload_path.other}")
|
||||
public void setOtherPath(String otherPath) {
|
||||
SystemUtils.otherPath = otherPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动注入
|
||||
*
|
||||
|
|
@ -65,10 +71,11 @@ public class SystemUtils {
|
|||
} else if ("linux".equals(os)) {
|
||||
return linuxPath;
|
||||
} else {
|
||||
return windowsPath;
|
||||
return otherPath;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.bonus.gzgqj.manager.constant.SecurityConstants;
|
|||
import com.bonus.gzgqj.manager.security.entity.SelfUserEntity;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -27,14 +28,21 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||
@Autowired
|
||||
private JWTTokenService tokenService;
|
||||
|
||||
@Value("${server.servlet.context-path}")
|
||||
public String path;
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException, IOException, ServletException {
|
||||
//获取token
|
||||
String jwtToken = SecurityUtils.getToken(request);
|
||||
String uri=request.getRequestURI();
|
||||
System.err.println(uri);
|
||||
System.err.println(uri);
|
||||
|
||||
if("/login/userLogin".equals(uri)){
|
||||
if((path + "/login/userLogin").equals(uri)){
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
if((path +"/login/appUserLogin").equals(uri)){
|
||||
filterChain.doFilter(request, response);
|
||||
return;
|
||||
}
|
||||
|
|
@ -47,7 +55,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||
return;
|
||||
}
|
||||
if(StringUtils.isEmpty(jwtToken)){
|
||||
ResultUtil.responseJson(response,ResultUtil.resultCode(401,"请先登录"));
|
||||
System.err.println("----------------->");
|
||||
ResultUtil.responseJson(response,ResultUtil.resultCode(401,"登录过期,请先登录"));
|
||||
System.err.println("异常401,token信息:" + jwtToken + ",地址" + uri);
|
||||
return;
|
||||
}
|
||||
//解析token
|
||||
|
|
@ -59,10 +69,10 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ResultUtil.responseJson(response,ResultUtil.resultCode(401,"请先登录"));
|
||||
ResultUtil.responseJson(response,ResultUtil.resultCode(401,"登录过期,请先登录"));
|
||||
return;
|
||||
}
|
||||
SelfUserEntity loginUser = tokenService.getLoginUser(request);
|
||||
SelfUserEntity loginUser = tokenService.getLoginUser(request);
|
||||
if(Objects.isNull(loginUser)){
|
||||
ResultUtil.responseJson(response,ResultUtil.resultCode(401,"登录过期,请重新登录"));
|
||||
System.err.println("异常401,token信息:" + jwtToken + ",地址" + uri);
|
||||
|
|
@ -79,4 +89,4 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter {
|
|||
//放行
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ file:
|
|||
upload_path:
|
||||
windows: D://files/zg_gqj
|
||||
linux: /home/zg_gqj/files
|
||||
other: /Users/syruan/files
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# 环境配置
|
||||
spring:
|
||||
profiles:
|
||||
active: local
|
||||
active: saas
|
||||
Loading…
Reference in New Issue