Вот мой код:
Контроллер:
@PostMapping("/create")
public ResponseEntity<?> createUser(@RequestBody UserExternalResource newUser) {
try {
LOGGER.info("Incoming request to create a user: {}", newUser);
return userService.createUser(newUser);
} catch (Exception e) {
LOGGER.error("Error create user: " + newUser + ". Message: " + e.getMessage(), e);
return new ResponseEntity<>(new ResponseResource("Error creating user!"), HttpStatus.INTERNAL_SERVER_ERROR);
}
}
Тело запроса:
{
"user" : "John",
"username" : "john1"
}
Когда я пытаюсь отправить этот запрос с почтальоном, я получаю 403 Запрещеноошибка.
Ответ с консоли почтальона:
POST /e/api/user/create
Content-Type: text/plain
cache-control: no-cache
Postman-Token: b6590554-b54e-4935-b0c2-bc43857b3dc1
User-Agent: PostmanRuntime/7.6.0
Accept: */*
Host: localhost:8500
cookie: EXAMPLE SERVICE-SESSIONID=3TWT113hsJ0e1LVQEDlQqp69O6U8VZx-7sFSyH63
accept-encoding: gzip, deflate
content-length: 284
{
"user" : "John",
"username" : "john1"
}
HTTP/1.1 403
status: 403
Expires: 0
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
X-XSS-Protection: 1; mode=block
Pragma: no-cache
Date: Wed, 06 Feb 2019 15:11:55 GMT
Connection: keep-alive
X-Content-Type-Options: nosniff
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
{"timestamp":1549465915019,"status":403,"error":"Forbidden","message":"Access Denied","path":"/e/api/user/create"}
Кто-нибудь знает, в чем может быть проблема?