Upgrade Spring version
This commit is contained in:
parent
80f6f6e0cf
commit
bc675c7332
24 changed files with 365 additions and 518 deletions
|
|
@ -22,11 +22,6 @@
|
|||
<groupId>${jdbcDriver.groupId}</groupId>
|
||||
<artifactId>${jdbcDriver.artifactId}</artifactId>
|
||||
</dependency>
|
||||
<!-- Hibernate -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate</artifactId>
|
||||
</dependency>
|
||||
<!-- JUnit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
@ -40,7 +35,7 @@
|
|||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring</artifactId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
|
|
@ -50,16 +45,34 @@
|
|||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring AOP support -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
|
|
@ -70,14 +83,6 @@
|
|||
<artifactId>easymockclassextension</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
|
|
@ -92,6 +97,14 @@
|
|||
<groupId>commons-math</groupId>
|
||||
<artifactId>commons-math</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</dependency>
|
||||
<!-- Joda Time -->
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
|
|
@ -105,14 +118,6 @@
|
|||
<groupId>org.dbunit</groupId>
|
||||
<artifactId>dbunit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ import org.hibernate.validator.Valid;
|
|||
import org.hibernate.validator.Validator;
|
||||
import org.hibernate.validator.ValidatorClass;
|
||||
import org.hibernate.validator.Version;
|
||||
import org.hibernate.validator.interpolator.DefaultMessageInterpolatorAggerator;
|
||||
import org.hibernate.validator.interpolator.DefaultMessageInterpolatorAggregator;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -113,7 +113,7 @@ public class LibrePlanClassValidator<T> implements Serializable {
|
|||
private transient List<Validator> memberValidators;
|
||||
private transient List<XMember> memberGetters;
|
||||
private transient List<XMember> childGetters;
|
||||
private transient DefaultMessageInterpolatorAggerator defaultInterpolator;
|
||||
private transient DefaultMessageInterpolatorAggregator defaultInterpolator;
|
||||
private transient MessageInterpolator userInterpolator;
|
||||
private static final Filter GET_ALL_FILTER = new Filter() {
|
||||
public boolean returnStatic() {
|
||||
|
|
@ -230,7 +230,7 @@ public class LibrePlanClassValidator<T> implements Serializable {
|
|||
memberValidators = new ArrayList<Validator>();
|
||||
memberGetters = new ArrayList<XMember>();
|
||||
childGetters = new ArrayList<XMember>();
|
||||
defaultInterpolator = new DefaultMessageInterpolatorAggerator();
|
||||
defaultInterpolator = new DefaultMessageInterpolatorAggregator();
|
||||
defaultInterpolator.initialize( messageBundle, defaultMessageBundle );
|
||||
|
||||
//build the class hierarchy to look for members in
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
package org.libreplan.business.test.orders.entities;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.everyItem;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
|
@ -28,7 +29,6 @@ import static org.junit.Assert.assertNull;
|
|||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.matchers.JUnitMatchers.each;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
@ -148,13 +148,13 @@ public class SchedulingStateTest {
|
|||
public void whenSchedulingAElementItTurnsAllItsDescendantsIntoScheduledSubelements() {
|
||||
root.schedule();
|
||||
assertThat(allRootDescendants(),
|
||||
each(hasType(Type.SCHEDULED_SUBELEMENT)));
|
||||
everyItem(hasType(Type.SCHEDULED_SUBELEMENT)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aScheduledElementIsCompletelyScheduled() {
|
||||
root.schedule();
|
||||
assertThat(all(), each(completelyScheduled()));
|
||||
assertThat(all(), everyItem(completelyScheduled()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -179,12 +179,12 @@ public class SchedulingStateTest {
|
|||
@Test
|
||||
public void scheduledSubelementsCantBeScheduled() {
|
||||
root.schedule();
|
||||
assertThat(allRootDescendants(), each(not(canBeScheduled())));
|
||||
assertThat(allRootDescendants(), everyItem(not(canBeScheduled())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aNoScheduledElementCanBeScheduled() {
|
||||
assertThat(all(), each(canBeScheduled()));
|
||||
assertThat(all(), everyItem(canBeScheduled()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -269,14 +269,14 @@ public class SchedulingStateTest {
|
|||
@Test
|
||||
public void scheduledSubelementsCantBeUnScheduled() {
|
||||
root.schedule();
|
||||
assertThat(allRootDescendants(), each(not(canBeUnsheduled())));
|
||||
assertThat(allRootDescendants(), everyItem(not(canBeUnsheduled())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void afterUnschedulingAllDescendantsAreNoScheduled() {
|
||||
root.schedule();
|
||||
root.unschedule();
|
||||
assertThat(allRootDescendants(), each(hasType(Type.NO_SCHEDULED)));
|
||||
assertThat(allRootDescendants(), everyItem(hasType(Type.NO_SCHEDULED)));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
package org.libreplan.business.test.planner.daos;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
|
@ -253,7 +253,7 @@ public class TaskElementDAOTest {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
assertThat(fromDB.getId(), equalTo(task.getId()));
|
||||
assertThat(fromDB, is(Task.class));
|
||||
assertThat(fromDB, instanceOf(Task.class));
|
||||
checkProperties(task, fromDB);
|
||||
HoursGroup reloaded = ((Task) fromDB).getHoursGroup();
|
||||
assertThat(reloaded.getId(), equalTo(reloaded.getId()));
|
||||
|
|
@ -271,7 +271,7 @@ public class TaskElementDAOTest {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
assertThat(fromDB.getId(), equalTo(milestone.getId()));
|
||||
assertThat(fromDB, is(TaskMilestone.class));
|
||||
assertThat(fromDB, instanceOf(TaskMilestone.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -295,7 +295,7 @@ public class TaskElementDAOTest {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
assertThat(reloaded.getId(), equalTo(taskGroup.getId()));
|
||||
assertThat(reloaded, is(TaskGroup.class));
|
||||
assertThat(reloaded, instanceOf(TaskGroup.class));
|
||||
checkProperties(taskGroup, reloaded);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
package org.libreplan.business.test.planner.entities;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.both;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
@ -28,9 +30,8 @@ import java.util.List;
|
|||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.core.CombinableMatcher;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.matchers.CombinableMatcher;
|
||||
import org.junit.matchers.JUnitMatchers;
|
||||
import org.libreplan.business.planner.entities.DayAssignment;
|
||||
import org.libreplan.business.planner.entities.GenericDayAssignment;
|
||||
import org.libreplan.business.planner.entities.ResourceAllocation;
|
||||
|
|
@ -75,7 +76,7 @@ public class DayAssignmentMatchers {
|
|||
|
||||
public CombinableMatcher<List<? extends DayAssignment>> consecutiveDays(
|
||||
int days) {
|
||||
return JUnitMatchers.both(this).and(
|
||||
return both(this).and(
|
||||
DayAssignmentMatchers.consecutiveDays(days));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,15 +20,16 @@
|
|||
*/
|
||||
package org.libreplan.business.util.deepcopy;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.everyItem;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.matchers.Each.each;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -110,7 +111,7 @@ public class DeepCopyTest {
|
|||
Integer.class, Short.class, Byte.class, Character.class,
|
||||
LocalDate.class, Boolean.class, DateTime.class, double.class,
|
||||
float.class, int.class, short.class, byte.class, char.class);
|
||||
assertThat(immutableTypes, each(immutable()));
|
||||
assertThat(immutableTypes, everyItem(immutable()));
|
||||
}
|
||||
|
||||
private Matcher<Class<?>> immutable() {
|
||||
|
|
@ -149,7 +150,7 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void setsAreCopied() {
|
||||
EntityA entityA = new EntityA();
|
||||
HashSet<Object> originalSet = new HashSet<Object>(Arrays.asList("test",
|
||||
HashSet<Object> originalSet = new HashSet<Object>(asList("test",
|
||||
2, 3, new Date()));
|
||||
entityA.setSetProperty(originalSet);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
|
|
@ -160,19 +161,19 @@ public class DeepCopyTest {
|
|||
@Test
|
||||
public void theSetImplementationClassIsPreservedIfPossible() {
|
||||
EntityA entityA = new EntityA();
|
||||
Set<Object> originalSet = new LinkedHashSet<Object>(Arrays.asList(
|
||||
"test", 2, 3, new Date()));
|
||||
Set<Object> originalSet = new LinkedHashSet<Object>(asList("test", 2,
|
||||
3, new Date()));
|
||||
entityA.setSetProperty(originalSet);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertThat(copy.getSetProperty(), is(LinkedHashSet.class));
|
||||
assertThat(copy.getSetProperty(), instanceOf(LinkedHashSet.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setsInsideSetsAreRecursivelyCopiedWithoutProblem() {
|
||||
EntityA entityA = new EntityA();
|
||||
HashSet<Object> innerSet = new HashSet<Object>(Arrays.asList("bla", 3));
|
||||
HashSet<Object> originalSet = new HashSet<Object>(Arrays.asList("test",
|
||||
2, 3, new Date(), innerSet));
|
||||
HashSet<Object> innerSet = new HashSet<Object>(asList("bla", 3));
|
||||
HashSet<Object> originalSet = new HashSet<Object>(asList("test", 2, 3,
|
||||
new Date(), innerSet));
|
||||
entityA.setSetProperty(originalSet);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertEquals(originalSet, copy.getSetProperty());
|
||||
|
|
@ -197,7 +198,7 @@ public class DeepCopyTest {
|
|||
mapProperty.put("ab", "abc");
|
||||
entityA.setMapProperty(mapProperty);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertThat(copy.getMapProperty(), is(LinkedHashMap.class));
|
||||
assertThat(copy.getMapProperty(), instanceOf(LinkedHashMap.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -220,7 +221,7 @@ public class DeepCopyTest {
|
|||
originalList.add(2);
|
||||
entityA.setListProperty(originalList);
|
||||
EntityA copy = new DeepCopy().copy(entityA);
|
||||
assertThat(copy.getListProperty(), is(LinkedList.class));
|
||||
assertThat(copy.getListProperty(), instanceOf(LinkedList.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
|
||||
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
|
||||
|
||||
<bean id="dataSourceReal"
|
||||
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"
|
||||
|
|
|
|||
|
|
@ -312,16 +312,28 @@
|
|||
<groupId>${jdbcDriver.groupId}</groupId>
|
||||
<artifactId>${jdbcDriver.artifactId}</artifactId>
|
||||
</dependency>
|
||||
<!-- Hibernate -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring</artifactId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-acl</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring Dependency LDAP -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-ldap</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.0.1B_spec</artifactId>
|
||||
|
|
@ -330,50 +342,22 @@
|
|||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
</dependency>
|
||||
<!-- QuartzJobBean in spring-context-support.jar -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring security -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
<artifactId>spring-security-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-acl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core-tiger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Dependency LDAP -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-core-tiger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-odm</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-ldif-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-ldif-batch</artifactId>
|
||||
</dependency>
|
||||
<!-- AspectJ (required by Spring Security) -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-ldap</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.beanshell</groupId>
|
||||
<artifactId>bsh</artifactId>
|
||||
|
|
@ -432,10 +416,6 @@
|
|||
<groupId>com.jolbox</groupId>
|
||||
<artifactId>bonecp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.web.common.entrypoints.EntryPointsHandler;
|
||||
import org.springframework.security.context.SecurityContext;
|
||||
import org.springframework.security.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.zkoss.ganttz.Planner;
|
||||
import org.zkoss.ganttz.servlets.CallbackServlet;
|
||||
import org.zkoss.ganttz.servlets.CallbackServlet.IServletRequestHandler;
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ import org.libreplan.business.users.entities.OrderAuthorizationType;
|
|||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.business.users.entities.UserRole;
|
||||
import org.libreplan.web.users.services.CustomUser;
|
||||
import org.springframework.security.Authentication;
|
||||
import org.springframework.security.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ package org.libreplan.web.users.services;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.security.Authentication;
|
||||
import org.springframework.security.AuthenticationException;
|
||||
import org.springframework.security.providers.AuthenticationProvider;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
|
||||
public class AuthenticationProviderLoggingDecorator implements AuthenticationProvider {
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,13 @@
|
|||
|
||||
package org.libreplan.web.users.services;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.libreplan.business.common.IAdHocTransactionService;
|
||||
import org.libreplan.business.common.IOnTransaction;
|
||||
|
|
@ -29,10 +35,10 @@ import org.libreplan.business.users.daos.IUserDAO;
|
|||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.business.users.entities.UserRole;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.Authentication;
|
||||
import org.springframework.security.ui.TargetUrlResolverImpl;
|
||||
import org.springframework.security.ui.savedrequest.SavedRequest;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
|
||||
/**
|
||||
* Determines the URL for authenticated users depending on if user is bound or
|
||||
|
|
@ -43,7 +49,8 @@ import org.springframework.security.userdetails.UserDetails;
|
|||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*/
|
||||
public class CustomTargetUrlResolver extends TargetUrlResolverImpl {
|
||||
public class CustomTargetUrlResolver extends
|
||||
SavedRequestAwareAuthenticationSuccessHandler {
|
||||
|
||||
public final static String USER_DASHBOARD_URL = "/myaccount/userDashboard.zul";
|
||||
|
||||
|
|
@ -60,22 +67,52 @@ public class CustomTargetUrlResolver extends TargetUrlResolverImpl {
|
|||
@Autowired
|
||||
private IAdHocTransactionService transactionServiceDAO;
|
||||
|
||||
@Override
|
||||
public String determineTargetUrl(SavedRequest savedRequest,
|
||||
HttpServletRequest currentRequest, final Authentication auth) {
|
||||
if (isUserInRole(auth, UserRole.ROLE_SUPERUSER.name())) {
|
||||
return super.determineTargetUrl(savedRequest, currentRequest, auth);
|
||||
}
|
||||
private ThreadLocal<Authentication> currentAuth = new ThreadLocal<Authentication>();
|
||||
|
||||
if (isUserInRole(auth, UserRole.ROLE_BOUND_USER.name())) {
|
||||
@Override
|
||||
public void onAuthenticationSuccess(HttpServletRequest request,
|
||||
HttpServletResponse response, Authentication auth)
|
||||
throws ServletException, IOException {
|
||||
|
||||
try {
|
||||
currentAuth.set(auth);
|
||||
super.onAuthenticationSuccess(request, response, auth);
|
||||
} finally {
|
||||
currentAuth.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String determineTargetUrl(HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
|
||||
String targetURL = super.determineTargetUrl(request, response);
|
||||
// if using default URL, we may want to use one based on the current
|
||||
// user
|
||||
if (targetURL.equals(getDefaultTargetUrl())) {
|
||||
return calculatePreferedForUser(currentAuth.get());
|
||||
}
|
||||
return targetURL;
|
||||
}
|
||||
|
||||
private String calculatePreferedForUser(final Authentication auth) {
|
||||
if (isUserInSomeRole(auth, roles(UserRole.ROLE_BOUND_USER))) {
|
||||
return USER_DASHBOARD_URL;
|
||||
}
|
||||
|
||||
if (isUserInRole(auth, UserRole.ROLE_PLANNING.name())) {
|
||||
return PLANNING_URL;
|
||||
if (isUserInSomeRole(auth,
|
||||
roles(UserRole.ROLE_SUPERUSER, UserRole.ROLE_PLANNING))) {
|
||||
return getDefaultTargetUrl();
|
||||
}
|
||||
|
||||
boolean userOrItsProfilesHaveAnyAuthorization = transactionServiceDAO
|
||||
if (!hasAnyAuthorization(auth)) {
|
||||
return SETTINGS_URL;
|
||||
}
|
||||
return getDefaultTargetUrl();
|
||||
}
|
||||
|
||||
private boolean hasAnyAuthorization(final Authentication auth) {
|
||||
return transactionServiceDAO
|
||||
.runOnReadOnlyTransaction(new IOnTransaction<Boolean>() {
|
||||
@Override
|
||||
public Boolean execute() {
|
||||
|
|
@ -83,33 +120,34 @@ public class CustomTargetUrlResolver extends TargetUrlResolverImpl {
|
|||
UserDetails userDetails = (UserDetails) auth.getPrincipal();
|
||||
User user = userDAO.findByLoginName(userDetails.getUsername());
|
||||
user.getProfiles().size();
|
||||
return orderAuthorizationDAO
|
||||
.userOrItsProfilesHaveAnyAuthorization(user);
|
||||
return orderAuthorizationDAO.userOrItsProfilesHaveAnyAuthorization(user);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
if (userOrItsProfilesHaveAnyAuthorization) {
|
||||
return PLANNING_URL;
|
||||
}
|
||||
|
||||
return SETTINGS_URL;
|
||||
}
|
||||
|
||||
private boolean isUserInRole(Authentication auth, String role) {
|
||||
private static Set<String> roles(UserRole... roles) {
|
||||
Set<String> result = new HashSet<String>();
|
||||
for (UserRole each : roles) {
|
||||
result.add(each.name());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private boolean isUserInSomeRole(Authentication auth, Set<String> roles) {
|
||||
if ((auth == null) || (auth.getPrincipal() == null)
|
||||
|| (auth.getAuthorities() == null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < auth.getAuthorities().length; i++) {
|
||||
if (role.equals(auth.getAuthorities()[i].getAuthority())) {
|
||||
for (GrantedAuthority authority : auth.getAuthorities()) {
|
||||
if (roles.contains(authority.getAuthority())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@
|
|||
|
||||
package org.libreplan.web.users.services;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.libreplan.business.scenarios.entities.Scenario;
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.userdetails.User;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
|
||||
/**
|
||||
* Extended {@link User} class in order to add information about the current
|
||||
|
|
@ -38,7 +40,8 @@ public class CustomUser extends User {
|
|||
|
||||
public CustomUser(String username, String password, boolean enabled,
|
||||
boolean accountNonExpired, boolean credentialsNonExpired,
|
||||
boolean accountNonLocked, GrantedAuthority[] authorities,
|
||||
boolean accountNonLocked,
|
||||
Collection<? extends GrantedAuthority> authorities,
|
||||
Scenario scenario) throws IllegalArgumentException {
|
||||
super(username, password, enabled, accountNonExpired,
|
||||
credentialsNonExpired, accountNonLocked, authorities);
|
||||
|
|
|
|||
|
|
@ -21,11 +21,14 @@
|
|||
|
||||
package org.libreplan.web.users.services;
|
||||
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.providers.dao.SaltSource;
|
||||
import org.springframework.security.providers.encoding.PasswordEncoder;
|
||||
import org.springframework.security.userdetails.User;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.springframework.security.authentication.dao.SaltSource;
|
||||
import org.springframework.security.authentication.encoding.PasswordEncoder;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
/**
|
||||
* For maximum flexibility, the implementation uses the password encoder and
|
||||
|
|
@ -66,7 +69,7 @@ public class DBPasswordEncoderService implements IDBPasswordEncoderService {
|
|||
* the "user" passed as a parameter to "saltSource.getSalt".
|
||||
*/
|
||||
UserDetails userDetails = new User(loginName, clearPassword, true,
|
||||
true, true, true, new GrantedAuthority[0]);
|
||||
true, true, true, Collections.<GrantedAuthority>emptyList());
|
||||
|
||||
Object salt = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
package org.libreplan.web.users.services;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
|
|
@ -32,11 +34,11 @@ import org.libreplan.business.users.entities.User;
|
|||
import org.libreplan.business.users.entities.UserRole;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.GrantedAuthorityImpl;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.userdetails.UserDetailsService;
|
||||
import org.springframework.security.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.GrantedAuthorityImpl;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
|
|
@ -82,18 +84,12 @@ public class DBUserDetailsService implements UserDetailsService {
|
|||
scenario);
|
||||
}
|
||||
|
||||
private GrantedAuthority[] getGrantedAuthorities(Set<UserRole> roles) {
|
||||
|
||||
GrantedAuthority[] grantedAuthorities =
|
||||
new GrantedAuthority[roles.size()];
|
||||
int i = 0;
|
||||
|
||||
private List<GrantedAuthority> getGrantedAuthorities(Set<UserRole> roles) {
|
||||
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
|
||||
for (UserRole r : roles) {
|
||||
grantedAuthorities[i++] = new GrantedAuthorityImpl(r.name());
|
||||
result.add(new GrantedAuthorityImpl(r.name()));
|
||||
}
|
||||
|
||||
return grantedAuthorities;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,13 +45,13 @@ import org.springframework.ldap.core.DirContextAdapter;
|
|||
import org.springframework.ldap.core.DistinguishedName;
|
||||
import org.springframework.ldap.core.LdapTemplate;
|
||||
import org.springframework.ldap.filter.EqualsFilter;
|
||||
import org.springframework.security.AuthenticationException;
|
||||
import org.springframework.security.BadCredentialsException;
|
||||
import org.springframework.security.providers.AuthenticationProvider;
|
||||
import org.springframework.security.providers.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.providers.dao.AbstractUserDetailsAuthenticationProvider;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.userdetails.UserDetailsService;
|
||||
import org.springframework.security.authentication.AuthenticationProvider;
|
||||
import org.springframework.security.authentication.BadCredentialsException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
|
|
@ -110,7 +110,6 @@ public class LDAPCustomAuthenticationProvider extends
|
|||
// No needed at this time
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Transactional(readOnly = true)
|
||||
@Override
|
||||
public UserDetails retrieveUser(String username,
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
package org.libreplan.web.users.services;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
|
|
@ -29,11 +31,11 @@ import org.libreplan.business.users.entities.User;
|
|||
import org.libreplan.business.users.entities.UserRole;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.GrantedAuthorityImpl;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.userdetails.UserDetailsService;
|
||||
import org.springframework.security.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.authority.GrantedAuthorityImpl;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
|
|
@ -80,16 +82,11 @@ public class LDAPUserDetailsService implements UserDetailsService {
|
|||
getGrantedAuthorities(user.getAllRoles()), scenario);
|
||||
}
|
||||
|
||||
private GrantedAuthority[] getGrantedAuthorities(Set<UserRole> roles) {
|
||||
|
||||
GrantedAuthority[] grantedAuthorities = new GrantedAuthority[roles
|
||||
.size()];
|
||||
int i = 0;
|
||||
|
||||
private List<GrantedAuthority> getGrantedAuthorities(Set<UserRole> roles) {
|
||||
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
|
||||
for (UserRole r : roles) {
|
||||
grantedAuthorities[i++] = new GrantedAuthorityImpl(r.name());
|
||||
result.add(new GrantedAuthorityImpl(r.name()));
|
||||
}
|
||||
|
||||
return grantedAuthorities;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
|
||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.1.xsd">
|
||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.3.xsd">
|
||||
|
||||
<!-- NOTE: see http://static.springsource.org/spring-security/site/docs/2.0.x/apidocs/org/springframework/security/vote/AuthenticatedVoter.html
|
||||
for an explanation of the meaning of IS_AUTHENTICATED_ANONYMOUSLY and IS_AUTHENTICATED_FULLY. -->
|
||||
|
|
@ -12,6 +12,8 @@
|
|||
<http auto-config="false" realm="LibrePlan Web Application"
|
||||
entry-point-ref="customAuthenticationEntryPoint">
|
||||
|
||||
<custom-filter position="FORM_LOGIN_FILTER" ref="customAuthenticationFilter"/>
|
||||
|
||||
<!-- Web services -->
|
||||
<intercept-url pattern="/ws/rest/bounduser/**"
|
||||
access="ROLE_BOUND_USER"
|
||||
|
|
@ -142,15 +144,20 @@
|
|||
|
||||
</http>
|
||||
|
||||
<beans:bean id="customAuthenticationEntryPoint"
|
||||
class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint">
|
||||
<beans:property name="loginFormUrl" value="/common/layout/login.zul"/>
|
||||
</beans:bean>
|
||||
|
||||
<!-- Beans used by Spring Security (current configuration assumes users
|
||||
are registered in the database). -->
|
||||
<beans:bean id="passwordEncoder"
|
||||
class="org.springframework.security.providers.encoding.ShaPasswordEncoder">
|
||||
class="org.springframework.security.authentication.encoding.ShaPasswordEncoder">
|
||||
<beans:constructor-arg value="512" />
|
||||
</beans:bean>
|
||||
|
||||
<beans:bean id="saltSource"
|
||||
class="org.springframework.security.providers.dao.salt.ReflectionSaltSource"
|
||||
class="org.springframework.security.authentication.dao.ReflectionSaltSource"
|
||||
p:userPropertyToUse="username" />
|
||||
<!-- <beans:bean id="realAuthenticationProvider" class="org.springframework.security.providers.dao.DaoAuthenticationProvider"
|
||||
p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" p:userDetailsService-ref="dbUserDetailsService">
|
||||
|
|
@ -191,7 +198,6 @@
|
|||
|
||||
<beans:bean id="authenticationProvider" class="org.libreplan.web.users.services.AuthenticationProviderLoggingDecorator">
|
||||
<beans:property name="decoratedProvider" ref="realAuthenticationProvider"></beans:property>
|
||||
<custom-authentication-provider/>
|
||||
</beans:bean>
|
||||
|
||||
<!-- This bean is used to implement UserDetailsService with LDAP authentication
|
||||
|
|
@ -202,24 +208,25 @@
|
|||
<!-- Configured a custom authentication filter:
|
||||
* This needs a custom authentication entry point
|
||||
* Also a custom target URL resolver is used to determine the URL depending on the user -->
|
||||
<authentication-manager alias="authenticationManager" />
|
||||
<authentication-manager alias="authenticationManager">
|
||||
<authentication-provider ref="authenticationProvider"/>
|
||||
</authentication-manager>
|
||||
|
||||
<beans:bean id="customAuthenticationFilter"
|
||||
class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter" >
|
||||
<custom-filter position="AUTHENTICATION_PROCESSING_FILTER" />
|
||||
class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter" >
|
||||
<beans:property name="authenticationManager" ref="authenticationManager" />
|
||||
<beans:property name="defaultTargetUrl" value="/planner/index.zul" />
|
||||
<beans:property name="authenticationFailureUrl" value="/common/layout/login.zul?login_error=true" />
|
||||
<beans:property name="authenticationFailureHandler" ref="urlAuthenticationFailureHandler" />
|
||||
<beans:property name="allowSessionCreation" value="true" />
|
||||
<beans:property name="targetUrlResolver" ref="customTargetUrlResolver" />
|
||||
<beans:property name="authenticationSuccessHandler" ref="customTargetUrlResolver" />
|
||||
</beans:bean>
|
||||
|
||||
<beans:bean id="customAuthenticationEntryPoint"
|
||||
class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
|
||||
<beans:property name="loginFormUrl" value="/common/layout/login.zul"/>
|
||||
<beans:bean id="urlAuthenticationFailureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
|
||||
<beans:property name="defaultFailureUrl" value="/common/layout/login.zul?login_error=true" />
|
||||
</beans:bean>
|
||||
|
||||
<beans:bean id="customTargetUrlResolver"
|
||||
class="org.libreplan.web.users.services.CustomTargetUrlResolver" />
|
||||
class="org.libreplan.web.users.services.CustomTargetUrlResolver" >
|
||||
<beans:property name="defaultTargetUrl" value="/planner/index.zul" />
|
||||
</beans:bean>
|
||||
|
||||
</beans:beans>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<preference>
|
||||
<name>ThreadLocal</name>
|
||||
<value>
|
||||
org.springframework.security.context.ThreadLocalSecurityContextHolderStrategy=contextHolder
|
||||
org.springframework.security.core.context.ThreadLocalSecurityContextHolderStrategy=contextHolder
|
||||
</value>
|
||||
</preference>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,9 +40,9 @@ import org.libreplan.business.scenarios.bootstrap.PredefinedScenarios;
|
|||
import org.libreplan.business.scenarios.entities.Scenario;
|
||||
import org.libreplan.web.users.services.CustomUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.Authentication;
|
||||
import org.springframework.security.context.SecurityContext;
|
||||
import org.springframework.security.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContext;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ import org.libreplan.business.users.entities.UserRole;
|
|||
import org.libreplan.web.users.bootstrap.IUsersBootstrapInDB;
|
||||
import org.libreplan.web.users.bootstrap.PredefinedUsers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ import org.libreplan.business.users.entities.UserRole;
|
|||
import org.libreplan.web.users.bootstrap.IUsersBootstrapInDB;
|
||||
import org.libreplan.web.users.bootstrap.PredefinedUsers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.GrantedAuthority;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
import org.springframework.security.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
|
||||
|
||||
<bean id="passwordEncoder"
|
||||
class="org.springframework.security.providers.encoding.ShaPasswordEncoder">
|
||||
class="org.springframework.security.authentication.encoding.ShaPasswordEncoder">
|
||||
<constructor-arg value="512" />
|
||||
</bean>
|
||||
|
||||
<bean id="saltSource"
|
||||
class="org.springframework.security.providers.dao.salt.ReflectionSaltSource"
|
||||
class="org.springframework.security.authentication.dao.ReflectionSaltSource"
|
||||
p:userPropertyToUse="username" />
|
||||
<!-- <bean id="dbUserDetailsService" class="org.libreplan.web.users.services.DBUserDetailsService"/> -->
|
||||
<bean id="dbPasswordEncoderService"
|
||||
|
|
|
|||
439
pom.xml
439
pom.xml
|
|
@ -218,6 +218,51 @@
|
|||
<artifactId>gettext-commons</artifactId>
|
||||
<version>0.9.6</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
|
||||
(depends on spring-core, spring-beans, spring-context, spring-tx)
|
||||
Define this if you need ORM (org.springframework.orm.*)
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</artifactId>
|
||||
<version>3.0.7.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>3.3.1.GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-annotations</artifactId>
|
||||
<version>3.3.1.GA</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>3.1.0.GA</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time-hibernate</artifactId>
|
||||
<version>1.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib-full</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- JDBC driver -->
|
||||
<dependency>
|
||||
<groupId>${jdbcDriver.groupId}</groupId>
|
||||
|
|
@ -225,52 +270,94 @@
|
|||
<version>${jdbcDriver.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Hibernate -->
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate</artifactId>
|
||||
<version>3.2.7.ga</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>jta</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.0.1B_spec</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-annotations</artifactId>
|
||||
<version>3.3.1.GA</version>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>3.0.7.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>3.0.0.ga</version>
|
||||
</dependency>
|
||||
<!-- JUnit -->
|
||||
<!--
|
||||
IMPORTANT: Spring TestContext 2.5.x is not compatible
|
||||
with JUnit 4.5.
|
||||
Various Application Context utilities, including EhCache, JavaMail, Quartz, and
|
||||
Freemarker integration
|
||||
We use QuartzJobBean.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>3.0.7.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
Some optional Spring dependencies needed:
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>1.6.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>1.6.11</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.4.GA</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Spring security -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-web</artifactId>
|
||||
<version>3.0.8.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-config</artifactId>
|
||||
<version>3.0.8.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-acl</artifactId>
|
||||
<version>3.0.8.RELEASE</version>
|
||||
</dependency>
|
||||
<!-- Spring Dependency LDAP -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-ldap</artifactId>
|
||||
<version>3.0.8.RELEASE</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JUnit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.4</version>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- datasource for testing -->
|
||||
<dependency>
|
||||
<groupId>com.jolbox</groupId>
|
||||
<artifactId>bonecp</artifactId>
|
||||
<version>0.7.1.RELEASE</version>
|
||||
<version>0.8.0.RELEASE</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>3.0.7.RELEASE</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Easy mock -->
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
|
|
@ -286,273 +373,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring</artifactId>
|
||||
<version>2.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>2.5.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- QuartzJobBean in spring-context-support.jar -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>2.5.6</version>
|
||||
</dependency>
|
||||
<!-- Spring security -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
<version>2.0.5.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-support</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-acl</artifactId>
|
||||
<version>2.0.5.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-dao</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core-tiger</artifactId>
|
||||
<version>2.0.5.RELEASE</version>
|
||||
</dependency>
|
||||
<!-- Spring Dependency LDAP -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-core</artifactId>
|
||||
<version>1.3.1.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-support</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-core-tiger</artifactId>
|
||||
<version>1.3.1.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-support</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-odm</artifactId>
|
||||
<version>1.3.1.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-support</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-ldif-core</artifactId>
|
||||
<version>1.3.1.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-support</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-ldif-batch</artifactId>
|
||||
<version>1.3.1.RELEASE</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-support</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>2.5.6</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- AspectJ -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
<version>1.7.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- AspectJ (required by Spring Security) -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>1.7.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.2.3</version>
|
||||
<classifier>jdk15</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2</version>
|
||||
|
|
@ -580,6 +407,11 @@
|
|||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<version>1.7.2</version>
|
||||
</dependency>
|
||||
<!-- BeanShell (required by ZK)-->
|
||||
<dependency>
|
||||
<groupId>org.beanshell</groupId>
|
||||
|
|
@ -639,21 +471,6 @@
|
|||
<artifactId>joda-time</artifactId>
|
||||
<version>1.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>joda-time</groupId>
|
||||
<artifactId>joda-time-hibernate</artifactId>
|
||||
<version>1.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>cglib</groupId>
|
||||
<artifactId>cglib-full</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- LibrePlan ZK Components -->
|
||||
<dependency>
|
||||
<groupId>org.libreplan</groupId>
|
||||
|
|
@ -671,16 +488,6 @@
|
|||
<artifactId>dbunit</artifactId>
|
||||
<version>2.4.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.5.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
|
|
@ -804,6 +611,16 @@
|
|||
<groupId>org.quartz-scheduler</groupId>
|
||||
<artifactId>quartz</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue