diff --git a/mvn-build/core/pom.xml b/mvn-build/core/pom.xml
index 8bc560f8..a53ea26e 100644
--- a/mvn-build/core/pom.xml
+++ b/mvn-build/core/pom.xml
@@ -32,6 +32,17 @@
+
+ maven-assembly-plugin
+
+
+
+ src/assemble/bin-with-dependencies.xml
+
+
+
+
+
diff --git a/mvn-build/core/src/assemble/bin-with-dependencies.xml b/mvn-build/core/src/assemble/bin-with-dependencies.xml
new file mode 100644
index 00000000..f650b647
--- /dev/null
+++ b/mvn-build/core/src/assemble/bin-with-dependencies.xml
@@ -0,0 +1,23 @@
+
+ bin-with-dependencies
+
+ dir
+
+ false
+
+
+ target
+
+ *.jar
+
+ dist
+
+
+
+
+ lib
+ false
+ provided
+
+
+
diff --git a/mvn-build/core/src/main/java/org/springframework/ldap/authentication/AcegiAuthenticationSource.java b/mvn-build/core/src/main/java/org/springframework/ldap/authentication/AcegiAuthenticationSource.java
deleted file mode 100644
index 2a8fa91e..00000000
--- a/mvn-build/core/src/main/java/org/springframework/ldap/authentication/AcegiAuthenticationSource.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2005-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.ldap.authentication;
-
-import org.acegisecurity.Authentication;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.anonymous.AnonymousAuthenticationToken;
-import org.acegisecurity.userdetails.ldap.LdapUserDetails;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.ldap.core.AuthenticationSource;
-
-/**
- * An AuthenticationSource to retrieve authentication information stored in
- * Acegi's SecurityContextHolder. Use Acegi's LdapAuthenticationProvider have a
- * LdapUserDetails object placed in the authentication.
- *
- * @author Mattias Arthursson
- *
- */
-public class AcegiAuthenticationSource implements AuthenticationSource {
- private static final Log log = LogFactory
- .getLog(AcegiAuthenticationSource.class);
-
- /**
- * Get the principals of the logged in user, in this case the distinguished
- * name.
- *
- * @return the distinguished name of the logged in user.
- */
- public String getPrincipal() {
- Authentication authentication = SecurityContextHolder.getContext()
- .getAuthentication();
- if (authentication != null) {
- Object principal = authentication.getPrincipal();
- if (principal instanceof LdapUserDetails) {
- LdapUserDetails details = (LdapUserDetails) principal;
- return details.getDn();
- } else if (authentication instanceof AnonymousAuthenticationToken) {
- if (log.isDebugEnabled()) {
- log
- .debug("Anonymous Authentication, returning empty String as Principal");
- }
- return "";
- } else {
- throw new IllegalArgumentException(
- "The principal property of the authentication object -"
- + "needs to be a LdapUserDetails.");
- }
- } else {
- log.warn("No Authentication object set in SecurityContext - "
- + "returning empty String as Principal");
- return "";
- }
- }
-
- /*
- * @see org.springframework.ldap.core.AuthenticationSource#getCredentials()
- */
- public String getCredentials() {
- Authentication authentication = SecurityContextHolder.getContext()
- .getAuthentication();
-
- if (authentication != null) {
- return (String) authentication.getCredentials();
- } else {
- log.warn("No Authentication object set in SecurityContext - "
- + "returning empty String as Credentials");
- return "";
- }
- }
-
-}
diff --git a/mvn-build/core/src/main/java/org/springframework/ldap/authentication/DefaultValuesAuthenticationSourceDecorator.java b/mvn-build/core/src/main/java/org/springframework/ldap/authentication/DefaultValuesAuthenticationSourceDecorator.java
index 7f5acc9a..c84cdb04 100644
--- a/mvn-build/core/src/main/java/org/springframework/ldap/authentication/DefaultValuesAuthenticationSourceDecorator.java
+++ b/mvn-build/core/src/main/java/org/springframework/ldap/authentication/DefaultValuesAuthenticationSourceDecorator.java
@@ -23,7 +23,7 @@ import org.springframework.ldap.core.AuthenticationSource;
/**
* Decorator on AuthenticationSource to have default authentication information
* be returned should the target return empty principal and credentials. Useful
- * in combination with {@link AcegiAuthenticationSource} if users are to be
+ * in combination with AcegiAuthenticationSource if users are to be
* allowed to read some information even though they are not logged in.
*
* Note: The defaultUser should be an non-privileged
diff --git a/mvn-build/core/src/test/java/org/springframework/ldap/authentication/AcegiAuthenticationSourceTest.java b/mvn-build/core/src/test/java/org/springframework/ldap/authentication/AcegiAuthenticationSourceTest.java
deleted file mode 100644
index dd9d89d4..00000000
--- a/mvn-build/core/src/test/java/org/springframework/ldap/authentication/AcegiAuthenticationSourceTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright 2005-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.ldap.authentication;
-
-import junit.framework.TestCase;
-
-import org.acegisecurity.Authentication;
-import org.acegisecurity.GrantedAuthority;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.acegisecurity.providers.anonymous.AnonymousAuthenticationToken;
-import org.acegisecurity.userdetails.User;
-import org.acegisecurity.userdetails.ldap.LdapUserDetails;
-import org.easymock.MockControl;
-import org.springframework.ldap.authentication.AcegiAuthenticationSource;
-
-public class AcegiAuthenticationSourceTest extends TestCase {
-
- private MockControl authenticationControl;
-
- private Authentication authenticationMock;
-
- private MockControl ldapUserDetailsControl;
-
- private LdapUserDetails ldapUserDetailsMock;
-
- private AcegiAuthenticationSource tested;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- authenticationControl = MockControl.createControl(Authentication.class);
- authenticationMock = (Authentication) authenticationControl.getMock();
-
- ldapUserDetailsControl = MockControl
- .createControl(LdapUserDetails.class);
- ldapUserDetailsMock = (LdapUserDetails) ldapUserDetailsControl
- .getMock();
-
- tested = new AcegiAuthenticationSource();
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
-
- authenticationControl = null;
- authenticationMock = null;
-
- ldapUserDetailsControl = null;
- ldapUserDetailsMock = null;
-
- tested = null;
- }
-
- protected void replay() {
- authenticationControl.replay();
- ldapUserDetailsControl.replay();
- }
-
- protected void verify() {
- authenticationControl.verify();
- ldapUserDetailsControl.verify();
- }
-
- public void testGetPrincipalAndCredentials() {
- authenticationControl.expectAndReturn(
- authenticationMock.getPrincipal(), ldapUserDetailsMock);
- authenticationControl.expectAndReturn(authenticationMock
- .getCredentials(), "secret");
-
- ldapUserDetailsControl.expectAndDefaultReturn(ldapUserDetailsMock
- .getDn(), "cn=Manager");
-
- SecurityContextHolder.getContext()
- .setAuthentication(authenticationMock);
-
- replay();
-
- String principal = tested.getPrincipal();
- String credentials = tested.getCredentials();
-
- verify();
-
- assertEquals("secret", credentials);
- assertEquals("cn=Manager", principal);
- }
-
- public void testGetPrincipalAndCredentials_nullAuthentication() {
- SecurityContextHolder.getContext().setAuthentication(null);
-
- replay();
-
- assertEquals("", tested.getPrincipal());
- assertEquals("", tested.getCredentials());
- verify();
- }
-
- public void testGetPrincipal_InvalidPrincipal() {
- authenticationControl.expectAndReturn(
- authenticationMock.getPrincipal(), new User("dummy", "dummy",
- true, true, true, true, new GrantedAuthority[0]));
-
- SecurityContextHolder.getContext()
- .setAuthentication(authenticationMock);
-
- replay();
-
- try {
- tested.getPrincipal();
- fail("IllegalArgumentException expected");
- } catch (IllegalArgumentException expected) {
- assertTrue(true);
- }
- verify();
- }
-
- public void testGetPrincipalWithAnonymousAuthenticationToken() {
-
- SecurityContextHolder.getContext().setAuthentication(
- new AnonymousAuthenticationToken("dummy", "dummy",
- new GrantedAuthority[] { new DummyAuthoroty() }));
-
- assertEquals("", tested.getPrincipal());
- }
-
- private static class DummyAuthoroty implements GrantedAuthority {
- public String getAuthority() {
- return null;
- }
- }
-}
diff --git a/mvn-build/integration-tests/acegi-support-integration-tests/pom.xml b/mvn-build/integration-tests/acegi-support-integration-tests/pom.xml
new file mode 100644
index 00000000..866bbef1
--- /dev/null
+++ b/mvn-build/integration-tests/acegi-support-integration-tests/pom.xml
@@ -0,0 +1,131 @@
+
+
+ 4.0.0
+ org.springframework.ldap
+ spring-ldap-acegi-support-integration-tests
+ Spring LDAP Acegi Support Integration Tests
+ 1.2.2-SNAPSHOT
+
+
+ 2.0.8
+
+
+
+
+
+ maven-eclipse-plugin
+
+ true
+
+
+
+
+ maven-compiler-plugin
+
+ 1.4
+ 1.4
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ default
+ test
+
+
+
+ integration-test
+ integration-test
+
+ test
+
+
+ false
+ once
+
+
+
+
+
+
+
+
+
+ org.springframework.ldap
+ spring-ldap-test
+ 1.2.2-SNAPSHOT
+
+
+ org.springframework.ldap
+ spring-ldap-acegi-support
+ 1.2.2-SNAPSHOT
+
+
+ commons-pool
+ commons-pool
+ 1.3
+ provided
+
+
+ com.sun
+ ldapbp
+ 1.0
+ system
+ ${basedir}/../../lib/ldapbp.jar
+
+
+
+ org.springframework
+ spring-dao
+ ${spring.version}
+ provided
+
+
+ org.springframework
+ spring-jdbc
+ ${spring.version}
+ provided
+
+
+ org.springframework
+ spring-aop
+ ${spring.version}
+ test
+
+
+ org.acegisecurity
+ acegi-security
+ 1.0.7
+ test
+
+
+ aspectj
+ aspectjrt
+ 1.5.3
+ test
+
+
+ aspectj
+ aspectjweaver
+ 1.5.3
+ test
+
+
+ gsbase
+ gsbase
+ 2.0.1
+ test
+
+
+ hsqldb
+ hsqldb
+ 1.8.0.7
+ test
+
+
+
diff --git a/mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/authentication/AcegiAuthenticationSourceITest.java b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/java/org/springframework/ldap/authentication/AcegiAuthenticationSourceITest.java
similarity index 100%
rename from mvn-build/integration-tests/core-integration-tests/src/test/java/org/springframework/ldap/authentication/AcegiAuthenticationSourceITest.java
rename to mvn-build/integration-tests/acegi-support-integration-tests/src/test/java/org/springframework/ldap/authentication/AcegiAuthenticationSourceITest.java
diff --git a/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/commonTestContext.xml b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/commonTestContext.xml
new file mode 100644
index 00000000..a71c074e
--- /dev/null
+++ b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/commonTestContext.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
diff --git a/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/ldap.properties b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/ldap.properties
new file mode 100644
index 00000000..0d201e31
--- /dev/null
+++ b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/ldap.properties
@@ -0,0 +1,4 @@
+urls=ldap://127.0.0.1:3905
+userDn=uid=admin,ou=system
+password=secret
+base=dc=jayway,dc=se
diff --git a/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/ldapTemplateAcegiTestContext.xml b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/ldapTemplateAcegiTestContext.xml
new file mode 100644
index 00000000..9d73a7c1
--- /dev/null
+++ b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/conf/ldapTemplateAcegiTestContext.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/log4j.properties b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/log4j.properties
new file mode 100644
index 00000000..f57302e8
--- /dev/null
+++ b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/log4j.properties
@@ -0,0 +1,9 @@
+log4j.rootCategory=WARN, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
+
+#Enable debug logging
+log4j.category.net.sf.ldaptemplate=INFO
+log4j.category.net.sf.ldaptemplate.LdapTemplate=DEBUG
diff --git a/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/setup_data.ldif b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/setup_data.ldif
new file mode 100644
index 00000000..885a8ca4
--- /dev/null
+++ b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/setup_data.ldif
@@ -0,0 +1,110 @@
+dn: ou=groups,dc=jayway,dc=se
+objectclass: top
+objectclass: organizationalUnit
+ou: groups
+
+dn: cn=ROLE_USER,ou=groups,dc=jayway,dc=se
+objectclass: top
+objectclass: groupOfUniqueNames
+cn: ROLE_USER
+uniqueMember: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
+uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
+uniqueMember: cn=Some Person,ou=company1,c=Norway,dc=jayway,dc=se
+uniqueMember: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
+uniqueMember: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
+
+dn: cn=ROLE_ADMIN,ou=groups,dc=jayway,dc=se
+objectclass: top
+objectclass: groupOfUniqueNames
+cn: ROLE_ADMIN
+uniqueMember: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
+
+dn: c=Sweden,dc=jayway,dc=se
+objectclass: top
+objectclass: country
+c: Sweden
+description: The country of Sweden
+
+dn: c=Norway,dc=jayway,dc=se
+objectclass: top
+objectclass: country
+c: Norway
+description: The country of Norway
+
+dn: ou=company1,c=Sweden,dc=jayway,dc=se
+objectclass: top
+objectclass: organizationalUnit
+ou: company1
+description: First company in Sweden
+
+dn: ou=company2,c=Sweden,dc=jayway,dc=se
+objectclass: top
+objectclass: organizationalUnit
+ou: company2
+description: Second company in Sweden
+
+dn: ou=company1,c=Norway,dc=jayway,dc=se
+objectclass: top
+objectclass: organizationalUnit
+ou: company1
+description: First company in Norway
+
+dn: cn=Some Person,ou=company1,c=Sweden,dc=jayway,dc=se
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+uid: some.person
+userPassword: password
+cn: Some Person
+sn: Person
+description: Sweden, Company1, Some Person
+telephoneNumber: +46 555-123456
+
+dn: cn=Some Person2,ou=company1,c=Sweden,dc=jayway,dc=se
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+uid: some.person2
+userPassword: password
+cn: Some Person2
+sn: Person2
+description: Sweden, Company1, Some Person2
+telephoneNumber: +46 555-654321
+
+dn: cn=Some Person3,ou=company1,c=Sweden,dc=jayway,dc=se
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+uid: some.person3
+userPassword: password
+cn: Some Person3
+sn: Person3
+description: Sweden, Company1, Some Person3
+telephoneNumber: +46 555-123654
+
+dn: cn=Some Person,ou=company2,c=Sweden,dc=jayway,dc=se
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+uid: some.person4
+userPassword: password
+cn: Some Person
+sn: Person
+description: Sweden, Company2, Some Person
+telephoneNumber: +46 555-456321
+
+dn: cn=Some Person+sn=Person,ou=company1,c=Norway,dc=jayway,dc=se
+objectclass: top
+objectclass: person
+objectclass: organizationalPerson
+objectclass: inetOrgPerson
+uid: some.norwegian
+userPassword: password
+cn: Some Person
+sn: Person
+description: Norway, Company1, Some Person+Person
+telephoneNumber: +45 555-654123
diff --git a/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/teardown_data.ldif b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/teardown_data.ldif
new file mode 100644
index 00000000..f6ada1b2
--- /dev/null
+++ b/mvn-build/integration-tests/acegi-support-integration-tests/src/test/resources/teardown_data.ldif
@@ -0,0 +1,5 @@
+ou=groups,dc=jayway,dc=se
+
+c=Sweden,dc=jayway,dc=se
+
+c=Norway,dc=jayway,dc=se
diff --git a/mvn-build/integration-tests/core-integration-tests/pom.xml b/mvn-build/integration-tests/core-integration-tests/pom.xml
index c972debf..d78b474c 100644
--- a/mvn-build/integration-tests/core-integration-tests/pom.xml
+++ b/mvn-build/integration-tests/core-integration-tests/pom.xml
@@ -26,9 +26,33 @@
1.4
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ default
+ test
+
+
+
+ integration-test
+ integration-test
+
+ test
+
+
+ false
+ once
+
+
+
+
-
org.springframework.ldap
@@ -48,12 +72,6 @@
system${basedir}/../../lib/ldapbp.jar
-
- org.acegisecurity
- acegi-security
- 1.0.3
- provided
- org.springframework
diff --git a/mvn-build/integration-tests/pom.xml b/mvn-build/integration-tests/pom.xml
index a3149a37..41e19536 100644
--- a/mvn-build/integration-tests/pom.xml
+++ b/mvn-build/integration-tests/pom.xml
@@ -14,5 +14,36 @@
core-integration-teststiger-integration-tests
+ acegi-support-integration-tests
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ default
+ test
+
+
+
+ integration-test
+ integration-test
+
+ test
+
+
+ false
+ once
+
+
+
+
+
+
diff --git a/mvn-build/integration-tests/tiger-integration-tests/pom.xml b/mvn-build/integration-tests/tiger-integration-tests/pom.xml
index eb9fb41c..0dd7f59f 100644
--- a/mvn-build/integration-tests/tiger-integration-tests/pom.xml
+++ b/mvn-build/integration-tests/tiger-integration-tests/pom.xml
@@ -26,6 +26,31 @@
1.5
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
+
+ default
+ test
+
+
+
+ integration-test
+ integration-test
+
+ test
+
+
+ false
+ once
+
+
+
+
diff --git a/mvn-build/pom.xml b/mvn-build/pom.xml
index 17fe1c8b..43307945 100644
--- a/mvn-build/pom.xml
+++ b/mvn-build/pom.xml
@@ -14,6 +14,7 @@
coretiger
+ acegi-supporttest-supportintegration-tests
@@ -32,25 +33,16 @@
-->
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.4
-
- true
- Spring LDAP Integration
-
- http://java.sun.com/j2se/1.5.0/docs/api
-
-
- http://static.springframework.org/spring/docs/2.5.x/api/
-
-
- http://commons.apache.org/pool/apidocs/
-
-
-
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.4.2
+
+ once
+
+
+
com.agilejava.docbkxdocbkx-maven-plugin
@@ -104,5 +96,27 @@
-
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 2.4
+
+ true
+ Spring LDAP Integration
+
+ http://java.sun.com/j2se/1.5.0/docs/api
+
+
+ http://static.springframework.org/spring/docs/2.5.x/api/
+
+
+ http://commons.apache.org/pool/apidocs/
+
+
+
+
+
diff --git a/mvn-build/test-support/src/main/java/org/springframework/ldap/test/LdapTestUtils.java b/mvn-build/test-support/src/main/java/org/springframework/ldap/test/LdapTestUtils.java
index 63dedfcb..a26868a5 100644
--- a/mvn-build/test-support/src/main/java/org/springframework/ldap/test/LdapTestUtils.java
+++ b/mvn-build/test-support/src/main/java/org/springframework/ldap/test/LdapTestUtils.java
@@ -134,7 +134,12 @@ public class LdapTestUtils {
clearSubContexts(ctx, name);
}
finally {
- ctx.close();
+ try {
+ ctx.close();
+ }
+ catch (Exception e) {
+ // Never mind this
+ }
}
}