View Javadoc
1   /*
2    * Copyright 2019-2021 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package nl.altindag.ssl.model;
18  
19  import javax.net.ssl.X509ExtendedTrustManager;
20  import java.util.List;
21  
22  /**
23   * <p>
24   * <strong>NOTE:</strong>
25   * Please don't use this class directly as it is part of the internal API. Class name and methods can be changed any time.
26   * </p>
27   *
28   * @author Hakan Altindag
29   */
30  public final class TrustMaterial {
31  
32      private X509ExtendedTrustManager trustManager;
33      private List<KeyStoreHolder> trustStores;
34  
35      private TrustMaterial() {}
36  
37      public X509ExtendedTrustManager getTrustManager() {
38          return trustManager;
39      }
40  
41      public List<KeyStoreHolder> getTrustStores() {
42          return trustStores;
43      }
44  
45      public static class Builder {
46  
47          private X509ExtendedTrustManager trustManager;
48          private List<KeyStoreHolder> trustStores;
49  
50          public Builder withTrustManager(X509ExtendedTrustManager trustManager) {
51              this.trustManager = trustManager;
52              return this;
53          }
54  
55          public Builder withTrustStores(List<KeyStoreHolder> trustStores) {
56              this.trustStores = trustStores;
57              return this;
58          }
59  
60          public TrustMaterial build() {
61              TrustMaterial trustMaterial = new TrustMaterial();
62              trustMaterial.trustManager = trustManager;
63              trustMaterial.trustStores = trustStores;
64              return trustMaterial;
65          }
66      }
67  
68  }