Github user alopresto commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/695#discussion_r72714290
  
    --- Diff: 
nifi-toolkit/nifi-toolkit-tls/src/main/java/org/apache/nifi/toolkit/tls/service/TlsCertificateSigningRequestPerformer.java
 ---
    @@ -0,0 +1,144 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.nifi.toolkit.tls.service;
    +
    +import com.fasterxml.jackson.databind.ObjectMapper;
    +import org.apache.commons.io.IOUtils;
    +import org.apache.commons.io.input.BoundedInputStream;
    +import org.apache.http.HttpHost;
    +import org.apache.http.client.methods.CloseableHttpResponse;
    +import org.apache.http.client.methods.HttpPost;
    +import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
    +import org.apache.http.entity.ByteArrayEntity;
    +import org.apache.http.impl.client.CloseableHttpClient;
    +import org.apache.http.impl.client.HttpClientBuilder;
    +import org.apache.http.ssl.SSLContextBuilder;
    +import org.apache.nifi.toolkit.tls.configuration.TlsClientConfig;
    +import org.apache.nifi.toolkit.tls.util.TlsHelper;
    +import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest;
    +import org.eclipse.jetty.server.Response;
    +
    +import java.io.IOException;
    +import java.nio.charset.StandardCharsets;
    +import java.security.KeyPair;
    +import java.security.NoSuchAlgorithmException;
    +import java.security.cert.X509Certificate;
    +import java.util.ArrayList;
    +import java.util.List;
    +import java.util.function.Supplier;
    +
    +public class TlsCertificateSigningRequestPerformer {
    +    public static final String RECEIVED_RESPONSE_CODE = "Received response 
code ";
    +    public static final String EXPECTED_ONE_CERTIFICATE = "Expected one 
certificate";
    +    public static final String EXPECTED_RESPONSE_TO_CONTAIN_HMAC = 
"Expected response to contain hmac";
    +    public static final String 
UNEXPECTED_HMAC_RECEIVED_POSSIBLE_MAN_IN_THE_MIDDLE = "Unexpected hmac 
received, possible man in the middle";
    +    public static final String EXPECTED_RESPONSE_TO_CONTAIN_CERTIFICATE = 
"Expected response to contain certificate";
    +    private final Supplier<HttpClientBuilder> httpClientBuilderSupplier;
    +    private final String caHostname;
    +    private final String dn;
    +    private final String token;
    +    private final int port;
    +    private final TlsHelper tlsHelper;
    +
    +    public TlsCertificateSigningRequestPerformer(TlsClientConfig 
tlsClientConfig) throws NoSuchAlgorithmException {
    +        this(HttpClientBuilder::create, tlsClientConfig.getCaHostname(), 
tlsClientConfig.getDn(), tlsClientConfig.getToken(), tlsClientConfig.getPort(), 
tlsClientConfig.createTlsHelper());
    +    }
    +
    +    public 
TlsCertificateSigningRequestPerformer(Supplier<HttpClientBuilder> 
httpClientBuilderSupplier, TlsClientConfig tlsClientConfig) throws 
NoSuchAlgorithmException {
    --- End diff --
    
    I don't see any external invocations of the two constructors that pass the 
`Supplier<HttpClientBuilder>` argument. I'm all for dependency injection, but 
is this something that needs to be provided externally?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to