Loading projects/cadcAccessControl-Server/Dependencies.txt 0 → 100644 +15 −0 Original line number Diff line number Diff line JAR files required for the OpenCADC cadcAccessControl-Server project ==================================================================== Name in build.xml Versioned Name Project URL ----------------- -------------- ----------- jdom.jar jdom-1.1 http://www.jdom.org log4j.jar log4j-1.2.15 http://logging.apache.org xerces.jar xerces-2_9_1 http://xerces.apache.org servlet-api.jar apache-tomcat-5.5.20 http://tomcat.apache.org jdom2jar jdom-2.0.5 http://www.jdom.org cadcRegistryClient.jar http://code.google.com/p/opencadc cadcUtil.jar http://code.google.com/p/opencadc cadcAccessControl.jar http://code.google.com/p/opencadc cadcUWS.jar http://code.google.com/p/opencadc cadcLog.jar http://code.google.com/p/opencadc No newline at end of file projects/cadcAccessControl-Server/config/PluginFactory.properties→projects/cadcAccessControl-Server/PluginFactory.properties +0 −1 Original line number Diff line number Diff line ## commented out values are the defaults, shown as examples ## to customise behaviour, subclass the specified class and ## change the configuration here Loading projects/cadcAccessControl-Server/build.xml +37 −24 Original line number Diff line number Diff line Loading @@ -88,8 +88,9 @@ <property name="project" value="cadcAccessControl-Server" /> <property name="accessControl" value="${lib}/cadcAccessControl.jar" /> <property name="cadcAccessControl" value="${lib}/cadcAccessControl.jar" /> <property name="cadcLog" value="${lib}/cadcLog.jar" /> <property name="cadcRegistry" value="${lib}/cadcRegistryClient.jar" /> <property name="cadcUtil" value="${lib}/cadcUtil.jar" /> <property name="cadcUWS" value="${lib}/cadcUWS.jar" /> Loading @@ -97,9 +98,9 @@ <property name="log4j" value="${ext.lib}/log4j.jar" /> <property name="servlet" value="${ext.lib}/servlet-api.jar" /> <property name="unboundid" value="${ext.lib}/unboundid-ldapsdk-se.jar" /> <property name="xerces" value="${ext.lib}/xerces.jar" /> <property name="jars" value="${accessControl}:${cadcLog}:${cadcUtil}:${cadcUWS}:${jdom2}:${log4j}:${servlet}:${unboundid}" /> <property name="jars" value="${cadcAccessControl}:${cadcLog}:${cadcRegistry}:${cadcUtil}:${cadcUWS}:${jdom2}:${log4j}:${servlet}:${unboundid}:${xerces}" /> <target name="build" depends="compile"> <jar jarfile="${build}/lib/${project}.jar" Loading @@ -110,16 +111,26 @@ </target> <!-- JAR files needed to run the test suite --> <property name="xerces" value="${ext.dev}/xerces.jar" /> <property name="asm" value="${ext.dev}/asm.jar" /> <property name="cglib" value="${ext.dev}/cglib.jar" /> <property name="easymock" value="${ext.dev}/easymock.jar" /> <property name="gson" value="${ext.lib}/gson.jar" /> <property name="easyMock" value="${ext.dev}/easymock.jar" /> <property name="junit" value="${ext.dev}/junit.jar" /> <property name="xmlunit" value="${ext.dev}/xmlunit.jar" /> <property name="xerces" value="${ext.lib}/xerces.jar" /> <property name="cglib" value="${ext.dev}/cglib.jar" /> <property name="objenesis" value="${ext.dev}/objenesis.jar" /> <property name="asm" value="${ext.dev}/asm.jar" /> <property name="testingJars" value="${jars}:${gson}:${easyMock}:${junit}:${xmlunit}:${xerces}:${cglib}:${asm}:${objenesis}" /> <property name="testingJars" value="${build}/class:${jars}:${xerces}:${asm}:${cglib}:${easymock}:${junit}:${objenesis}" /> <target name="resources"> <copy todir="${build}/class"> <fileset dir="config"> <include name="**.properties" /> </fileset> </copy> </target> <target name="test" depends="compile-test"> <target name="test" depends="compile-test,resources"> <echo message="Running test" /> <!-- Run the junit test suite --> Loading @@ -130,8 +141,10 @@ <pathelement path="${build}/test/class"/> <pathelement path="${testingJars}"/> </classpath> <test name="ca.nrc.cadc.ac.UserTest" /> <test name="ca.nrc.cadc.ac.GroupTest" /> <!--<test name="ca.nrc.cadc.ac.server.ldap.LdapDAOTest" />--> <!--<test name="ca.nrc.cadc.ac.server.ldap.LdapDAOTestImpl" />--> <test name="ca.nrc.cadc.ac.server.ldap.LdapGroupDAOTest" /> <!--<test name="ca.nrc.cadc.ac.server.web.GroupActionFactoryTest" />--> <formatter type="plain" usefile="false" /> </junit> </target> Loading projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/GroupPersistence.java +89 −13 Original line number Diff line number Diff line Loading @@ -71,32 +71,108 @@ package ca.nrc.cadc.ac.server; import ca.nrc.cadc.ac.Group; import ca.nrc.cadc.ac.GroupAlreadyExistsException; import ca.nrc.cadc.ac.GroupNotFoundException; import ca.nrc.cadc.ac.Role; import ca.nrc.cadc.ac.User; import ca.nrc.cadc.ac.UserNotFoundException; import ca.nrc.cadc.net.TransientException; import java.security.AccessControlException; import java.security.Principal; import java.util.Collection; import java.util.Map; public abstract interface GroupPersistence<T extends Principal> { public abstract Group getGroup(String paramString) throws GroupNotFoundException, TransientException, AccessControlException; /** * Get the group with the given Group ID. * * @param groupID The Group ID. * * @return A Group instance * * @throws GroupNotFoundException If the group was not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ public abstract Group getGroup(String groupID) throws GroupNotFoundException, TransientException, AccessControlException; public abstract Group addGroup(Group paramGroup) throws GroupAlreadyExistsException, TransientException, AccessControlException, UserNotFoundException; /** * Creates the group. * * @param group The group to create * * @return created group * * @throws GroupAlreadyExistsException If a group with the same ID already * exists. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. * @throws UserNotFoundException If owner or a member not valid user. */ public abstract Group addGroup(Group group) throws GroupAlreadyExistsException, TransientException, AccessControlException, UserNotFoundException; public abstract void deleteGroup(String paramString) throws GroupNotFoundException, TransientException, AccessControlException; /** * Deletes the group. * * @param groupID The Group ID. * * @throws GroupNotFoundException If the group was not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ public abstract void deleteGroup(String groupID) throws GroupNotFoundException, TransientException, AccessControlException; public abstract Group modifyGroup(Group paramGroup) throws GroupNotFoundException, TransientException, AccessControlException, UserNotFoundException; /** * Modify the given group. * * @param group The group to update. * * @return The newly updated group. * * @throws GroupNotFoundException If the group was not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. * @throws UserNotFoundException If owner or group members not valid users. */ public abstract Group modifyGroup(Group group) throws GroupNotFoundException, TransientException, AccessControlException, UserNotFoundException; public abstract Collection<Group> getGroups(Map<String, String> paramMap) throws TransientException, AccessControlException; /** * Obtain a Collection of Groups that fit the given query. * * @param user<T> ID of user * @param role Role of the user, either owner, member, or read/write. * * @return Collection of Groups matching the query, or empty Collection. * Never null. * * @throws UserNotFoundException If owner or group members not valid users. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ public abstract Collection<Group> getGroups(User<T> user, Role role) throws UserNotFoundException, TransientException, AccessControlException; public abstract boolean isMember(User<T> paramUser, String paramString) throws TransientException, AccessControlException; /** * Check whether the user is a member of the group. * * @param user<T> ID of user * @param groupID ID of group * * @return true or false * * @throws GroupNotFoundException If the group was not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ public abstract boolean isMember(User<T> user, String groupID) throws GroupNotFoundException, TransientException, AccessControlException; } projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/PluginFactory.java +9 −9 Original line number Diff line number Diff line Loading @@ -91,19 +91,19 @@ public class PluginFactory @Override public String toString() { return getClass().getName() + "[" + this.config.entrySet().size() + "]"; return getClass().getName() + "[" + config.entrySet().size() + "]"; } private void init() { this.config = new Properties(); config = new Properties(); URL url = null; try { url = PluginFactory.class.getClassLoader().getResource(CONFIG); if (url != null) { this.config.load(url.openStream()); config.load(url.openStream()); } } catch (Exception ex) Loading @@ -114,12 +114,12 @@ public class PluginFactory public <T extends Principal> GroupPersistence<T> getGroupPersistence() { GroupPersistence ret = null; GroupPersistence<T> ret = null; String name = GroupPersistence.class.getName(); String cname = this.config.getProperty(name); String cname = config.getProperty(name); if (cname == null) { ret = new LdapGroupPersistence(); ret = new LdapGroupPersistence<T>(); } else { Loading @@ -138,12 +138,12 @@ public class PluginFactory public <T extends Principal> UserPersistence<T> getUserPersistence() { UserPersistence ret = null; UserPersistence<T> ret = null; String name = UserPersistence.class.getName(); String cname = this.config.getProperty(name); String cname = config.getProperty(name); if (cname == null) { ret = new LdapUserPersistence(); ret = new LdapUserPersistence<T>(); } else { Loading Loading
projects/cadcAccessControl-Server/Dependencies.txt 0 → 100644 +15 −0 Original line number Diff line number Diff line JAR files required for the OpenCADC cadcAccessControl-Server project ==================================================================== Name in build.xml Versioned Name Project URL ----------------- -------------- ----------- jdom.jar jdom-1.1 http://www.jdom.org log4j.jar log4j-1.2.15 http://logging.apache.org xerces.jar xerces-2_9_1 http://xerces.apache.org servlet-api.jar apache-tomcat-5.5.20 http://tomcat.apache.org jdom2jar jdom-2.0.5 http://www.jdom.org cadcRegistryClient.jar http://code.google.com/p/opencadc cadcUtil.jar http://code.google.com/p/opencadc cadcAccessControl.jar http://code.google.com/p/opencadc cadcUWS.jar http://code.google.com/p/opencadc cadcLog.jar http://code.google.com/p/opencadc No newline at end of file
projects/cadcAccessControl-Server/config/PluginFactory.properties→projects/cadcAccessControl-Server/PluginFactory.properties +0 −1 Original line number Diff line number Diff line ## commented out values are the defaults, shown as examples ## to customise behaviour, subclass the specified class and ## change the configuration here Loading
projects/cadcAccessControl-Server/build.xml +37 −24 Original line number Diff line number Diff line Loading @@ -88,8 +88,9 @@ <property name="project" value="cadcAccessControl-Server" /> <property name="accessControl" value="${lib}/cadcAccessControl.jar" /> <property name="cadcAccessControl" value="${lib}/cadcAccessControl.jar" /> <property name="cadcLog" value="${lib}/cadcLog.jar" /> <property name="cadcRegistry" value="${lib}/cadcRegistryClient.jar" /> <property name="cadcUtil" value="${lib}/cadcUtil.jar" /> <property name="cadcUWS" value="${lib}/cadcUWS.jar" /> Loading @@ -97,9 +98,9 @@ <property name="log4j" value="${ext.lib}/log4j.jar" /> <property name="servlet" value="${ext.lib}/servlet-api.jar" /> <property name="unboundid" value="${ext.lib}/unboundid-ldapsdk-se.jar" /> <property name="xerces" value="${ext.lib}/xerces.jar" /> <property name="jars" value="${accessControl}:${cadcLog}:${cadcUtil}:${cadcUWS}:${jdom2}:${log4j}:${servlet}:${unboundid}" /> <property name="jars" value="${cadcAccessControl}:${cadcLog}:${cadcRegistry}:${cadcUtil}:${cadcUWS}:${jdom2}:${log4j}:${servlet}:${unboundid}:${xerces}" /> <target name="build" depends="compile"> <jar jarfile="${build}/lib/${project}.jar" Loading @@ -110,16 +111,26 @@ </target> <!-- JAR files needed to run the test suite --> <property name="xerces" value="${ext.dev}/xerces.jar" /> <property name="asm" value="${ext.dev}/asm.jar" /> <property name="cglib" value="${ext.dev}/cglib.jar" /> <property name="easymock" value="${ext.dev}/easymock.jar" /> <property name="gson" value="${ext.lib}/gson.jar" /> <property name="easyMock" value="${ext.dev}/easymock.jar" /> <property name="junit" value="${ext.dev}/junit.jar" /> <property name="xmlunit" value="${ext.dev}/xmlunit.jar" /> <property name="xerces" value="${ext.lib}/xerces.jar" /> <property name="cglib" value="${ext.dev}/cglib.jar" /> <property name="objenesis" value="${ext.dev}/objenesis.jar" /> <property name="asm" value="${ext.dev}/asm.jar" /> <property name="testingJars" value="${jars}:${gson}:${easyMock}:${junit}:${xmlunit}:${xerces}:${cglib}:${asm}:${objenesis}" /> <property name="testingJars" value="${build}/class:${jars}:${xerces}:${asm}:${cglib}:${easymock}:${junit}:${objenesis}" /> <target name="resources"> <copy todir="${build}/class"> <fileset dir="config"> <include name="**.properties" /> </fileset> </copy> </target> <target name="test" depends="compile-test"> <target name="test" depends="compile-test,resources"> <echo message="Running test" /> <!-- Run the junit test suite --> Loading @@ -130,8 +141,10 @@ <pathelement path="${build}/test/class"/> <pathelement path="${testingJars}"/> </classpath> <test name="ca.nrc.cadc.ac.UserTest" /> <test name="ca.nrc.cadc.ac.GroupTest" /> <!--<test name="ca.nrc.cadc.ac.server.ldap.LdapDAOTest" />--> <!--<test name="ca.nrc.cadc.ac.server.ldap.LdapDAOTestImpl" />--> <test name="ca.nrc.cadc.ac.server.ldap.LdapGroupDAOTest" /> <!--<test name="ca.nrc.cadc.ac.server.web.GroupActionFactoryTest" />--> <formatter type="plain" usefile="false" /> </junit> </target> Loading
projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/GroupPersistence.java +89 −13 Original line number Diff line number Diff line Loading @@ -71,32 +71,108 @@ package ca.nrc.cadc.ac.server; import ca.nrc.cadc.ac.Group; import ca.nrc.cadc.ac.GroupAlreadyExistsException; import ca.nrc.cadc.ac.GroupNotFoundException; import ca.nrc.cadc.ac.Role; import ca.nrc.cadc.ac.User; import ca.nrc.cadc.ac.UserNotFoundException; import ca.nrc.cadc.net.TransientException; import java.security.AccessControlException; import java.security.Principal; import java.util.Collection; import java.util.Map; public abstract interface GroupPersistence<T extends Principal> { public abstract Group getGroup(String paramString) throws GroupNotFoundException, TransientException, AccessControlException; /** * Get the group with the given Group ID. * * @param groupID The Group ID. * * @return A Group instance * * @throws GroupNotFoundException If the group was not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ public abstract Group getGroup(String groupID) throws GroupNotFoundException, TransientException, AccessControlException; public abstract Group addGroup(Group paramGroup) throws GroupAlreadyExistsException, TransientException, AccessControlException, UserNotFoundException; /** * Creates the group. * * @param group The group to create * * @return created group * * @throws GroupAlreadyExistsException If a group with the same ID already * exists. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. * @throws UserNotFoundException If owner or a member not valid user. */ public abstract Group addGroup(Group group) throws GroupAlreadyExistsException, TransientException, AccessControlException, UserNotFoundException; public abstract void deleteGroup(String paramString) throws GroupNotFoundException, TransientException, AccessControlException; /** * Deletes the group. * * @param groupID The Group ID. * * @throws GroupNotFoundException If the group was not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ public abstract void deleteGroup(String groupID) throws GroupNotFoundException, TransientException, AccessControlException; public abstract Group modifyGroup(Group paramGroup) throws GroupNotFoundException, TransientException, AccessControlException, UserNotFoundException; /** * Modify the given group. * * @param group The group to update. * * @return The newly updated group. * * @throws GroupNotFoundException If the group was not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. * @throws UserNotFoundException If owner or group members not valid users. */ public abstract Group modifyGroup(Group group) throws GroupNotFoundException, TransientException, AccessControlException, UserNotFoundException; public abstract Collection<Group> getGroups(Map<String, String> paramMap) throws TransientException, AccessControlException; /** * Obtain a Collection of Groups that fit the given query. * * @param user<T> ID of user * @param role Role of the user, either owner, member, or read/write. * * @return Collection of Groups matching the query, or empty Collection. * Never null. * * @throws UserNotFoundException If owner or group members not valid users. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ public abstract Collection<Group> getGroups(User<T> user, Role role) throws UserNotFoundException, TransientException, AccessControlException; public abstract boolean isMember(User<T> paramUser, String paramString) throws TransientException, AccessControlException; /** * Check whether the user is a member of the group. * * @param user<T> ID of user * @param groupID ID of group * * @return true or false * * @throws GroupNotFoundException If the group was not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ public abstract boolean isMember(User<T> user, String groupID) throws GroupNotFoundException, TransientException, AccessControlException; }
projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/PluginFactory.java +9 −9 Original line number Diff line number Diff line Loading @@ -91,19 +91,19 @@ public class PluginFactory @Override public String toString() { return getClass().getName() + "[" + this.config.entrySet().size() + "]"; return getClass().getName() + "[" + config.entrySet().size() + "]"; } private void init() { this.config = new Properties(); config = new Properties(); URL url = null; try { url = PluginFactory.class.getClassLoader().getResource(CONFIG); if (url != null) { this.config.load(url.openStream()); config.load(url.openStream()); } } catch (Exception ex) Loading @@ -114,12 +114,12 @@ public class PluginFactory public <T extends Principal> GroupPersistence<T> getGroupPersistence() { GroupPersistence ret = null; GroupPersistence<T> ret = null; String name = GroupPersistence.class.getName(); String cname = this.config.getProperty(name); String cname = config.getProperty(name); if (cname == null) { ret = new LdapGroupPersistence(); ret = new LdapGroupPersistence<T>(); } else { Loading @@ -138,12 +138,12 @@ public class PluginFactory public <T extends Principal> UserPersistence<T> getUserPersistence() { UserPersistence ret = null; UserPersistence<T> ret = null; String name = UserPersistence.class.getName(); String cname = this.config.getProperty(name); String cname = config.getProperty(name); if (cname == null) { ret = new LdapUserPersistence(); ret = new LdapUserPersistence<T>(); } else { Loading