Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support of proxy with required authentication #2137

Open
tiboun opened this issue Jan 21, 2022 · 0 comments · May be fixed by #2139
Open

No support of proxy with required authentication #2137

tiboun opened this issue Jan 21, 2022 · 0 comments · May be fixed by #2139

Comments

@tiboun
Copy link

tiboun commented Jan 21, 2022

Hi,

Currently schema registry API doesn't support authentication requirement. I've done a patch that works with fiddler as an integration test but I would like to have a unit or integration test to be done in order to cover that. Currently, I've found mock-server in order to mock that but seems that it is not working as expected. An issue has been opened and I'm waiting for it in order to submit a PR.

My mainchange is in RestService with the following code :

    if (isValidProxyConfig(proxyHost, proxyPort)) {
      setProxy(proxyHost, proxyPort);
      String user = Optional.ofNullable((String) configs.get(SchemaRegistryClientConfig.PROXY_USER)).orElse("");
      String password = Optional.ofNullable((String) configs.get(SchemaRegistryClientConfig.PROXY_PASSWORD)).orElse("");
      PasswordAuthentication passwordAuthentication = new PasswordAuthentication(user, password.toCharArray());
      String hostLowercase = proxyHost.toLowerCase();
      Authenticator.setDefault(new Authenticator() {
        @Override
        protected PasswordAuthentication getPasswordAuthentication() {
          if (getRequestorType() == RequestorType.PROXY) {
            if (hostLowercase.equals(getRequestingHost().toLowerCase())) {
              if (proxyPort == getRequestingPort()) {
                return passwordAuthentication;
              }
            }
          }
          return null;
        }
      });
    }

Do you know an alternative to mock-server ?

Best regards,

@tiboun tiboun linked a pull request Jan 24, 2022 that will close this issue
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 a pull request may close this issue.

1 participant