Commit c6fc0b9a authored by Patrick Dowler's avatar Patrick Dowler
Browse files

Merge branch 'ac2' of ssh://gimli2/srv/cadc/git/wopencadc into ac2

parents 1db071aa 3ef62d3b
Loading
Loading
Loading
Loading
+22 −5
Original line number Diff line number Diff line
@@ -4,10 +4,27 @@
# is installed in your Java Keystore:
# scp gimli2.cadc.dao.nrc.ca:~miscsw/ca.crt /tmp/ca.crt
# ${JAVA_HOME}/bin/keytool -importcert -keystore ${JAVA_HOME}/jre/lib/security/cacerts -file /tmp/ca.crt
server = proc5-03.cadc.dao.nrc.ca
# Read-only connection pool
readOnly.servers = proc5-03.cadc.dao.nrc.ca
readOnly.poolInitSize = 1
readOnly.poolMaxSize = 1
readOnly.poolPolicy = roundRobin
readOnly.maxWait = 30000
readOnly.createIfNeeded = false

# Read-write connection pool
readWrite.servers = proc5-03.cadc.dao.nrc.ca
readWrite.poolInitSize = 1
readWrite.poolMaxSize = 1
readWrite.poolPolicy = roundRobin
readWrite.maxWait = 30000
readWrite.createIfNeeded = false

# server configuration -- applies to all servers
dbrcHost = devLdap
port = 636
proxyUser = testproxy
usersDn = ou=Users,ou=ds,dc=testcanfar
proxyUser = uid=testproxy,ou=SpecialUsers,dc=testcanfar
usersDN = ou=Users,ou=ds,dc=testcanfar
userRequestsDN = ou=UserRequests,ou=ds,dc=testcanfar
groupsDn = ou=Groups,ou=ds,dc=testcanfar
adminGroupsDn = ou=adminGroups,ou=ds,dc=testcanfar
 No newline at end of file
groupsDN = ou=Groups,ou=ds,dc=testcanfar
adminGroupsDN = ou=adminGroups,ou=ds,dc=testcanfar
 No newline at end of file
+26 −3
Original line number Diff line number Diff line
# This are the configuration fields required by the Ldap
server = <name of server> 
###############################################################
#
# LDAP Connection and Pool Configuration
#
#
###############################################################

# Read-only connection pool
readOnly.servers = <list of ldap servers for readonly access>
readOnly.poolInitSize = <number of initial connections in the readonly pool>
readOnly.poolMaxSize = <maximum number of connections in the readonly pool>
readOnly.poolPolicy = <roundRobin || fewestConnections>
readOnly.maxWait = <timeout wait time in milliseconds>
readOnly.createIfNeeded = <true || false> Go beyond poolMaxSize

# Read-write connection pool
readWrite.servers = <list of ldap servers for readwrite access>
readWrite.poolInitSize = <number of initial connections in the readwrite pool>
readWrite.poolMaxSize = <maximum number of connections in the readwrite pool>
readWrite.poolPolicy = <roundRobin || fewestConnections>
readWrite.maxWait = <timeout wait time in milliseconds>
readWrite.createIfNeeded = <true || false> Go beyond poolMaxSize

# server configuration -- applies to all servers
dbrcHost = <prodLdap || devLdap>
port = <389 or 636>
proxyUser = <name of proxy user>
usersDn = <DN of users branch>
+14 −9
Original line number Diff line number Diff line
@@ -81,6 +81,11 @@ import ca.nrc.cadc.net.TransientException;

public interface GroupPersistence<T extends Principal>
{
    /**
     * Call if this object is to be shut down.
     */
    void destroy();

    /**
     * Get all group names.
     *
+11 −10
Original line number Diff line number Diff line
@@ -70,12 +70,17 @@ package ca.nrc.cadc.ac.server;

import ca.nrc.cadc.ac.server.ldap.LdapGroupPersistence;
import ca.nrc.cadc.ac.server.ldap.LdapUserPersistence;

import java.lang.reflect.Constructor;
import java.net.URL;
import java.security.AccessControlException;
import java.security.Principal;
import java.util.Properties;
import java.util.Set;
import org.apache.log4j.Logger;

import com.unboundid.ldap.sdk.LDAPException;

public class PluginFactory
{
    private static final Logger log = Logger.getLogger(PluginFactory.class);
@@ -113,54 +118,50 @@ public class PluginFactory
    }

    @SuppressWarnings("unchecked")
    public <T extends Principal> GroupPersistence<T> getGroupPersistence()
    public <T extends Principal> GroupPersistence<T> createGroupPersistence()
    {
        GroupPersistence<T> ret = null;
        String name = GroupPersistence.class.getName();
        String cname = config.getProperty(name);
        if (cname == null)
        {
            ret = new LdapGroupPersistence<T>();
            return new LdapGroupPersistence<T>();
        }
        else
        {
            try
            {
                Class<?> c = Class.forName(cname);
                ret = (GroupPersistence<T>) c.newInstance();
                return (GroupPersistence<T>) c.newInstance();
            }
            catch (Exception ex)
            {
                throw new RuntimeException("config error: failed to create GroupPersistence " + cname, ex);
            }
        }
        return ret;
    }

    @SuppressWarnings("unchecked")
    public <T extends Principal> UserPersistence<T> getUserPersistence()
    public <T extends Principal> UserPersistence<T> createUserPersistence()
    {
        UserPersistence ret = null;
        String name = UserPersistence.class.getName();
        String cname = config.getProperty(name);

        if (cname == null)
        {
            ret = new LdapUserPersistence<T>();
            return new LdapUserPersistence<T>();
        }
        else
        {
            try
            {
                Class<?> c = Class.forName(cname);
                ret = (UserPersistence) c.newInstance();
                return (UserPersistence) c.newInstance();
            }
            catch (Exception ex)
            {
                throw new RuntimeException("config error: failed to create UserPersistence " + cname, ex);
            }
        }
        return ret;
    }

}
+6 −0
Original line number Diff line number Diff line
@@ -81,6 +81,12 @@ import java.util.Collection;

public interface UserPersistence<T extends Principal>
{

    /**
     * Call if this object is to be shut down.
     */
    void destroy();

    /**
     * Add the user to the active users tree.
     *
Loading