[ 
https://issues.apache.org/jira/browse/NUTCH-2989?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim Allison resolved NUTCH-2989.
--------------------------------
    Resolution: Fixed

Fellow Nutch devs, please let me know if I botched any of our processes in 
fixing this.  Thank you!

> Can't have username/pw AND https on elastic-indexer?!
> -----------------------------------------------------
>
>                 Key: NUTCH-2989
>                 URL: https://issues.apache.org/jira/browse/NUTCH-2989
>             Project: Nutch
>          Issue Type: Task
>          Components: indexer, plugin
>    Affects Versions: 1.19
>            Reporter: Tim Allison
>            Assignee: Tim Allison
>            Priority: Major
>             Fix For: 1.20
>
>
> While working on NUTCH-2920, I copied+pasted the elastic indexer.  As part of 
> that process, I noticed that basic auth doesn't work with https.
> {code:java}
> if (auth) {
>         restClientBuilder
>             .setHttpClientConfigCallback(new HttpClientConfigCallback() {
>               @Override
>               public HttpAsyncClientBuilder customizeHttpClient(
>                   HttpAsyncClientBuilder arg0) {
>                 return 
> arg0.setDefaultCredentialsProvider(credentialsProvider);
>               }
>             });
>       }
>       // In case of HTTPS, set the client up for ignoring problems with 
> self-signed
>       // certificates and stuff
>       if ("https".equals(scheme)) {
>         try {
>           SSLContextBuilder sslBuilder = SSLContexts.custom();
>           sslBuilder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
>           final SSLContext sslContext = sslBuilder.build();
>           restClientBuilder.setHttpClientConfigCallback(new 
> HttpClientConfigCallback() {
>             @Override
>             public HttpAsyncClientBuilder 
> customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
>               // ignore issues with self-signed certificates
>               
> httpClientBuilder.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE);
>               return httpClientBuilder.setSSLContext(sslContext);
>             }
>           });
>         } catch (Exception e) {
>           LOG.error("Error setting up SSLContext because: " + e.getMessage(), 
> e);
>         }
>       }
> {code}
> On NUTCH-2920, I fixed this for the opensearch-indexer by adding another {{if 
> (auth)}} statement under the {{https}} branch.
> If this is an actual issue, I'm happy to open a PR.  If I've misunderstood 
> the code or the design, please close as "not a problem".



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to