ing-bank / scruid

Scala + Druid: Scruid. A library that allows you to compose queries in Scala, and parse the result back into typesafe classes.
Apache License 2.0
115 stars 29 forks source link

Scruid should support authentication #66

Closed barend closed 4 years ago

barend commented 4 years ago

The current (2.2.0) version of Scruid does not support authentication. Scruid should be able to authenticate itself with the Druid Broker.

Some thoughts:

barend commented 4 years ago

I have no prior experience with Akka. Having looked at the code, I am confident that I can contribute a PR that implements the simple case (which would solve my immediate requirement). However, it would result in an API that cannot support the complex case.

If I can get a little help in defining the interception API and integrating it into the DruidAdvancedHttpClient at the appropriate places, I'd be happy to do the implementation work to get the fancy version in place.

bjgbeelen commented 4 years ago

Hi @barend ,

I dug into the AdvancedHttpClient a bit more and together with the cases you described, I implemented a rough design which I think would work for your case. It's on the outer edges of the executeRequest, not touching any of the internal stream stuff.

I have a branch here: https://github.com/ing-bank/scruid/compare/request-flow-customization

As you know I don't have much time coming weeks, so I hope it is of help in further steps to take. You can continue on the branch, or just use it as an inspiration, or go in a completely different direction.

anskarl commented 4 years ago

Hi @barend and @bjgbeelen

I would like to help regarding the authentication support in Scruid. @bjgbeelen I took the initiative to make some additions to your design in order to add support for configuration and prepare a testing environment.

All additions are in https://github.com/anskarl/scruid/tree/request-flow-customization

bjgbeelen commented 4 years ago

Awesome @anskarl ! I applied some renaming this morning, saw you worked on the branch already before i made those :D (i think I like RequestFlowExtension better than RequestFlowCustomization

I think @barend will find these additions very welcome!

I'll try to keep an eye on the development that's going to happen, but I'm expecting a daughter any time now, so will have focus off of my computer

anskarl commented 4 years ago

Excellent news @bjgbeelen! I wish all the best for the birth of your daughter!!! I am also expecting a daughter the next month :)

I will update the branch with the changes and rename ing.wbaa.druid.AuthHttpClientSpec to ing.wbaa.druid.AuthenticationSpec in tests.

barend commented 4 years ago

I have added another fork in the mix: barend/request-flow-customization 😄

No real customisations of my own yet. This starts with anskarl/request-flow-customization, merges the latest changes of master, and moves the authentication proxy into the existing NGINX container. I did add a "negative" test for the authentication flow, so that's a start. I'll look into this in more detail.