From 6e35118970c7af70eb0ac938859d794f7348d367 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Fri, 22 Feb 2013 14:04:33 +0100 Subject: Extracted LDAP specifics into subpackage --- .../com/c2kernel/lookup/ldap/LDAPProperties.java | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/main/java/com/c2kernel/lookup/ldap/LDAPProperties.java (limited to 'src/main/java/com/c2kernel/lookup/ldap/LDAPProperties.java') diff --git a/src/main/java/com/c2kernel/lookup/ldap/LDAPProperties.java b/src/main/java/com/c2kernel/lookup/ldap/LDAPProperties.java new file mode 100644 index 0000000..3f48935 --- /dev/null +++ b/src/main/java/com/c2kernel/lookup/ldap/LDAPProperties.java @@ -0,0 +1,55 @@ +/* + * Directory Lookup Service +*/ + +package com.c2kernel.lookup.ldap; + +import java.math.BigInteger; +import java.security.SecureRandom; + +import com.c2kernel.process.Gateway; + +/** + * @version $Revision: 1.16 $ $Date: 2005/10/12 12:51:54 $ + * @author $Author: abranson $ + */ +public class LDAPProperties +{ + public String mGlobalPath = null; //o=cern.ch + public String mRootPath = null; //cn=cristal2 + public String mLocalPath = null; //cn=lab27 + public Integer mPort = null; + public String mHost = null; + public String mUser = null; + public String mPassword = null; + public static String mGeneratedPassword = null; + public String mDbPath = null; + + public LDAPProperties() + { + mGlobalPath = Gateway.getProperty( "LDAP.GlobalPath" ); + mRootPath = Gateway.getProperty( "LDAP.RootPath" ); + mLocalPath = Gateway.getProperty( "LDAP.LocalPath" ); + mPort = Integer.valueOf(Gateway.getProperty( "LDAP.port", "389" )); + mHost = Gateway.getProperty( "LDAP.host" ); + mUser = Gateway.getProperty( "LDAP.user" ); + mPassword = Gateway.getProperty( "LDAP.password" ); + mDbPath = Gateway.getProperty( "LDAP.dbPath" ); + + mRootPath += "," + mGlobalPath; + mLocalPath += "," + mRootPath; + + } + + + public void generateRootPassword() { + if (mPassword == null) { + if (mGeneratedPassword == null) { + SecureRandom random = new SecureRandom(); + mGeneratedPassword = new BigInteger(130, random).toString(32); + } + mPassword = mGeneratedPassword; + } + } +} + -- cgit v1.2.3