remove embedded apacheds
This commit is contained in:
parent
2bfcfefe04
commit
2ae5df8ef9
@ -1,6 +1,5 @@
|
|||||||
package de.jalin.ldapadmin.ldap;
|
package de.jalin.ldapadmin.ldap;
|
||||||
|
|
||||||
import de.jalin.ldapadmin.server.LDAPUriParser;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -14,11 +13,6 @@ public class LDAPConfig {
|
|||||||
private String ldapProviderUrl;
|
private String ldapProviderUrl;
|
||||||
private String ldapSecurityPrincipal;
|
private String ldapSecurityPrincipal;
|
||||||
private String ldapSecurityPassword;
|
private String ldapSecurityPassword;
|
||||||
private String ldapDistinguishedName;
|
|
||||||
private String ldapHost;
|
|
||||||
private String ldapPort;
|
|
||||||
private String ldapDataDir;
|
|
||||||
private boolean ldapUseTLS;
|
|
||||||
private String smtpFromAddress;
|
private String smtpFromAddress;
|
||||||
private String smtpHost;
|
private String smtpHost;
|
||||||
private String smtpPort;
|
private String smtpPort;
|
||||||
@ -29,13 +23,8 @@ public class LDAPConfig {
|
|||||||
|
|
||||||
private LDAPConfig() {
|
private LDAPConfig() {
|
||||||
ldapProviderUrl = "ldap://localhost:10389/dc=domain,dc=example,dc=com";
|
ldapProviderUrl = "ldap://localhost:10389/dc=domain,dc=example,dc=com";
|
||||||
ldapDistinguishedName = "dc=domain,dc=example,dc=com";
|
|
||||||
ldapHost = "localhost";
|
|
||||||
ldapPort = "10389";
|
|
||||||
ldapUseTLS = false;
|
|
||||||
ldapSecurityPrincipal = "uid=admin,ou=system";
|
ldapSecurityPrincipal = "uid=admin,ou=system";
|
||||||
ldapSecurityPassword = "secret";
|
ldapSecurityPassword = "secret";
|
||||||
ldapDataDir = "ldapdata";
|
|
||||||
smtpHost = "localhost";
|
smtpHost = "localhost";
|
||||||
smtpPort = "25";
|
smtpPort = "25";
|
||||||
smtpFromAddress = "nobody@example.com";
|
smtpFromAddress = "nobody@example.com";
|
||||||
@ -46,7 +35,6 @@ public class LDAPConfig {
|
|||||||
ldapProviderUrl = props.getProperty("provider.url", ldapProviderUrl);
|
ldapProviderUrl = props.getProperty("provider.url", ldapProviderUrl);
|
||||||
ldapSecurityPrincipal = props.getProperty("security.principal", ldapSecurityPrincipal);
|
ldapSecurityPrincipal = props.getProperty("security.principal", ldapSecurityPrincipal);
|
||||||
ldapSecurityPassword = props.getProperty("security.password", ldapSecurityPassword);
|
ldapSecurityPassword = props.getProperty("security.password", ldapSecurityPassword);
|
||||||
ldapDataDir = props.getProperty("data.path", ldapDataDir);
|
|
||||||
smtpHost = props.getProperty("smtp.host", smtpHost);
|
smtpHost = props.getProperty("smtp.host", smtpHost);
|
||||||
smtpPort = props.getProperty("smtp.port", smtpPort);
|
smtpPort = props.getProperty("smtp.port", smtpPort);
|
||||||
smtpFromAddress = props.getProperty("smtp.from", smtpFromAddress);
|
smtpFromAddress = props.getProperty("smtp.from", smtpFromAddress);
|
||||||
@ -54,11 +42,6 @@ public class LDAPConfig {
|
|||||||
pacAdmin = props.getProperty("pac.user", "xyz00");
|
pacAdmin = props.getProperty("pac.user", "xyz00");
|
||||||
pacPassword = props.getProperty("pac.password", "secret");
|
pacPassword = props.getProperty("pac.password", "secret");
|
||||||
tempDir = props.getProperty("temp.dir", tempDir);
|
tempDir = props.getProperty("temp.dir", tempDir);
|
||||||
final LDAPUriParser uriParser = new LDAPUriParser(ldapProviderUrl);
|
|
||||||
ldapDistinguishedName = uriParser.getDn();
|
|
||||||
ldapHost = uriParser.getHost();
|
|
||||||
ldapPort = uriParser.getPort();
|
|
||||||
ldapUseTLS = uriParser.isUseTLS();
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
Logger.getLogger(LDAPConfig.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(LDAPConfig.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
@ -83,26 +66,6 @@ public class LDAPConfig {
|
|||||||
return ldapSecurityPassword;
|
return ldapSecurityPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLdapDistinguishedName() {
|
|
||||||
return ldapDistinguishedName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLdapHost() {
|
|
||||||
return ldapHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLdapPort() {
|
|
||||||
return ldapPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLdapDataDir() {
|
|
||||||
return ldapDataDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLdapUseTLS() {
|
|
||||||
return ldapUseTLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSmtpHost() {
|
public String getSmtpHost() {
|
||||||
return smtpHost;
|
return smtpHost;
|
||||||
}
|
}
|
||||||
|
@ -1,37 +0,0 @@
|
|||||||
package de.jalin.ldapadmin.server;
|
|
||||||
|
|
||||||
public class LDAPUriParser {
|
|
||||||
|
|
||||||
private final boolean useTLS;
|
|
||||||
private final String dn;
|
|
||||||
private final String port;
|
|
||||||
private final String host;
|
|
||||||
|
|
||||||
public LDAPUriParser (final String uri) {
|
|
||||||
final String[] uriParts = uri.split("\\/");
|
|
||||||
final String protocol = uriParts[0];
|
|
||||||
final String hostAndPort = uriParts[2];
|
|
||||||
final String[] hostAndPortParts = hostAndPort.split(":");
|
|
||||||
host = hostAndPortParts[0];
|
|
||||||
port = hostAndPortParts[1];
|
|
||||||
dn = uriParts[3];
|
|
||||||
useTLS = protocol.toLowerCase().startsWith("ldaps");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDn() {
|
|
||||||
return dn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPort() {
|
|
||||||
return port;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUseTLS() {
|
|
||||||
return useTLS;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package de.jalin.ldapadmin.server;
|
|
||||||
|
|
||||||
import de.jalin.ldapadmin.ldap.DirectoryServiceRunner;
|
|
||||||
import de.jalin.ldapadmin.ldap.LDAPConfig;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import javax.servlet.ServletContextEvent;
|
|
||||||
import javax.servlet.ServletContextListener;
|
|
||||||
import javax.servlet.annotation.WebListener;
|
|
||||||
|
|
||||||
@WebListener
|
|
||||||
public class WebappDirectoryServer implements ServletContextListener {
|
|
||||||
|
|
||||||
private DirectoryServiceRunner directoryServer;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void contextInitialized(final ServletContextEvent evt) {
|
|
||||||
try {
|
|
||||||
final LDAPConfig cfg = LDAPConfig.getConfig();
|
|
||||||
directoryServer = new DirectoryServiceRunner("main", cfg.getLdapDistinguishedName(), cfg.getLdapHost(), cfg.getLdapPort(), cfg.isLdapUseTLS(), cfg.getLdapDataDir());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Logger.getLogger(WebappDirectoryServer.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void contextDestroyed(final ServletContextEvent evt) {
|
|
||||||
try {
|
|
||||||
directoryServer.shutdown();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Logger.getLogger(WebappDirectoryServer.class.getName()).log(Level.SEVERE, null, ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
package de.jalin.ldapadmin.server;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class TestLDAPUriParser {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testLDAPUriParser() {
|
|
||||||
final LDAPUriParser ldapUriParser = new LDAPUriParser("ldap://localhost:10389/dc=example,dc=com");
|
|
||||||
assertEquals("localhost", ldapUriParser.getHost());
|
|
||||||
assertEquals("10389", ldapUriParser.getPort());
|
|
||||||
assertEquals("dc=example,dc=com", ldapUriParser.getDn());
|
|
||||||
assertEquals(false, ldapUriParser.isUseTLS());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user