OpenSearch/client
Ioannis Kakavas ac87c10039
[7.x] Fix responses for the token APIs (#54532) (#55278)
This commit fixes our behavior regarding the responses we
return in various cases for the use of token related APIs.
More concretely:

- In the Get Token API with the `refresh` grant, when an invalid
(already deleted, malformed, unknown) refresh token is used in the
body of the request, we respond with `400` HTTP status code
 and an `error_description` header with the message "could not
refresh the requested token".
Previously we would return erroneously return a  `401` with "token
malformed" message.

- In the Invalidate Token API, when using an invalid (already
deleted, malformed, unknown) access or refresh token, we respond
with `404` and a body that shows that no tokens were invalidated:
   ```
   {
     "invalidated_tokens":0,
     "previously_invalidated_tokens":0,
      "error_count":0
   }
   ```
   The previous behavior would be to erroneously return
a `400` or `401` ( depending on the case ).

- In the Invalidate Token API, when the tokens index doesn't
exist or is closed, we return `400` because we assume this is
a user issue either because they tried to invalidate a token
when there is no tokens index yet ( i.e. no tokens have
been created yet or the tokens index has been deleted ) or the
index is closed.

- In the Invalidate Token API, when the tokens index is
unavailable, we return a `503` status code because
we want to signal to the caller of the API that the token they
tried to invalidate was not invalidated and we can't be sure
if it is still valid or not, and that they should try the request
again.

Resolves: #53323
2020-04-16 14:05:55 +03:00
..
benchmark Rename MetaData to Metadata in all of the places (#54519) 2020-03-31 17:24:38 -04:00
client-benchmark-noop-api-plugin Remove Xlint exclusions from gradle files 2020-02-20 14:12:05 +00:00
rest Remove deprecated third-party methods from tests (#55255) (#55269) 2020-04-15 17:54:47 -04:00
rest-high-level [7.x] Fix responses for the token APIs (#54532) (#55278) 2020-04-16 14:05:55 +03:00
sniffer Use task avoidance with forbidden apis (#55034) 2020-04-15 13:27:53 -07:00
test Use task avoidance with forbidden apis (#55034) 2020-04-15 13:27:53 -07:00
transport [7.x] Re-add origin url information to publish POM files (#55173) 2020-04-14 13:24:15 -07:00