parent
68744cdc7d
commit
29031882ed
@ -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 !");
|
||||
}
|
||||
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue