spring-cloud-gateway-demo
spring-cloud-gateway-demo copied to clipboard
Method "@Postmapping" is giving 403 forbidden
Hi
GetMapping is working fine but Postmapping having issue 403 forbidden
// This working fine
@GetMapping("/resource")
public String resource(@AuthenticationPrincipal Jwt jwt) {
LOG.trace("***** JWT Headers: {}", jwt.getHeaders());
LOG.trace("***** JWT Claims: {}", jwt.getClaims().toString());
LOG.trace("***** JWT Token: {}", jwt.getTokenValue());
return String.format("Resource accessed by: %s (with subjectId: %s)" ,
jwt.getClaims().get("user_name"),
jwt.getSubject());
}
// 403 forbidden
@PostMapping("/message")
public String createMessage(@RequestBody String message) {
return String.format("Message was created. Content: %s", message);
}
Please help me if am missing some thing . Thanks in advance.