Skip to content

acl token support in setKVValue #237

Description

@DanielYWoo

Currently the client can use an acl token, e.g.,

	@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);	

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions