Compare commits
No commits in common. "e4a11a8a53fdd727a3e8ace2c02098c8d58d85ee" and "3a7b6ee605f8aff295b6018c8725aaf75e2022f1" have entirely different histories.
e4a11a8a53
...
3a7b6ee605
@ -38,7 +38,7 @@ public class NewsController {
|
|||||||
|
|
||||||
@PutMapping("/{id}")
|
@PutMapping("/{id}")
|
||||||
@JwtVerify
|
@JwtVerify
|
||||||
public ResponseEntity<MessageResponse> updateNews(@PathVariable Long id, @RequestBody NewsRequest request) {
|
public ResponseEntity<MessageResponse> updateNews(@RequestBody NewsRequest request, @PathVariable Long id) {
|
||||||
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)&&args(..)")
|
@Before("@annotation(JwtVerify)")
|
||||||
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