Compare commits

...

4 Commits

Author SHA1 Message Date
e4a11a8a53 Merge branch 'main' into personal/heshunme/news 2024-07-03 14:14:06 +08:00
fc2c97b502 bugfix@JwtVerify 2024-07-03 14:13:20 +08:00
a532eaa89c 尝试@JwtVerify的新用法 2024-07-03 14:13:05 +08:00
c4f0b2348f bugfix@JwtVerify 2024-07-03 14:12:42 +08:00
2 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ public class NewsController {
@PutMapping("/{id}")
@JwtVerify
public ResponseEntity<MessageResponse> updateNews(@RequestBody NewsRequest request, @PathVariable Long id) {
public ResponseEntity<MessageResponse> updateNews(@PathVariable Long id, @RequestBody NewsRequest request) {
try {
newsService.updateNews(id, request);
} catch (DataIntegrityViolationException e) {

View File

@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
@Aspect
@Component
public class JwtVerifyAspect {
@Before("@annotation(JwtVerify)")
@Before("@annotation(JwtVerify)&&args(..)")
public void verifyJwtToken(JoinPoint joinPoint) throws JwtValidationException {
Object[] args = joinPoint.getArgs();
for (Object arg : args) {
@ -17,8 +17,8 @@ public class JwtVerifyAspect {
if (!JwtUtil.isTokenValid(token)) {
throw new JwtValidationException("JWT token is invalid");
}
break;
}
break;
}
}
}