use of org.nhindirect.stagent.cert.X509CertificateEx in project nhin-d by DirectProject.
the class CacheableKeyStoreManagerCertificateStore_containsTest method testContains_existingCert_assertFound.
public void testContains_existingCert_assertFound() throws Exception {
if (store != null) {
// add a certificate
final X509CertificateEx user1 = (X509CertificateEx) TestUtils.getInternalCert("user1");
store.add(user1);
assertTrue(store.contains(user1));
}
}
use of org.nhindirect.stagent.cert.X509CertificateEx in project nhin-d by DirectProject.
the class CacheableKeyStoreManagerCertificateStore_getAllCertificateTest method testGetGetAllCertificates_singleCertificatesInstalled_assertCertificateRetrieved.
public void testGetGetAllCertificates_singleCertificatesInstalled_assertCertificateRetrieved() throws Exception {
if (store != null) {
// add a certificate
final X509CertificateEx user1 = (X509CertificateEx) TestUtils.getInternalCert("user1");
store.add(user1);
final Collection<X509Certificate> retrievedCerts = store.getAllCertificates();
assertEquals(1, retrievedCerts.size());
final X509Certificate retrievedCert = retrievedCerts.iterator().next();
assertTrue(retrievedCert instanceof X509CertificateEx);
assertEquals(user1, retrievedCert);
}
}
use of org.nhindirect.stagent.cert.X509CertificateEx in project nhin-d by DirectProject.
the class CacheableKeyStoreManagerCertificateStore_getCertificatesTest method testGetCertificate_existingCertsInStore_findByEmailAddress_assertFound.
public void testGetCertificate_existingCertsInStore_findByEmailAddress_assertFound() throws Exception {
if (store != null) {
// add a certificate
final X509CertificateEx user1 = (X509CertificateEx) TestUtils.getInternalCert("user1");
store.add(user1);
final Collection<X509Certificate> retrievedCerts = store.getCertificates(new InternetAddress("user1@cerner.com"));
assertEquals(1, retrievedCerts.size());
final X509Certificate retrievedCert = retrievedCerts.iterator().next();
assertTrue(retrievedCert instanceof X509CertificateEx);
assertEquals(user1, retrievedCert);
}
}
use of org.nhindirect.stagent.cert.X509CertificateEx in project nhin-d by DirectProject.
the class CacheableKeyStoreManagerCertificateStore_getCertificatesTest method testGetCertificate_existingCertsInStore_assertFound.
public void testGetCertificate_existingCertsInStore_assertFound() throws Exception {
if (store != null) {
// add a certificate
final X509CertificateEx user1 = (X509CertificateEx) TestUtils.getInternalCert("user1");
store.add(user1);
final Collection<X509Certificate> retrievedCerts = store.getCertificates("user1@cerner.com");
assertEquals(1, retrievedCerts.size());
final X509Certificate retrievedCert = retrievedCerts.iterator().next();
assertTrue(retrievedCert instanceof X509CertificateEx);
assertEquals(user1, retrievedCert);
}
}
use of org.nhindirect.stagent.cert.X509CertificateEx in project nhin-d by DirectProject.
the class LdapCertificateStoreTest method testLdapSearch_MultipleX509Certificates.
public void testLdapSearch_MultipleX509Certificates() throws Exception {
addCertificatesToLdap(new String[] { "certs/bob.der", "certs/cacert.der" });
int port = configuration.getLdapPort();
String url = "ldap://localhost:" + port + "/" + "cn=lookupTest";
LdapStoreConfiguration ldapStoreConfiguration = new LdapStoreConfiguration(new String[] { url }, "", "email", "privKeyStore", "X509");
LdapCertificateStoreProvider provider = new LdapCertificateStoreProvider(ldapStoreConfiguration, null, null);
LDAPCertificateStore certificateResolver = (LDAPCertificateStore) provider.get();
certificateResolver.flush(true);
Collection<X509Certificate> certs = certificateResolver.getCertificates("gm2552@cerner.com");
assertEquals(2, certs.size());
Iterator<X509Certificate> iterator = certs.iterator();
X509Certificate cert = iterator.next();
assertFalse(cert instanceof X509CertificateEx);
assertTrue(cert.getSubjectX500Principal().toString().contains("bob@nhind.hsgincubator.com"));
cert = iterator.next();
assertFalse(cert instanceof X509CertificateEx);
assertTrue(cert.getSubjectX500Principal().toString().contains("gmeyer@cerner.com"));
}
Aggregations