| | |
| | | package de.jalin.ldapadmin.ldap; |
| | | |
| | | import de.jalin.ldapadmin.server.LDAPUriParser; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.Properties; |
| | |
| | | private String ldapProviderUrl; |
| | | private String ldapSecurityPrincipal; |
| | | private String ldapSecurityPassword; |
| | | private String ldapDistinguishedName; |
| | | private String ldapHost; |
| | | private String ldapPort; |
| | | private String ldapDataDir; |
| | | private boolean ldapUseTLS; |
| | | private String smtpFromAddress; |
| | | private String smtpHost; |
| | | private String smtpPort; |
| | |
| | | |
| | | private LDAPConfig() { |
| | | 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"; |
| | | ldapSecurityPassword = "secret"; |
| | | ldapDataDir = "ldapdata"; |
| | | smtpHost = "localhost"; |
| | | smtpPort = "25"; |
| | | smtpFromAddress = "nobody@example.com"; |
| | |
| | | ldapProviderUrl = props.getProperty("provider.url", ldapProviderUrl); |
| | | ldapSecurityPrincipal = props.getProperty("security.principal", ldapSecurityPrincipal); |
| | | ldapSecurityPassword = props.getProperty("security.password", ldapSecurityPassword); |
| | | ldapDataDir = props.getProperty("data.path", ldapDataDir); |
| | | smtpHost = props.getProperty("smtp.host", smtpHost); |
| | | smtpPort = props.getProperty("smtp.port", smtpPort); |
| | | smtpFromAddress = props.getProperty("smtp.from", smtpFromAddress); |
| | |
| | | pacAdmin = props.getProperty("pac.user", "xyz00"); |
| | | pacPassword = props.getProperty("pac.password", "secret"); |
| | | 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) { |
| | | Logger.getLogger(LDAPConfig.class.getName()).log(Level.SEVERE, null, ex); |
| | | } |
| | |
| | | |
| | | public String getLdapSecurityPassword() { |
| | | 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() { |