use of org.apache.cxf.xkms.x509.repo.CertificateRepo in project cxf by apache.
the class LDAPCertificateRepoTest method testSave.
@Test
@Ignore
public void testSave() throws Exception {
CertificateRepo persistenceManager = createLdapCertificateRepo();
File certFile = new File("src/test/java/cert1.cer");
Assert.assertTrue(certFile.exists());
FileInputStream fis = new FileInputStream(certFile);
CertificateFactory factory = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate) factory.generateCertificate(fis);
fis.close();
UseKeyWithType key = new UseKeyWithType();
key.setApplication(Applications.PKIX.getUri());
key.setIdentifier(EXPECTED_SUBJECT_DN);
persistenceManager.saveCertificate(cert, key);
testFindBySubjectDnInternal(persistenceManager);
}
use of org.apache.cxf.xkms.x509.repo.CertificateRepo in project cxf by apache.
the class LDAPCertificateRepoTest method testFindUserCert.
@Test
@Ignore
public void testFindUserCert() throws URISyntaxException, NamingException, CertificateException {
CertificateRepo persistenceManager = createLdapCertificateRepo();
testFindBySubjectDnInternal(persistenceManager);
}
use of org.apache.cxf.xkms.x509.repo.CertificateRepo in project cxf by apache.
the class X509LocatorTest method locate.
@Test
public void locate() throws CertificateException {
CertificateRepo certRepo = EasyMock.createMock(CertificateRepo.class);
EasyMock.expect(certRepo.findBySubjectDn(EasyMock.eq("alice"))).andReturn(getAliceCert());
EasyMock.replay(certRepo);
X509Locator locator = new X509Locator(certRepo);
LocateRequestType request = prepareLocateXKMSRequest();
UnverifiedKeyBindingType result = locator.locate(request);
Assert.assertNotNull(result.getKeyInfo());
}
use of org.apache.cxf.xkms.x509.repo.CertificateRepo in project cxf by apache.
the class LDAPCertificateRepoTest method testFindUserCertViaUID.
@Test
public void testFindUserCertViaUID() throws URISyntaxException, NamingException, CertificateException {
CertificateRepo persistenceManager = createLdapCertificateRepo();
X509Certificate cert = persistenceManager.findBySubjectDn("dave");
assertNotNull(cert);
}
use of org.apache.cxf.xkms.x509.repo.CertificateRepo in project cxf by apache.
the class LDAPCertificateRepoTest method createLdapCertificateRepo.
private CertificateRepo createLdapCertificateRepo() throws CertificateException {
LdapSearch ldapSearch = new LdapSearch("ldap://localhost:" + super.getLdapServer().getPort(), "UID=admin,DC=example,DC=com", "ldap_su", 2);
LdapSchemaConfig ldapSchemaConfig = new LdapSchemaConfig();
ldapSchemaConfig.setAttrCrtBinary("userCertificate");
return new LdapCertificateRepo(ldapSearch, ldapSchemaConfig, ROOT_DN);
}
Aggregations