Updated heavy-duty sample to be able to build it.

This commit is contained in:
Luke Taylor 2009-04-28 06:42:57 +00:00
parent 929b6bb1a0
commit f38c0eb675
13 changed files with 268 additions and 275 deletions

View File

@ -8,24 +8,20 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId> <artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version> <version>${spring.security.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId> <artifactId>spring-security-ldap</artifactId>
<version>${spring.security.version}</version> <version>${spring.security.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework.security</groupId>
<artifactId>org.springframework.core</artifactId> <artifactId>spring-security-config</artifactId>
<version>${spring.version}</version> <version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
<version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>org.springframework.web</artifactId> <artifactId>org.springframework.web</artifactId>
@ -40,60 +36,62 @@
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>org.springframework.jdbc</artifactId> <artifactId>org.springframework.jdbc</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId> <artifactId>org.springframework.orm</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
<!--
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>org.springframework.aop</artifactId> <artifactId>org.springframework.aop</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<version>${spring.version}</version> <version>${spring.version}</version>
</dependency> </dependency>
-->
<dependency> <dependency>
<groupId>org.freemarker</groupId> <groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId> <artifactId>freemarker</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<version>2.3.12</version> <version>2.3.12</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>hsqldb</groupId> <groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId> <artifactId>hsqldb</artifactId>
<version>1.8.0.7</version> <version>1.8.0.7</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.hibernate</groupId> <groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId> <artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version> <version>3.3.2.GA</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.sf.ehcache</groupId> <groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId> <artifactId>ehcache</artifactId>
<version>1.3.0</version> <version>1.4.1</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<optional>true</optional>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.5.4</version>
</dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId> <artifactId>servlet-api</artifactId>
<scope>provided</scope> <scope>provided</scope>
<version>2.4</version> <version>2.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId> <artifactId>jstl</artifactId>
@ -104,7 +102,7 @@
<groupId>taglibs</groupId> <groupId>taglibs</groupId>
<artifactId>standard</artifactId> <artifactId>standard</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<version>1.1.2</version> <version>1.1.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.directory.server</groupId> <groupId>org.apache.directory.server</groupId>
@ -123,18 +121,18 @@
<artifactId>slf4j-log4j12</artifactId> <artifactId>slf4j-log4j12</artifactId>
<version>1.4.3</version> <version>1.4.3</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.ldap</groupId> <groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId> <artifactId>spring-ldap</artifactId>
<version>1.2.1</version> <version>1.2.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
<version>1.2.14</version> <version>1.2.14</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
@ -155,7 +153,7 @@
<downloadSources>true</downloadSources> <downloadSources>true</downloadSources>
<wtpversion>2.0</wtpversion> <wtpversion>2.0</wtpversion>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.mortbay.jetty</groupId> <groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId> <artifactId>maven-jetty-plugin</artifactId>
@ -183,8 +181,8 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<properties> <properties>
<spring.version>2.5.6</spring.version> <spring.version>3.0.0.M2</spring.version>
<spring.security.version>3.0.0.CI-SNAPSHOT</spring.security.version> <spring.security.version>3.0.0.CI-SNAPSHOT</spring.security.version>
</properties> </properties>

View File

@ -5,8 +5,8 @@ import java.util.Map;
public class BankDaoStub implements BankDao { public class BankDaoStub implements BankDao {
private long id = 0; private long id = 0;
private Map accounts = new HashMap(); private Map<Long, Account> accounts = new HashMap<Long, Account>();
public void createOrUpdateAccount(Account account) { public void createOrUpdateAccount(Account account) {
if (account.getId() == -1) { if (account.getId() == -1) {
id++; id++;

View File

@ -1,15 +1,15 @@
package bigbank; package bigbank;
import org.springframework.security.annotation.Secured; import org.springframework.security.access.annotation.Secured;
public interface BankService { public interface BankService {
@Secured("IS_AUTHENTICATED_ANONYMOUSLY") @Secured("IS_AUTHENTICATED_ANONYMOUSLY")
public Account readAccount(Long id); public Account readAccount(Long id);
@Secured("IS_AUTHENTICATED_ANONYMOUSLY") @Secured("IS_AUTHENTICATED_ANONYMOUSLY")
public Account[] findAccounts(); public Account[] findAccounts();
@Secured("ROLE_TELLER") @Secured("ROLE_TELLER")
public Account post(Account account, double amount); public Account post(Account account, double amount);
} }

View File

@ -1,11 +1,11 @@
package heavyduty.security.ui; package heavyduty.security.ui;
import org.springframework.security.ui.webapp.AuthenticationProcessingFilter; import org.springframework.security.web.authentication.AuthenticationProcessingFilter;
public class HeavyDutyAuthenticationProcessingFilter extends AuthenticationProcessingFilter { public class HeavyDutyAuthenticationProcessingFilter extends AuthenticationProcessingFilter {
} }

View File

@ -1,9 +1,9 @@
package heavyduty.security.ui; package heavyduty.security.ui;
import org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint; import org.springframework.security.web.authentication.AuthenticationProcessingFilterEntryPoint;
public class HeavyDutyEntryPoint extends AuthenticationProcessingFilterEntryPoint { public class HeavyDutyEntryPoint extends AuthenticationProcessingFilterEntryPoint {
} }

View File

@ -18,33 +18,33 @@ import org.springframework.web.servlet.mvc.multiaction.MultiActionController;
*/ */
public class TestMultiActionController extends MultiActionController { public class TestMultiActionController extends MultiActionController {
public static final String VIEW_NAME = "multi-action-test"; public static final String VIEW_NAME = "multi-action-test";
public String login(HttpServletRequest request, HttpServletResponse response) { public String login(HttpServletRequest request, HttpServletResponse response) {
return "login"; return "login";
} }
public void step1(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { public void step1(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String[] x = request.getParameterValues("x"); String[] x = request.getParameterValues("x");
logger.info("x= " + (x == null ? "null" : Arrays.asList(x))); logger.info("x= " + (x == null ? "null" : Arrays.asList(x)));
String[] y = request.getParameterValues("y"); String[] y = request.getParameterValues("y");
logger.info("y = " + (y == null ? "null" : Arrays.asList(y))); logger.info("y = " + (y == null ? "null" : Arrays.asList(y)));
request.getRequestDispatcher("/testMulti.htm?action=step1xtra&x=5&x=5").forward(request, response); request.getRequestDispatcher("/testMulti.htm?action=step1xtra&x=5&x=5").forward(request, response);
} }
public ModelAndView step1xtra(HttpServletRequest request, HttpServletResponse response) throws ServletRequestBindingException { public ModelAndView step1xtra(HttpServletRequest request, HttpServletResponse response) throws ServletRequestBindingException {
logger.info("x = " + Arrays.asList(request.getParameterValues("x"))); logger.info("x = " + Arrays.asList(request.getParameterValues("x")));
return createView("step2"); return createView("step2");
} }
public ModelAndView step2(HttpServletRequest request, HttpServletResponse response) throws ServletRequestBindingException { public ModelAndView step2(HttpServletRequest request, HttpServletResponse response) throws ServletRequestBindingException {
return createView("step1"); return createView("step1");
} }
private ModelAndView createView(String name) { private ModelAndView createView(String name) {
Map model = new HashMap(); Map<String, String> model = new HashMap<String, String>();
model.put("nextAction", name); model.put("nextAction", name);
return new ModelAndView(VIEW_NAME, model); return new ModelAndView(VIEW_NAME, model);
} }
} }

View File

@ -1,12 +1,11 @@
package sample; package sample;
import java.lang.annotation.Annotation;
import java.util.List; import java.util.List;
import org.aopalliance.intercept.MethodInvocation; import org.aopalliance.intercept.MethodInvocation;
import org.springframework.security.Authentication; import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.ConfigAttribute; import org.springframework.security.access.vote.AccessDecisionVoter;
import org.springframework.security.vote.AccessDecisionVoter; import org.springframework.security.core.Authentication;
public class TestVoter implements AccessDecisionVoter { public class TestVoter implements AccessDecisionVoter {
@ -14,14 +13,14 @@ public class TestVoter implements AccessDecisionVoter {
return true; return true;
} }
public boolean supports(Class clazz) { public boolean supports(Class<?> clazz) {
return MethodInvocation.class.isAssignableFrom(clazz); return MethodInvocation.class.isAssignableFrom(clazz);
} }
public int vote(Authentication authentication, Object object, List<ConfigAttribute> config) { public int vote(Authentication authentication, Object object, List<ConfigAttribute> config) {
MethodInvocation mi = (MethodInvocation) object; MethodInvocation mi = (MethodInvocation) object;
Annotation[][] annotations = mi.getMethod().getParameterAnnotations(); mi.getMethod().getParameterAnnotations();
return ACCESS_GRANTED; return ACCESS_GRANTED;

View File

@ -24,7 +24,7 @@ public class GenericDAOImpl<T extends Serializable, PK extends Serializable>
/** /**
* Minimal constructor * Minimal constructor
* *
* @param t * @param t
* type POJO hibernate * type POJO hibernate
*/ */
@ -34,12 +34,11 @@ public class GenericDAOImpl<T extends Serializable, PK extends Serializable>
/** /**
* read data * read data
* *
* @param id * @param id
* data id * data id
* @return data * @return data
*/ */
@SuppressWarnings("unchecked")
public T read(PK id) { public T read(PK id) {
if (id == null) { if (id == null) {
throw new IllegalArgumentException("Id cannot be null or empty"); throw new IllegalArgumentException("Id cannot be null or empty");
@ -54,7 +53,7 @@ public class GenericDAOImpl<T extends Serializable, PK extends Serializable>
/** /**
* persist data * persist data
* *
* @param transientInstance * @param transientInstance
* data to persist * data to persist
* @see sido.common.dao.GenericDAO#persist(T) * @see sido.common.dao.GenericDAO#persist(T)
@ -68,9 +67,9 @@ public class GenericDAOImpl<T extends Serializable, PK extends Serializable>
} }
/** /**
* *
* attach clean * attach clean
* *
* @param instance * @param instance
* data to attach * data to attach
* @see sido.common.dao.GenericDAO#refresh(T) * @see sido.common.dao.GenericDAO#refresh(T)
@ -85,7 +84,7 @@ public class GenericDAOImpl<T extends Serializable, PK extends Serializable>
/** /**
* delete * delete
* *
* @param persistentInstance * @param persistentInstance
* data to delete * data to delete
* @see sido.common.dao.GenericDAO#delete(T) * @see sido.common.dao.GenericDAO#delete(T)
@ -100,13 +99,12 @@ public class GenericDAOImpl<T extends Serializable, PK extends Serializable>
/** /**
* merge * merge
* *
* @param detachedInstance * @param detachedInstance
* data to merge * data to merge
* @return the merged data * @return the merged data
* @see sido.common.dao.GenericDAO#merge(T) * @see sido.common.dao.GenericDAO#merge(T)
*/ */
@SuppressWarnings("unchecked")
public T merge(T detachedInstance) { public T merge(T detachedInstance) {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("merging instance of " LOG.debug("merging instance of "
@ -123,4 +121,4 @@ public class GenericDAOImpl<T extends Serializable, PK extends Serializable>
} }
} }

View File

@ -1,16 +1,16 @@
package sample.service; package sample.service;
import org.springframework.security.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
public interface UserService extends UserDetailsService { public interface UserService extends UserDetailsService {
/** /**
* Register a new User in database * Register a new User in database
* @param username * @param username
*/ */
public UserDetails register(String username, String password); public UserDetails register(String username, String password);
} }

View File

@ -1,18 +1,16 @@
/** /**
* *
*/ */
package sample.service.impl; package sample.service.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.GrantedAuthorityImpl; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import sample.dao.UserDAO; import sample.dao.UserDAO;
@ -21,7 +19,7 @@ import sample.service.UserService;
/** /**
* @author A207119 * @author A207119
* *
*/ */
@Component @Component
@Transactional @Transactional
@ -39,9 +37,9 @@ public class UserServiceImpl implements UserService {
try { try {
User user = userDAO.findByUsername(username); User user = userDAO.findByUsername(username);
return new org.springframework.security.userdetails.User(user return new org.springframework.security.core.userdetails.User(user
.getUsername(), user.getPassword(), true, true, true, true, .getUsername(), user.getPassword(), true, true, true, true,
new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_USER") }); AuthorityUtils.createAuthorityList("ROLE_USER"));
} catch (Exception e) { } catch (Exception e) {
LOG.error(e.getMessage(), e); LOG.error(e.getMessage(), e);
throw new UsernameNotFoundException("No matching account", e); throw new UsernameNotFoundException("No matching account", e);
@ -51,9 +49,9 @@ public class UserServiceImpl implements UserService {
public UserDetails register(String username, String password) { public UserDetails register(String username, String password) {
User user = new User(username, password); User user = new User(username, password);
userDAO.persist(user); userDAO.persist(user);
return new org.springframework.security.userdetails.User(user return new org.springframework.security.core.userdetails.User(user
.getUsername(), user.getPassword(), true, true, true, true, .getUsername(), user.getPassword(), true, true, true, true,
new GrantedAuthority[] { new GrantedAuthorityImpl("ROLE_USER") }); AuthorityUtils.createAuthorityList("ROLE_USER"));
} }

View File

@ -12,33 +12,33 @@
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" 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 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-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/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.2.xsd"> http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.2.xsd">
<!--b:import resource="appContext-misc.xml"/--> <!--b:import resource="appContext-misc.xml"/-->
<context:component-scan base-package='sample'/> <context:component-scan base-package='sample'/>
<global-method-security secured-annotations="enabled" access-decision-manager-ref="methodAccessMgr"> <global-method-security secured-annotations="enabled" access-decision-manager-ref="methodAccessMgr">
<protect-pointcut expression="execution(* sample.service.UserService+.*(..))" <protect-pointcut expression="execution(* sample.service.UserService+.*(..))"
access="ROLE_LOGGEDIN" /> access="ROLE_LOGGEDIN" />
</global-method-security> </global-method-security>
<aop:aspectj-autoproxy/> <aop:aspectj-autoproxy/>
<b:bean id="methodAccessMgr" class="org.springframework.security.vote.AffirmativeBased"> <b:bean id="methodAccessMgr" class="org.springframework.security.access.vote.AffirmativeBased">
<b:property name="decisionVoters"> <b:property name="decisionVoters">
<b:list> <b:list>
<b:bean class="sample.TestVoter"/> <b:bean class="sample.TestVoter"/>
</b:list> </b:list>
</b:property> </b:property>
</b:bean> </b:bean>
<http> <http>
<intercept-url pattern="/secure/extreme/**" access="ROLE_SUPERVISOR"/> <intercept-url pattern="/secure/extreme/**" access="ROLE_SUPERVISOR"/>
<intercept-url pattern="/secure/**" access="IS_AUTHENTICATED_REMEMBERED" /> <intercept-url pattern="/secure/**" access="IS_AUTHENTICATED_REMEMBERED" />
<intercept-url pattern="/testMulti.htm*" access="IS_AUTHENTICATED_FULLY" /> <intercept-url pattern="/testMulti.htm*" access="IS_AUTHENTICATED_FULLY" />
<!-- Disable web URI authorization, as we're using <global-method-security> and have @Secured the services layer instead <!-- Disable web URI authorization, as we're using <global-method-security> and have @Secured the services layer instead
<intercept-url pattern="/listAccounts.html" access="IS_AUTHENTICATED_REMEMBERED" /> <intercept-url pattern="/listAccounts.html" access="IS_AUTHENTICATED_REMEMBERED" />
<intercept-url pattern="/post.html" access="ROLE_TELLER" /> <intercept-url pattern="/post.html" access="ROLE_TELLER" />
--> -->
@ -57,25 +57,25 @@
<!-- Uncomment to limit the number of sessions a user can have --> <!-- Uncomment to limit the number of sessions a user can have -->
<concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="true" session-registry-ref='sessionRegistry'/> <concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="true" session-registry-ref='sessionRegistry'/>
</http> </http>
<authentication-manager alias="authenticationManager" /> <authentication-manager alias="authenticationManager" />
<b:bean id='tokenRepo' class='org.springframework.security.ui.rememberme.InMemoryTokenRepositoryImpl'/> <b:bean id='tokenRepo' class='org.springframework.security.web.authentication.rememberme.InMemoryTokenRepositoryImpl'/>
<!-- Traditional Session Control Beans --> <!-- Traditional Session Control Beans -->
<!-- <!--
<b:bean id='sessionControlFilter' class="org.springframework.security.concurrent.ConcurrentSessionFilter"> <b:bean id='sessionControlFilter' class="org.springframework.security.concurrent.ConcurrentSessionFilter">
<custom-filter position="CONCURRENT_SESSION_FILTER"/> <custom-filter position="CONCURRENT_SESSION_FILTER"/>
<b:property name="sessionRegistry" ref='sessionRegistry'/> <b:property name="sessionRegistry" ref='sessionRegistry'/>
</b:bean> </b:bean>
<b:bean id='sessionController' class="org.springframework.security.concurrent.ConcurrentSessionControllerImpl"> <b:bean id='sessionController' class="org.springframework.security.concurrent.ConcurrentSessionControllerImpl">
<b:property name='sessionRegistry' ref='sessionRegistry'/> <b:property name='sessionRegistry' ref='sessionRegistry'/>
</b:bean> </b:bean>
--> -->
<b:bean id='sessionRegistry' class="org.springframework.security.concurrent.SessionRegistryImpl"/> <b:bean id='sessionRegistry' class="org.springframework.security.authentication.concurrent.SessionRegistryImpl"/>
<!-- <!--
<b:bean id="customAuthFilter" class="heavyduty.security.ui.HeavyDutyAuthenticationProcessingFilter"> <b:bean id="customAuthFilter" class="heavyduty.security.ui.HeavyDutyAuthenticationProcessingFilter">
<custom-filter position="AUTHENTICATION_PROCESSING_FILTER"/> <custom-filter position="AUTHENTICATION_PROCESSING_FILTER"/>
@ -86,45 +86,45 @@
<b:bean id="customEntryPoint" class="heavyduty.security.ui.HeavyDutyEntryPoint"> <b:bean id="customEntryPoint" class="heavyduty.security.ui.HeavyDutyEntryPoint">
<b:property name="loginFormUrl" value="/login.jsp"/> <b:property name="loginFormUrl" value="/login.jsp"/>
</b:bean> </b:bean>
--> -->
<!-- <!--
<b:bean id="loginPageGenerator" class="org.springframework.security.ui.webapp.DefaultLoginPageGeneratingFilter"> <b:bean id="loginPageGenerator" class="org.springframework.security.ui.webapp.DefaultLoginPageGeneratingFilter">
<custom-filter after="AUTHENTICATION_PROCESSING_FILTER"/> <custom-filter after="AUTHENTICATION_PROCESSING_FILTER"/>
<b:constructor-arg ref="customAuthFilter"/> <b:constructor-arg ref="customAuthFilter"/>
</b:bean> </b:bean>
--> -->
<authentication-provider user-service-ref="daoUserService"> <authentication-provider user-service-ref="daoUserService">
<password-encoder hash="md5" /> <password-encoder hash="md5" />
</authentication-provider> </authentication-provider>
<authentication-provider> <authentication-provider>
<password-encoder hash="md5"/> <password-encoder hash="md5"/>
<user-service> <user-service>
<user name="rod" password="a564de63c2d0da68cf47586ee05984d7" authorities="ROLE_SUPERVISOR, ROLE_USER, ROLE_TELLER" /> <user name="rod" password="a564de63c2d0da68cf47586ee05984d7" authorities="ROLE_SUPERVISOR, ROLE_USER, ROLE_TELLER" />
<user name="dianne" password="65d15fe9156f9c4bbffd98085992a44e" authorities="ROLE_USER,ROLE_TELLER" /> <user name="dianne" password="65d15fe9156f9c4bbffd98085992a44e" authorities="ROLE_USER,ROLE_TELLER" />
<user name="scott" password="2b58af6dddbd072ed27ffc86725d7d3a" authorities="ROLE_USER" /> <user name="scott" password="2b58af6dddbd072ed27ffc86725d7d3a" authorities="ROLE_USER" />
<user name="peter" password="22b5c9accc6e1ba628cedc63a72d57f8" authorities="ROLE_USER" /> <user name="peter" password="22b5c9accc6e1ba628cedc63a72d57f8" authorities="ROLE_USER" />
</user-service> </user-service>
</authentication-provider> </authentication-provider>
<ldap-server id="ldapServer"/> <ldap-server id="ldapServer"/>
<!-- b:bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/ --> <!-- b:bean id="mbeanServer" class="org.springframework.jmx.support.MBeanServerFactoryBean"/ -->
<b:bean id="exporter" class="org.springframework.jmx.export.MBeanExporter"> <b:bean id="exporter" class="org.springframework.jmx.export.MBeanExporter">
<b:property name="beans"> <b:property name="beans">
<b:map> <b:map>
<b:entry key="bean:name=ldapContextSource" value-ref="ldapServer"/> <b:entry key="bean:name=ldapContextSource" value-ref="ldapServer"/>
</b:map> </b:map>
</b:property> </b:property>
<b:property name="assembler"> <b:property name="assembler">
<b:bean class="org.springframework.jmx.export.assembler.MethodNameBasedMBeanInfoAssembler"> <b:bean class="org.springframework.jmx.export.assembler.MethodNameBasedMBeanInfoAssembler">
<b:property name="managedMethods" value="setPassword,setUserDn,getUrls,setUrl,setUrls,setPooled,isPooled,setBase,getBaseLdapPathAsString"/> <b:property name="managedMethods" value="setPassword,setUserDn,getUrls,setUrl,setUrls,setPooled,isPooled,setBase,getBaseLdapPathAsString"/>
</b:bean> </b:bean>
</b:property> </b:property>
<!-- b:property name="server" ref="mbeanServer"/--> <!-- b:property name="server" ref="mbeanServer"/-->
</b:bean> </b:bean>
</b:beans>
</b:beans>

View File

@ -18,35 +18,35 @@
<beans> <beans>
<bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy"> <bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy">
<property name="filterInvocationDefinitionSource"> <property name="filterInvocationDefinitionSource">
<value><![CDATA[ <value><![CDATA[
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT PATTERN_TYPE_APACHE_ANT
/**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,basicProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor /**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,basicProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor
]]></value> ]]></value>
</property> </property>
</bean> </bean>
<bean id="httpSessionContextIntegrationFilter" class="org.springframework.security.context.HttpSessionContextIntegrationFilter"/> <bean id="httpSessionContextIntegrationFilter" class="org.springframework.security.context.HttpSessionContextIntegrationFilter"/>
<bean id="logoutFilter" class="org.springframework.security.ui.logout.LogoutFilter"> <bean id="logoutFilter" class="org.springframework.security.ui.logout.LogoutFilter">
<constructor-arg value="/index.jsp"/> <!-- URL redirected to after logout --> <constructor-arg value="/index.jsp"/> <!-- URL redirected to after logout -->
<constructor-arg> <constructor-arg>
<list> <list>
<ref bean="rememberMeServices"/> <ref bean="rememberMeServices"/>
<bean class="org.springframework.security.ui.logout.SecurityContextLogoutHandler"/> <bean class="org.springframework.security.ui.logout.SecurityContextLogoutHandler"/>
</list> </list>
</constructor-arg> </constructor-arg>
</bean> </bean>
<bean id="authenticationProcessingFilter" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter"> <bean id="authenticationProcessingFilter" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter">
<property name="authenticationManager" ref="authenticationManager"/> <property name="authenticationManager" ref="authenticationManager"/>
<property name="authenticationFailureUrl" value="/acegilogin.jsp?login_error=1"/> <property name="authenticationFailureUrl" value="/acegilogin.jsp?login_error=1"/>
<property name="defaultTargetUrl" value="/"/> <property name="defaultTargetUrl" value="/"/>
<property name="filterProcessesUrl" value="/j_spring_security_check"/> <property name="filterProcessesUrl" value="/j_spring_security_check"/>
<property name="rememberMeServices" ref="rememberMeServices"/> <property name="rememberMeServices" ref="rememberMeServices"/>
</bean> </bean>
<bean id="basicProcessingFilter" class="org.springframework.security.ui.basicauth.BasicProcessingFilter"> <bean id="basicProcessingFilter" class="org.springframework.security.ui.basicauth.BasicProcessingFilter">
<property name="authenticationManager"><ref local="authenticationManager"/></property> <property name="authenticationManager"><ref local="authenticationManager"/></property>
@ -57,105 +57,105 @@
<property name="realmName"><value>My Realm</value></property> <property name="realmName"><value>My Realm</value></property>
</bean> </bean>
<bean id="securityContextHolderAwareRequestFilter" class="org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter"/> <bean id="securityContextHolderAwareRequestFilter" class="org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter"/>
<bean id="rememberMeProcessingFilter" class="org.springframework.security.ui.rememberme.RememberMeProcessingFilter"> <bean id="rememberMeProcessingFilter" class="org.springframework.security.ui.rememberme.RememberMeProcessingFilter">
<property name="authenticationManager" ref="authenticationManager"/> <property name="authenticationManager" ref="authenticationManager"/>
<property name="rememberMeServices" ref="rememberMeServices"/> <property name="rememberMeServices" ref="rememberMeServices"/>
</bean> </bean>
<bean id="anonymousProcessingFilter" class="org.springframework.security.providers.anonymous.AnonymousProcessingFilter"> <bean id="anonymousProcessingFilter" class="org.springframework.security.providers.anonymous.AnonymousProcessingFilter">
<property name="key" value="changeThis"/> <property name="key" value="changeThis"/>
<property name="userAttribute" value="anonymousUser,ROLE_ANONYMOUS"/> <property name="userAttribute" value="anonymousUser,ROLE_ANONYMOUS"/>
</bean> </bean>
<bean id="exceptionTranslationFilter" class="org.springframework.security.ui.ExceptionTranslationFilter"> <bean id="exceptionTranslationFilter" class="org.springframework.security.ui.ExceptionTranslationFilter">
<property name="authenticationEntryPoint"> <property name="authenticationEntryPoint">
<bean class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint"> <bean class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<property name="loginFormUrl" value="/acegilogin.jsp"/> <property name="loginFormUrl" value="/acegilogin.jsp"/>
<property name="forceHttps" value="false"/> <property name="forceHttps" value="false"/>
</bean> </bean>
</property> </property>
<property name="accessDeniedHandler"> <property name="accessDeniedHandler">
<bean class="org.springframework.security.ui.AccessDeniedHandlerImpl"> <bean class="org.springframework.security.ui.AccessDeniedHandlerImpl">
<property name="errorPage" value="/accessDenied.jsp"/> <property name="errorPage" value="/accessDenied.jsp"/>
</bean> </bean>
</property> </property>
</bean> </bean>
<bean id="accessDecisionManager" class="org.springframework.security.vote.AffirmativeBased"> <bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
<property name="allowIfAllAbstainDecisions" value="false"/> <property name="allowIfAllAbstainDecisions" value="false"/>
<property name="decisionVoters"> <property name="decisionVoters">
<list> <list>
<bean class="org.springframework.security.vote.RoleVoter"/> <bean class="org.springframework.security.access.vote.RoleVoter"/>
<bean class="org.springframework.security.vote.AuthenticatedVoter"/> <bean class="org.springframework.security.access.vote.AuthenticatedVoter"/>
</list> </list>
</property> </property>
</bean> </bean>
<bean id="filterInvocationInterceptor" class="org.springframework.security.intercept.web.FilterSecurityInterceptor"> <bean id="filterInvocationInterceptor" class="org.springframework.security.web.intercept.FilterSecurityInterceptor">
<property name="authenticationManager" ref="authenticationManager"/> <property name="authenticationManager" ref="authenticationManager"/>
<property name="accessDecisionManager" ref="accessDecisionManager"/> <property name="accessDecisionManager" ref="accessDecisionManager"/>
<property name="objectDefinitionSource"> <property name="objectDefinitionSource">
<value><![CDATA[ <value><![CDATA[
CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
PATTERN_TYPE_APACHE_ANT PATTERN_TYPE_APACHE_ANT
/secure/extreme/**=ROLE_SUPERVISOR /secure/extreme/**=ROLE_SUPERVISOR
/secure/**=IS_AUTHENTICATED_REMEMBERED /secure/**=IS_AUTHENTICATED_REMEMBERED
/**=IS_AUTHENTICATED_ANONYMOUSLY /**=IS_AUTHENTICATED_ANONYMOUSLY
]]></value> ]]></value>
</property> </property>
</bean> </bean>
<bean id="rememberMeServices" class="org.springframework.security.ui.rememberme.TokenBasedRememberMeServices"> <bean id="rememberMeServices" class="org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices">
<property name="userDetailsService" ref="userDetailsService"/> <property name="userDetailsService" ref="userDetailsService"/>
<property name="key" value="changeThis"/> <property name="key" value="changeThis"/>
</bean> </bean>
<bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager"> <bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
<property name="providers"> <property name="providers">
<list> <list>
<ref local="daoAuthenticationProvider"/> <ref local="daoAuthenticationProvider"/>
<bean class="org.springframework.security.providers.anonymous.AnonymousAuthenticationProvider"> <bean class="org.springframework.security.authentication.AnonymousAuthenticationProvider">
<property name="key" value="changeThis"/> <property name="key" value="changeThis"/>
</bean> </bean>
<bean class="org.springframework.security.providers.rememberme.RememberMeAuthenticationProvider"> <bean class="org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationProvider">
<property name="key" value="changeThis"/> <property name="key" value="changeThis"/>
</bean> </bean>
</list> </list>
</property> </property>
</bean> </bean>
<bean id="daoAuthenticationProvider" class="org.springframework.security.providers.dao.DaoAuthenticationProvider"> <bean id="daoAuthenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="userDetailsService"/> <property name="userDetailsService" ref="userDetailsService"/>
</bean> </bean>
<!-- UserDetailsService is the most commonly frequently Acegi Security interface implemented by end users --> <!-- UserDetailsService is the most commonly frequently Acegi Security interface implemented by end users -->
<bean id="userDetailsService" class="org.springframework.security.userdetails.memory.InMemoryDaoImpl"> <bean id="userDetailsService" class="org.springframework.security.core.userdetails.memory.InMemoryDaoImpl">
<property name="userProperties"> <property name="userProperties">
<bean class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="/WEB-INF/users.properties"/> <property name="location" value="/WEB-INF/users.properties"/>
</bean> </bean>
</property> </property>
</bean> </bean>
<!-- This bean is optional; it isn't used by any other bean as it only listens and logs --> <!-- This bean is optional; it isn't used by any other bean as it only listens and logs -->
<bean id="loggerListener" class="org.springframework.security.event.authentication.LoggerListener"/> <bean id="loggerListener" class="org.springframework.security.authentication.event.LoggerListener"/>
<bean id="daacc" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/> <bean id="daacc" class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
<bean id="attributes" class="org.springframework.security.annotation.SecurityAnnotationAttributes"/> <bean id="attributes" class="org.springframework.security.access.annotation.SecurityAnnotationAttributes"/>
<bean id="objectDefinitionSource" class="org.springframework.security.intercept.method.MethodDefinitionAttributes"> <bean id="securityMetadataSource" class="org.springframework.security.access.intercept.method.MethodDefinitionAttributes">
<property name="attributes"><ref local="attributes"/></property> <property name="attributes"><ref local="attributes"/></property>
</bean> </bean>
<bean id="securityInterceptor" class="org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor"> <bean id="securityInterceptor" class="org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor">
<property name="authenticationManager"><ref local="authenticationManager"/></property> <property name="authenticationManager"><ref local="authenticationManager"/></property>
<property name="accessDecisionManager"><ref local="accessDecisionManager"/></property> <property name="accessDecisionManager"><ref local="accessDecisionManager"/></property>
<property name="objectDefinitionSource"> <property name="securityMetadataSource">
<ref local="objectDefinitionSource"/> <ref local="securityMetadataSource"/>
</property> </property>
</bean> </bean>
</beans> </beans>

View File

@ -62,7 +62,7 @@
- context. Optional unless concurrent session control is being used. - context. Optional unless concurrent session control is being used.
--> -->
<listener> <listener>
<listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class> <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener> </listener>
<!-- <!--