Compare commits
4 Commits
3a7b6ee605
...
e4a11a8a53
| Author | SHA1 | Date | |
|---|---|---|---|
| e4a11a8a53 | |||
| fc2c97b502 | |||
| a532eaa89c | |||
| c4f0b2348f |
@ -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) {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user