Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

proxy support for cookie session and IAM authentication#531

Merged
emlaver merged 1 commit intomasterfrom
528-connect-thru-proxy
Sep 8, 2021
Merged

proxy support for cookie session and IAM authentication#531
emlaver merged 1 commit intomasterfrom
528-connect-thru-proxy

Conversation

@emlaver
Copy link
Copy Markdown
Contributor

@emlaver emlaver commented Sep 3, 2021

Checklist

  • Tick to sign-off your agreement to the Developer Certificate of Origin (DCO) 1.1
  • Added tests for code changes or test/build only changes
  • Updated the change log file (CHANGES.md|CHANGELOG.md) or test/build only changes
  • Completed the PR template below:

Description

Enable proxy support for cookie session and IAM authentication.
fixes #528

Approach

Extend the CookieInterceptorBase constructor with a proxy url parameter.
Update both IamCookieInterceptor and CookieInterceptor to support new proxy url parameter during initialization.

Schema & API Changes

Security and Privacy

Testing

Manual testing against a local mock server. The following tests passed:

  1. Proxy enabled with request + session auth against local couchdb
  2. Proxy enabled with request + session auth against Cloudant
  3. Proxy enabled with request + IAM (only with built-in HttpUrlConnection) against Cloudant

Monitoring and Logging

@emlaver emlaver self-assigned this Sep 3, 2021
Copy link
Copy Markdown
Member

@ricellis ricellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally it looks fine, but I've recommended some tidy up around the ctors. Also the files need copyright updates.

Comment thread cloudant-client/src/main/java/com/cloudant/client/api/ClientBuilder.java Outdated
Comment thread cloudant-client/src/main/java/com/cloudant/client/api/ClientBuilder.java Outdated
Copy link
Copy Markdown
Member

@ricellis ricellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 thanks

I noticed that we aren't using setProxyAuthentication in the session interceptor, but any configured ProxyAuthInterceptor will already get included when we copy the interceptors. AFAICT the non-interceptor branch is defunct (for https proxies that never worked) so I think this is fine.

Copy link
Copy Markdown
Contributor

@mojito317 mojito317 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it looks good to me! I found 2 things you have missed.

*
* @param username The username to use when getting the cookie (not URL encoded)
* @param password The password to use when getting the cookie (not URL encoded)
* @param baseURL The base URL to use when constructing an `_session` request.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param proxyURL is missing

@@ -42,12 +43,25 @@ public class CookieInterceptor extends CookieInterceptorBase {
*/
public CookieInterceptor(String username, String password, String baseURL) {
// Use form encoding for the user/pass submission
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not necessary here anymore.

@emlaver emlaver force-pushed the 528-connect-thru-proxy branch from 25b1078 to 290d1d8 Compare September 8, 2021 15:36
@emlaver emlaver merged commit 6a353d1 into master Sep 8, 2021
@emlaver emlaver deleted the 528-connect-thru-proxy branch September 8, 2021 16:20
@ricellis ricellis added this to the 2.20.1 milestone Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't connect to Cloudant through proxy

3 participants