From 04508e185524d8ca7707898f7ec74cd61c76b0bb Mon Sep 17 00:00:00 2001 From: "jihuan.yin@ipiaoniu.com" Date: Tue, 30 Mar 2021 19:36:14 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=20https://github.com/yinjihuan/monkey-ap?= =?UTF-8?q?i-encrypt/issues/69=20AntPathMatcher=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cxytiandi/encrypt/core/EncryptionFilter.java | 4 +++- .../controller/UserController.java | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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 dbd95d5..f400195 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 @@ -73,6 +73,8 @@ public EncryptionFilter(String key, List responseEncryptUriList, List list, String uri, String methodType, HttpS // 优先用AntPathMatcher,其实用这个也够了,底层是一样的,下面用的方式兜底 for (String u : list) { - boolean match = new AntPathMatcher().match(u, uri); + boolean match = antPathMatcher.match(u, prefixUri); if (match) { return true; } diff --git a/monkey-api-encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/controller/UserController.java b/monkey-api-encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/controller/UserController.java index 010018b..9530522 100644 --- a/monkey-api-encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/controller/UserController.java +++ b/monkey-api-encrypt-springboot-example/src/main/java/com/cxytiandi/encrypt_springboot_example/controller/UserController.java @@ -65,6 +65,16 @@ public UserDto save(@RequestBody UserDto dto, @PathVariable int id) { System.err.println(dto.getId() + "\t" + dto.getName()); return dto; } + + @Encrypt + @GetMapping("/save/{id}") + public UserDto getUser(@PathVariable int id) { + UserDto dto = new UserDto(); + dto.setId(id); + dto.setName("加密实体对象"); + return dto; + } + @RequestMapping(value="encryptEntityXml",produces= {MediaType.APPLICATION_XML_VALUE}) public UserXmlDto encryptEntityXml() {