Added a way to provide custom HTTP features (included: BasicAuthentication)#222
Added a way to provide custom HTTP features (included: BasicAuthentication)#222ericfjosne wants to merge 8 commits intodocker-java:masterfrom ericfjosne:http-features
Conversation
Required when creating an image with a FROM command, using a private registry.
Removed basic auth parameters from DockerClientConfig. Created first AbstractHttpFeature: HttpBasicAuthenticationFeature.
AbstractDockerClientTest class.
Conflicts: src/main/java/com/github/dockerjava/api/command/BuildImageCmd.java src/main/java/com/github/dockerjava/core/DockerClientImpl.java src/main/java/com/github/dockerjava/core/command/BuildImageCmdImpl.java src/main/java/com/github/dockerjava/jaxrs/BuildImageCmdExec.java src/main/java/com/github/dockerjava/jaxrs/DockerCmdExecFactoryImpl.java
|
@ericfjosne I've pushed a branch 'refact-config' (#226) where I've factored out all JAXRS/ApacheConnector implementation specific parameters from Please take a look at it to see if you could implement your use case this way. Any comments are really welcome. Thanks! |
|
Good morning Marcus, Sorry for the long delay. I only had the chance to take a look at your suggestions tonight. For the reminder, my fork added the 3 following features to your project: Basic HTTP authentication on the docker API The ClientResponseFilters only applies after the communication is performed, while I needed something to adapt it beforehand. I tweaked your branch code (refact-config) a bit and managed to get it all working for me. Here is what I changed: In your DockerCmdExecFactoryImpl, i changed the following: private ClientRequestFilter[] clientRequestFilters; // instead of Class<? extends ClientResponseFilter>[] clientResponseFilters @OverRide I then created my custom client request filter, like this: public class MyCustomClientRequestFilter implements ClientRequestFilter{ } And this is how I create my DockerClient instance: public static DockerClient getDockerClient(String dockerRemoteApiUrl, String nginxUser, String nginxPass, String registryUser, String registryPass, String registryMail, String registryUrl){ } I am not quite satisfied with the way I created the DockerClient instance. Eventually, your readTimeout, maxTotalConnection and maxPerRouteConnection could also be implemented within a ClientRequestFilter, although it might not be super obvious for integrators. If this is okay for you, I would really love for this to become mainstream in the docker-java project :-) Small detail though: connectTimeout is a quite common parameter for any connectivity implementation. Again, thanks for your time and support. Have a good day, Eric Fjøsne
|
|
Good morning again, FYI, I pushed your refactored “refact-config” branch with my changes to my repository, with the same branch name. Have a good day ! Eric Fjøsne
|
|
Hi Eric, would it be possible to you to pull the latest changes from master into your branch and/or create a fresh PR? Cheers |
|
@ericfjosne I've created a fresh PR #282 Please review if this works for your use cases. Thanks! |
I needed to add BasicAuthentication for the calls to the API.
This pull request allows an optional custom list of AbstractHttpFeatures to be given to the DockerClientBuilder.getInstance method. It also implements the HttpBasicAuthenticationFeature class I needed.
This branch is based on today's (13/05/2015) master branch from the main repo.