mirror of
https://github.com/didi/KnowStreaming.git
synced 2026-01-06 13:51:08 +08:00
接口过滤策略由接口黑名单转成接口白名单
This commit is contained in:
@@ -64,16 +64,16 @@ public class LoginServiceImpl implements LoginService {
|
||||
|
||||
@Override
|
||||
public boolean checkLogin(HttpServletRequest request, HttpServletResponse response) {
|
||||
String uri = request.getRequestURI();
|
||||
if (uri.contains("..")) {
|
||||
LOGGER.error("class=LoginServiceImpl||method=checkLogin||msg=uri illegal||uri={}", uri);
|
||||
String uri = request.getRequestURI().replace("//", "/");
|
||||
if (uri.contains("/../") || uri.contains("/./")) {
|
||||
LOGGER.error("class=LoginServiceImpl||method=checkLogin||msg=uri illegal, contains /../ or /./||uri={}", uri);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(uri.contains(ApiPrefix.API_V1_NORMAL_PREFIX)
|
||||
|| uri.contains(ApiPrefix.API_V1_RD_PREFIX)
|
||||
|| uri.contains(ApiPrefix.API_V1_OP_PREFIX))) {
|
||||
// 白名单接口, 直接忽略登录
|
||||
if (uri.startsWith(ApiPrefix.API_V1_SSO_PREFIX)
|
||||
|| uri.startsWith(ApiPrefix.API_V1_THIRD_PART_PREFIX)
|
||||
|| uri.startsWith(ApiPrefix.GATEWAY_API_V1_PREFIX)) {
|
||||
// 白名单接口直接true
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user