Search in sources :

Example 1 with ApacheDSContainer

use of org.springframework.security.ldap.server.ApacheDSContainer in project jBPM5-Developer-Guide by Salaboy.

the class ApacheDSServerStart method main.

public static void main(String[] args) throws Exception {
    logger.info(" >>> Starting Apache DS LDAP Server ... ");
    container = new ApacheDSContainer("o=mojo", "classpath:test.ldif");
    container.setPort(9898);
    container.afterPropertiesSet();
    logger.info(" >>> Apache DS LDAP Server Started !");
}
Also used : ApacheDSContainer(org.springframework.security.ldap.server.ApacheDSContainer)

Example 2 with ApacheDSContainer

use of org.springframework.security.ldap.server.ApacheDSContainer in project spring-security by spring-projects.

the class ApacheDSServerIntegrationTests method startServer.

@BeforeClass
public static void startServer() throws Exception {
    // OpenLDAP configuration
    // contextSource = new
    // DefaultSpringSecurityContextSource("ldap://127.0.0.1:22389/dc=springsource,dc=com");
    // contextSource.setUserDn("cn=admin,dc=springsource,dc=com");
    // contextSource.setPassword("password");
    server = new ApacheDSContainer("dc=springframework,dc=org", "classpath:test-server.ldif");
    int port = getAvailablePort();
    server.setPort(port);
    server.afterPropertiesSet();
    serverPort = port;
}
Also used : ApacheDSContainer(org.springframework.security.ldap.server.ApacheDSContainer) BeforeClass(org.junit.BeforeClass)

Example 3 with ApacheDSContainer

use of org.springframework.security.ldap.server.ApacheDSContainer in project jBPM5-Developer-Guide by Salaboy.

the class ProcessAndHumanTasksTest method setUp.

@Before
public void setUp() throws Exception {
    container = new ApacheDSContainer("o=mojo", "classpath:identity-repository.ldif");
    container.setPort(9898);
    container.afterPropertiesSet();
    LdapContextSource cs = new LdapContextSource();
    cs.setUrl("ldap://localhost:9898/");
    cs.setBase("o=mojo");
    cs.setUserDn("uid=admin,ou=system");
    cs.setPassword("secret");
    cs.afterPropertiesSet();
    LdapTemplate ldapTemplate = new LdapTemplate(cs);
    ldapTemplate.afterPropertiesSet();
    ldapQuery = new LdapQueryHelper(ldapTemplate);
    // By Setting the jbpm.usergroup.callback property with the call
    // back class full name, task service will use this to validate the
    // user/group exists and its permissions are ok.
    System.setProperty("jbpm.usergroup.callback", "org.jbpm.task.identity.LDAPUserGroupCallbackImpl");
//        LdapUserGroupCallback callback = (LdapUserGroupCallback) UserGroupCallbackManager.getInstance().getCallback();
//        callback.setQuery(ldapQuery);
}
Also used : LdapContextSource(org.springframework.ldap.core.support.LdapContextSource) ApacheDSContainer(org.springframework.security.ldap.server.ApacheDSContainer) LdapTemplate(org.springframework.ldap.core.LdapTemplate) Before(org.junit.Before)

Example 4 with ApacheDSContainer

use of org.springframework.security.ldap.server.ApacheDSContainer in project spring-security by spring-projects.

the class LdapServerBeanDefinitionParserTests method defaultLdifFileIsSuccessful.

@Test
public void defaultLdifFileIsSuccessful() {
    appCtx = new InMemoryXmlApplicationContext("<ldap-server/>");
    ApacheDSContainer dsContainer = appCtx.getBean(ApacheDSContainer.class);
    assertThat(ReflectionTestUtils.getField(dsContainer, "ldifResources")).isEqualTo("classpath*:*.ldif");
}
Also used : ApacheDSContainer(org.springframework.security.ldap.server.ApacheDSContainer) InMemoryXmlApplicationContext(org.springframework.security.config.util.InMemoryXmlApplicationContext) Test(org.junit.Test)

Example 5 with ApacheDSContainer

use of org.springframework.security.ldap.server.ApacheDSContainer in project spring-security by spring-projects.

the class ApacheDSServerIntegrationTests method main.

/**
	 * Main class to allow server to be started from gradle script
	 */
public static void main(String[] args) throws Exception {
    ApacheDSContainer server = new ApacheDSContainer("dc=springframework,dc=org", "classpath:test-server.ldif");
    server.afterPropertiesSet();
}
Also used : ApacheDSContainer(org.springframework.security.ldap.server.ApacheDSContainer)

Aggregations

ApacheDSContainer (org.springframework.security.ldap.server.ApacheDSContainer)5 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1 LdapTemplate (org.springframework.ldap.core.LdapTemplate)1 LdapContextSource (org.springframework.ldap.core.support.LdapContextSource)1 InMemoryXmlApplicationContext (org.springframework.security.config.util.InMemoryXmlApplicationContext)1