diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2012-08-01 10:26:51 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2012-08-01 10:26:51 +0200 |
| commit | c9b9cea6d6c59107ab3a6a67a81e8e3862b41fce (patch) | |
| tree | ba6a22c222ae337a03be5bc324c6880a00c0856e | |
| parent | fea9f5836c4a13e2024c2f678061268ab7421b8d (diff) | |
LDAP properties: Integer port and support for generating secure admin
passwords for embedded LDAP servers.
| -rw-r--r-- | src/main/java/com/c2kernel/lookup/LDAPProperties.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/com/c2kernel/lookup/LDAPProperties.java b/src/main/java/com/c2kernel/lookup/LDAPProperties.java index e884a54..a9ae699 100644 --- a/src/main/java/com/c2kernel/lookup/LDAPProperties.java +++ b/src/main/java/com/c2kernel/lookup/LDAPProperties.java @@ -4,6 +4,9 @@ package com.c2kernel.lookup;
+import java.math.BigInteger;
+import java.security.SecureRandom;
+
import com.c2kernel.process.Gateway;
/**
@@ -15,24 +18,38 @@ public class LDAPProperties public String mGlobalPath = null; //o=cern.ch
public String mRootPath = null; //cn=cristal2
public String mLocalPath = null; //cn=lab27
- public String mPort = null;
+ 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 = Gateway.getProperty( "LDAP.port" );
+ 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;
+ }
+ }
}
|
