You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Override
public Response<Boolean> setKVBinaryValue(String key, byte[] value, String token, PutParams putParams, QueryParams queryParams) {
Request request = Request.Builder.newBuilder()
.setEndpoint("/v1/kv/" + key)
.setToken(token) <---- here is the acl token as X-Consul-Token header
.addUrlParameter(queryParams)
.addUrlParameter(putParams)
.setBinaryContent(value)
.build();
The token will be later used by Utils.createTokenMap() and attached to the request header as X-Consul-Token. Good.
But in the string value of the same method, why do we use the token as a request parameter? And the token will not be attached to the request header, instead, it's attached as a request parameter. What is it for?
@Override
public Response<Boolean> setKVValue(String key, String value, String token, PutParams putParams, QueryParams queryParams) {
UrlParameters tokenParam = token != null ? new SingleUrlParameters("token", token) : null; <-- what is this?
HttpResponse httpResponse = rawClient.makePutRequest("/v1/kv/" + key, value, putParams, tokenParam, queryParams);
The text was updated successfully, but these errors were encountered:
mehiel
pushed a commit
to mehiel/consul-api
that referenced
this issue
May 5, 2023
Consul now warns aggressively when token is provided as a request param
and the X-Consul-Token is required. Also as already mentioned in Ecwid#186
token request param will be removed in Consul v1.17.
By reading the code and related PRs I've seen that in the so called
"new http architecture" this is addressed although not all clients fully
utilize the new Request class.
This PR uses the Request class for both Catalog and KV clients.
Should address both Ecwid#186 and Ecwid#237.
Consul now warns aggressively when token is provided as a request param
and the X-Consul-Token is required. Also as already mentioned in Ecwid#186
token request param will be removed in Consul v1.17.
By reading the code and related PRs I've seen that in the so called
"new http architecture" this is addressed although not all clients fully
utilize the new Request class.
This PR uses the Request class for both Catalog and KV clients.
Should address both Ecwid#186 and Ecwid#237.
Currently the client can use an acl token, e.g.,
The token will be later used by Utils.createTokenMap() and attached to the request header as X-Consul-Token. Good.
But in the string value of the same method, why do we use the token as a request parameter? And the token will not be attached to the request header, instead, it's attached as a request parameter. What is it for?
The text was updated successfully, but these errors were encountered: