Compare commits
4 Commits
3a7b6ee605
...
e4a11a8a53
| Author | SHA1 | Date | |
|---|---|---|---|
| e4a11a8a53 | |||
| fc2c97b502 | |||
| a532eaa89c | |||
| c4f0b2348f |
@ -38,7 +38,7 @@ public class NewsController {
|
|||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
@JwtVerify
|
@JwtVerify
|
||||||
public ResponseEntity<MessageResponse> updateNews(@RequestBody NewsRequest request, @PathVariable Long id) {
|
public ResponseEntity<MessageResponse> updateNews(@PathVariable Long id, @RequestBody NewsRequest request) {
|
||||||
try {
|
try {
|
||||||
newsService.updateNews(id, request);
|
newsService.updateNews(id, request);
|
||||||
} catch (DataIntegrityViolationException e) {
|
} catch (DataIntegrityViolationException e) {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import org.springframework.stereotype.Component;
|
|||||||
@Aspect
|
@Aspect
|
||||||
@Component
|
@Component
|
||||||
public class JwtVerifyAspect {
|
public class JwtVerifyAspect {
|
||||||
@Before("@annotation(JwtVerify)")
|
@Before("@annotation(JwtVerify)&&args(..)")
|
||||||
public void verifyJwtToken(JoinPoint joinPoint) throws JwtValidationException {
|
public void verifyJwtToken(JoinPoint joinPoint) throws JwtValidationException {
|
||||||
Object[] args = joinPoint.getArgs();
|
Object[] args = joinPoint.getArgs();
|
||||||
for (Object arg : args) {
|
for (Object arg : args) {
|
||||||
@ -17,9 +17,9 @@ public class JwtVerifyAspect {
|
|||||||
if (!JwtUtil.isTokenValid(token)) {
|
if (!JwtUtil.isTokenValid(token)) {
|
||||||
throw new JwtValidationException("JWT token is invalid");
|
throw new JwtValidationException("JWT token is invalid");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user