48 String storepath = config.get(
"file");
49 String pass = config.get(
"password");
50 String policy = config.get(
"hostname-verification-policy");
51 Boolean disabled = config.getBoolean(
"disabled", null);
54 if (storepath == null && pass == null && policy == null && disabled == null) {
59 if (disabled != null && disabled) {
63 HostnameVerificationPolicy verificationPolicy = null;
64 KeyStore truststore = null;
66 if (storepath == null) {
67 throw new RuntimeException(
"Attribute 'file' missing in 'truststore':'file' configuration");
70 throw new RuntimeException(
"Attribute 'password' missing in 'truststore':'file' configuration");
74 truststore =
loadStore(storepath, pass == null ? null :pass.toCharArray());
75 }
catch (Exception e) {
76 throw new RuntimeException(
"Failed to initialize TruststoreProviderFactory: " +
new File(storepath).getAbsolutePath(), e);
79 verificationPolicy = HostnameVerificationPolicy.WILDCARD;
82 verificationPolicy = HostnameVerificationPolicy.valueOf(policy);
83 }
catch (Exception e) {
84 throw new RuntimeException(
"Invalid value for 'hostname-verification-policy': " + policy +
" (must be one of: ANY, WILDCARD, STRICT)");
88 provider =
new FileTruststoreProvider(truststore, verificationPolicy);
89 TruststoreProviderSingleton.set(
provider);
90 log.debug(
"File trustore provider initialized: " +
new File(storepath).getAbsolutePath());
KeyStore loadStore(String path, char[] password)
Definition: FileTruststoreProviderFactory.java:93
static final Logger log
Definition: FileTruststoreProviderFactory.java:36
TruststoreProvider provider
Definition: FileTruststoreProviderFactory.java:38