feat(SecurityGlobalFilter.class): 正式环境放行app的put请求

This commit is contained in:
有来技术 2021-10-20 00:54:30 +08:00
parent 831b3e45f0
commit c85598ab08

View File

@ -51,18 +51,19 @@ public class SecurityGlobalFilter implements GlobalFilter, Ordered {
// 线上演示环境禁止修改和删除 // 线上演示环境禁止修改和删除
if (env.equals("prod") && !SecurityConstants.LOGOUT_PATH.equals(request.getPath().toString()) String requestPath = request.getPath().toString();
&& ( if (env.equals("prod") && !SecurityConstants.LOGOUT_PATH.equals(requestPath)
HttpMethod.DELETE.toString().equals(request.getMethodValue()) // 删除方法 && !StrUtil.contains(requestPath, "app-api")
|| HttpMethod.PUT.toString().equals(request.getMethodValue())// 修改方法 && (HttpMethod.DELETE.toString().equals(request.getMethodValue()) // 删除方法
|| SecurityConstants.SAVE_MENU_PATH.equals(request.getPath().toString()) // 新增路由 || HttpMethod.PUT.toString().equals(request.getMethodValue())// 修改方法
|| SecurityConstants.SAVE_MENU_PATH.equals(request.getPath().toString()) // 新增路由
)) { )) {
return ResponseUtils.writeErrorInfo(response, ResultCode.FORBIDDEN_OPERATION); return ResponseUtils.writeErrorInfo(response, ResultCode.FORBIDDEN_OPERATION);
} }
// 不是正确的的JWT不做解析处理 // 不是正确的的JWT不做解析处理
String token = request.getHeaders().getFirst(SecurityConstants.AUTHORIZATION_KEY); String token = request.getHeaders().getFirst(SecurityConstants.AUTHORIZATION_KEY);
if (StrUtil.isBlank(token) || !StrUtil.startWithIgnoreCase(token, SecurityConstants.JWT_PREFIX)) { if (StrUtil.isBlank(token) || !StrUtil.startWithIgnoreCase(token, SecurityConstants.JWT_PREFIX)) {
return chain.filter(exchange); return chain.filter(exchange);
} }