2
0
Эх сурвалжийг харах

Fixes for SEC-115. Updates to acegifier to work with Maven and new Acegi sources.

Luke Taylor 20 жил өмнө
parent
commit
ec30e8b11c

+ 20 - 0
samples/acegifier/project.xml

@@ -22,5 +22,25 @@
         <war.bundle>true</war.bundle>
       </properties>
     </dependency>
+    <dependency>
+      <groupId>jaxen</groupId>
+      <artifactId>jaxen</artifactId>
+      <version>1.1-beta-8</version>
+      <type>jar</type>
+      <url>http://www.jaxen.org</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>freemarker</groupId>
+      <artifactId>freemarker</artifactId>
+      <version>2.3.4</version>
+      <type>jar</type>
+      <url>http://www.freemarker.org/</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
   </dependencies>
 </project>

+ 10 - 0
samples/acegifier/src/main/resources/web-to-spring.xsl

@@ -57,6 +57,10 @@
 <xsl:template match = "web-app">
 
 <beans>
+    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
+      <property name="basename"><value>messages</value></property>
+    </bean>
+    <xsl:text>&#xA;&#xA;</xsl:text>
     <xsl:call-template name="filter-to-bean-proxy"/>
     <xsl:call-template name="authentication-beans"/>
     <xsl:apply-templates select="./login-config"/>
@@ -72,6 +76,7 @@
     <xsl:comment>======================== AUTHENTICATION =======================</xsl:comment>
     
     <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
+      <property name="messageSource"><ref local="messageSource"/></property>
       <property name="providers">
          <list>
             <ref local="daoAuthenticationProvider"/>
@@ -82,6 +87,7 @@
     </bean>
     <xsl:text>&#xA;&#xA;</xsl:text>
     <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
+      <property name="messageSource"><ref local="messageSource"/></property>
       <property name="authenticationDao"><ref local="inMemoryDaoImpl"/></property>
       <!-- property name="userCache"><ref local="userCache"/></property-->
     </bean>
@@ -104,6 +110,7 @@
     <xsl:text>&#xA;&#xA;</xsl:text>
 
     <bean id="anonymousAuthenticationProvider" class="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider">
+      <property name="messageSource"><ref local="messageSource"/></property>
       <property name="key"><value>foobar</value></property>
     </bean>
     <xsl:text>&#xA;&#xA;</xsl:text>
@@ -123,6 +130,7 @@
     <xsl:text>&#xA;&#xA;</xsl:text>
 
     <bean id="rememberMeAuthenticationProvider" class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider">
+      <property name="messageSource"><ref local="messageSource"/></property>
       <property name="key"><value>springRocks</value></property>
     </bean>
     <xsl:text>&#xA;&#xA;</xsl:text>
@@ -220,6 +228,7 @@
     
 <xsl:template name="filter-invocation-interceptor">
   <bean id="httpRequestAccessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
+    <property name="messageSource"><ref local="messageSource"/></property>
     <property name="allowIfAllAbstainDecisions"><value>false</value></property>
     <property name="decisionVoters">
       <list>
@@ -241,6 +250,7 @@
        removing anonymous access where necessary.
     </xsl:comment>
   <bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
+    <property name="messageSource"><ref local="messageSource"/></property>
     <property name="authenticationManager"><ref bean="authenticationManager"/></property>
     <property name="accessDecisionManager"><ref local="httpRequestAccessDecisionManager"/></property>
     <property name="objectDefinitionSource">

+ 3 - 3
samples/acegifier/src/webapp/WEB-INF/acegifier-servlet.xml

@@ -8,9 +8,9 @@
  -->
 
 <beans>
-	<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
-		<property name="basename"><value>messages</value></property>
-	</bean>
+    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
+      <property name="basename"><value>messages</value></property>
+    </bean>
 
     <bean id="conversionController" class="acegifier.web.AcegifierController">
         <property name="formView" value="acegificationForm" />