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.X509ExtendedKeyManager;
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 IdentityMaterial {
31  
32      private X509ExtendedKeyManager keyManager;
33      private List<KeyStoreHolder> identities;
34  
35      private IdentityMaterial() {}
36  
37      public X509ExtendedKeyManager getKeyManager() {
38          return keyManager;
39      }
40  
41      public List<KeyStoreHolder> getIdentities() {
42          return identities;
43      }
44  
45      public static class Builder {
46  
47          private X509ExtendedKeyManager keyManager;
48          private List<KeyStoreHolder> identities;
49  
50          public Builder withKeyManager(X509ExtendedKeyManager keyManager) {
51              this.keyManager = keyManager;
52              return this;
53          }
54  
55          public Builder withIdentities(List<KeyStoreHolder> identities) {
56              this.identities = identities;
57              return this;
58          }
59  
60          public IdentityMaterial build() {
61              IdentityMaterial identityMaterial = new IdentityMaterial();
62              identityMaterial.keyManager = keyManager;
63              identityMaterial.identities = identities;
64              return identityMaterial;
65          }
66      }
67  
68  }