From 29031882edbe65b5a3468833febbe6eefd85b348 Mon Sep 17 00:00:00 2001 From: msb_89821 Date: Mon, 17 Oct 2022 22:40:56 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E5=AE=9E=E7=8E=B0=E5=8A=9F=E8=83=BD1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../online/text/controller/TokenTest.java | 25 +++++++++++++++++++ .../online/text/intercept/JwtIntercept.java | 16 ++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/controller/TokenTest.java create mode 100644 oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/intercept/JwtIntercept.java diff --git a/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/controller/TokenTest.java b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/controller/TokenTest.java new file mode 100644 index 0000000..b3e54fd --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/controller/TokenTest.java @@ -0,0 +1,25 @@ +package mashibing.online.text.controller; + + +import com.mashibing.dto.ResponseResult; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/test") +public class TokenTest { + + @GetMapping("/authTokenTest") + public ResponseResult authTokenTest(String token){ + + return ResponseResult.success("auth token pass!"); + } + + @GetMapping("/noTokenTest") + public ResponseResult noTokenTest(String token){ + + return ResponseResult.success(" not need token !"); + } + +} diff --git a/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/intercept/JwtIntercept.java b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/intercept/JwtIntercept.java new file mode 100644 index 0000000..0805be2 --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/intercept/JwtIntercept.java @@ -0,0 +1,16 @@ +package mashibing.online.text.intercept; + +import org.springframework.web.servlet.HandlerInterceptor; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class JwtIntercept implements HandlerInterceptor { + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + + + return HandlerInterceptor.super.preHandle(request, response, handler); + } +}