Skip to content

Commit

Permalink
Conntest AD certification update
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Feb 28, 2017
1 parent 5062b45 commit f6b783a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Expand Up @@ -99,11 +99,18 @@
import org.testng.AssertJUnit;
import org.testng.annotations.BeforeMethod;

import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;

import java.io.File;
import java.io.IOException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -1322,4 +1329,23 @@ protected String getPasswordHistoryHumanReadable(List<PasswordHistoryEntryType>
})
.collect(Collectors.joining(", "));
}

protected void logTrustManagers() throws NoSuchAlgorithmException, KeyStoreException {
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init((KeyStore)null);
for (TrustManager trustManager : trustManagerFactory.getTrustManagers()) {
if (trustManager instanceof X509TrustManager) {
X509TrustManager x509TrustManager = (X509TrustManager)trustManager;
LOGGER.debug("TrustManager(X509): {}", x509TrustManager);
X509Certificate[] acceptedIssuers = x509TrustManager.getAcceptedIssuers();
if (acceptedIssuers != null) {
for (X509Certificate acceptedIssuer: acceptedIssuers) {
LOGGER.debug(" acceptedIssuer: {}", acceptedIssuer);
}
}
} else {
LOGGER.debug("TrustManager: {}", trustManager);
}
}
}
}
Expand Up @@ -361,6 +361,8 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
ciMatchingRule = matchingRuleRegistry.getMatchingRule(StringIgnoreCaseMatchingRule.NAME, DOMUtil.XSD_STRING);
dnMatchingRule = matchingRuleRegistry.getMatchingRule(DistinguishedNameMatchingRule.NAME, DOMUtil.XSD_STRING);

logTrustManagers();

if (isAssertOpenFiles()) {
lsof = new Lsof(TestUtil.getPid());
}
Expand Down
Binary file modified testing/conntest/src/test/resources/truststore.jks
Binary file not shown.

0 comments on commit f6b783a

Please sign in to comment.