2 * ===============================LICENSE_START======================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============================LICENSE_END===========================================
21 package org.openecomp.dcae.apod.analytics.aai.utils.ssl;
23 import org.apache.http.ssl.TrustStrategy;
25 import java.security.cert.CertificateException;
26 import java.security.cert.X509Certificate;
29 * An implementation of SSL Trust Strategy which does no SSL certificate validation effectively
30 * bypassing any SSL certificate related issues
32 * @author Rajiv Singla . Creation Date: 9/19/2017.
34 public class AlwaysTrustingTrustStrategy implements TrustStrategy {
36 * Determines whether the certificate chain can be trusted without consulting the trust manager
37 * configured in the actual SSL context. This method can be used to override the standard JSSE
38 * certificate verification process.
40 * Please note that, if this method returns {@code false}, the trust manager configured
41 * in the actual SSL context can still clear the certificate as trusted.
43 * @param chain the peer certificate chain
44 * @param authType the authentication type based on the client certificate
46 * @return {@code true} if the certificate can be trusted without verification by
47 * the trust manager, {@code false} otherwise.
49 * @throws CertificateException thrown if the certificate is not trusted or invalid.
52 public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {