Skip to content

add support for acl tokens in discovery and config - #80

Merged
spencergibb merged 1 commit into
spring-cloud:masterfrom
bpgray:master
Sep 8, 2015
Merged

spencergibb merged 1 commit into
spring-cloud:masterfrom
bpgray:master

Conversation

@bpgray

@bpgray bpgray commented Sep 4, 2015

Copy link
Copy Markdown

Pull request against #66

This establishes two different acl tokens, one for registering the service in discovery and one for retrieving keys in config.

At that point Ecwid/consul-api does not support tokens for deregistering services. I'll open a new issue with consul-api to address.

Also, I was unable to build this due to some upstream dependencies (spring-integration-bom) not being available.

@spencergibb

Copy link
Copy Markdown
Member

So if it doesn't support deregistering with an acl, will this need to wait until consul-api does support it?

@bpgray

bpgray commented Sep 4, 2015

Copy link
Copy Markdown
Author

I think this probably needs to wait. Having register without deregister isn't entirely helpful.
If you like the approach, you could merge the k/v functionality into config and hold off on the discovery functionality.
Here is the ticket and pull request in consul-api: Ecwid/consul-api#27
Once that goes, I can update this pull request to support deregister as well.

@bpgray

bpgray commented Sep 6, 2015

Copy link
Copy Markdown
Author

@spencergibb turns out we don't need tokens to deregister services, so this should be good to go. I also took some time to test both the discovery and config token functionality, and all checked out.

I put some detail on the situation with tokens and the deregister endpoint over on consul-api if you're interested: Ecwid/consul-api#28

Also, let me know if you would like some tests for the acl token functionality, and I can work on a pull request next week.

Thank you!

@spencergibb

Copy link
Copy Markdown
Member

Sounds good. If you get tests by teusday, great. Otherwise I'll merge and you can add tests later in the week.

@bpgray

bpgray commented Sep 7, 2015

Copy link
Copy Markdown
Author

I think there are a couple of options for testing the ACL functionality.

If you want to go a functional route, I setup an example that secures consul with ACLs, registers a service using an allowed ACL, and then verifies the service was registered. Here is the branch: https://github.com/bpgray/spring-cloud-consul/tree/test-discovery-acl

Note, that I wasn't able to get this working in Travis CI (it couldn't find the config directory), which I think has something to do with the username/permissions in the .travis.yml. The tests did work for me locally.

This example still needs a bit of polish, including needing to add anonymous permissions to register the other test services (currently they are all ACL rejected, although the tests still pass).

Another approach would be to use mocks in the testing. It looks like mockito is being using in spring-cloud-config. Let me know if you would like to go that route, and what dependency to use.

I probably won't be able to develop the testing further until later in the week, so maybe best to merge this pull request as is.

@bpgray

bpgray commented Sep 8, 2015

Copy link
Copy Markdown
Author

Functional tests now work on my fork and branch with travis at https://github.com/bpgray/spring-cloud-consul/tree/test-discovery-acl

I had to make a couple minor adjustments to .travis.yml to get this working on my fork. Let me know if you like this approach, and I can send a pull request. (I'll revert these adjustments in the pull request so it works in your repo).

@spencergibb
spencergibb merged commit 5154b91 into spring-cloud:master Sep 8, 2015
spencergibb added a commit that referenced this pull request Sep 8, 2015
* pull80:
  add support for acl tokens in discovery and config
@spencergibb

Copy link
Copy Markdown
Member

@bpgray go ahead with a new PR for the integration tests.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants