diff --git a/monkey-api-encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java b/monkey-api-encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java index 9e22c8f..dbd95d5 100644 --- a/monkey-api-encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java +++ b/monkey-api-encrypt-core/src/main/java/com/cxytiandi/encrypt/core/EncryptionFilter.java @@ -19,15 +19,14 @@ import com.cxytiandi.encrypt.algorithm.AesEncryptAlgorithm; import com.cxytiandi.encrypt.algorithm.EncryptAlgorithm; +import org.springframework.util.AntPathMatcher; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.DispatcherServlet; import org.springframework.web.servlet.HandlerExecutionChain; import org.springframework.web.servlet.HandlerMapping; -import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping; /** * 数据加解密过滤器 @@ -227,6 +226,14 @@ private boolean contains(List list, String uri, String methodType, HttpS return true; } + // 优先用AntPathMatcher,其实用这个也够了,底层是一样的,下面用的方式兜底 + for (String u : list) { + boolean match = new AntPathMatcher().match(u, uri); + if (match) { + return true; + } + } + try { // 支持RestFul风格API // 采用Spring MVC内置的匹配方式将当前请求匹配到对应的Controller Method上,获取注解进行匹配是否要加解密