[parancoe] push by enricogi...@gmail.com - moved http section from webapp to the plugin on 2012-02-20 02:01 GMT

0 views
Skip to first unread message

para...@googlecode.com

unread,
Feb 19, 2012, 9:01:47 PM2/19/12
to parancoe...@googlegroups.com
Revision: 6c1023ba152a
Author: enricogiurin <enrico...@gmail.com>
Date: Sun Feb 19 18:00:42 2012
Log: moved http section from webapp to the plugin
http://code.google.com/p/parancoe/source/detail?r=6c1023ba152a

Added:
/examples/basicWebAppEvolution/src/main/resources/initialData/Authority.yml
Modified:
/examples/basicWebAppEvolution/pom.xml
/examples/basicWebAppEvolution/src/main/webapp/WEB-INF/database.xml
/examples/basicWebAppEvolution/src/main/webapp/WEB-INF/log4j.properties
/examples/basicWebAppEvolution/src/main/webapp/WEB-INF/parancoe-servlet.xml
/examples/basicWebAppEvolution/src/main/webapp/WEB-INF/web.xml

/plugins/parancoe-plugin-springsecurity-evolution/src/main/java/org/parancoe/plugins/securityevolution/SecureInterceptor.java

/plugins/parancoe-plugin-springsecurity-evolution/src/main/resources/applicationContext-plugin.xml

/plugins/parancoe-plugin-springsecurity-evolution/src/main/resources/parancoe-plugin.xml

=======================================
--- /dev/null
+++
/examples/basicWebAppEvolution/src/main/resources/initialData/Authority.yml
Sun Feb 19 18:00:42 2012
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2006-2010 The Parancoe Team <in...@parancoe.org>
+#
+# This file is part of Parancoe Plugin Spring Security Evolution.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+- &Authority-user
+ role: ROLE_USER
+
+- &Authority-admin
+ role: ROLE_ADMIN
=======================================
--- /examples/basicWebAppEvolution/pom.xml Tue Feb 7 16:22:16 2012
+++ /examples/basicWebAppEvolution/pom.xml Sun Feb 19 18:00:42 2012
@@ -31,7 +31,7 @@
</plugin>
<!-- copied from
http://blog.synyx.de/2011/10/testing-webapp-startup-on-jenkins-with-maven-tomcat-and-web-driver/
-->

- <plugin>
+ <!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
@@ -55,7 +55,7 @@
</goals>
</execution>
</executions>
- </plugin>
+ </plugin> -->
</plugins>
</build>
<repositories>
=======================================
--- /examples/basicWebAppEvolution/src/main/webapp/WEB-INF/database.xml Fri
Jan 20 09:32:50 2012
+++ /examples/basicWebAppEvolution/src/main/webapp/WEB-INF/database.xml Sun
Feb 19 18:00:42 2012
@@ -15,7 +15,7 @@
<!-- <prop
key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> -->


- <prop
key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
+ <prop
key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>

<prop key="hibernate.hbm2ddl.auto">create</prop>
<prop key="hibernate.show_sql">true</prop>
=======================================
--- /examples/basicWebAppEvolution/src/main/webapp/WEB-INF/log4j.properties
Sat Oct 11 23:29:39 2008
+++ /examples/basicWebAppEvolution/src/main/webapp/WEB-INF/log4j.properties
Sun Feb 19 18:00:42 2012
@@ -1,4 +1,4 @@
-log4j.rootLogger=ERROR, CONSOLE, MEMORY
+log4j.rootLogger=INFO, CONSOLE, MEMORY
log4j.additivity.default=false
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
@@ -21,3 +21,4 @@
#log4j.appender.SMTP.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.logger.org.parancoe=DEBUG
+log4j.logger.org.springframework=INFO
=======================================
---
/examples/basicWebAppEvolution/src/main/webapp/WEB-INF/parancoe-servlet.xml
Fri Jan 20 09:32:50 2012
+++
/examples/basicWebAppEvolution/src/main/webapp/WEB-INF/parancoe-servlet.xml
Sun Feb 19 18:00:42 2012
@@ -21,13 +21,13 @@
</bean>-->

<!-- begin security section -->
- <sec:http auto-config="true" pattern="/people/**"
use-expressions="true" access-decision-manager-ref="accessDecisionManager" >
+ <!-- <sec:http auto-config="true" pattern="/people/**"
use-expressions="true" access-decision-manager-ref="accessDecisionManager" >
<sec:intercept-url pattern="*" access="hasRole('ROLE_USER')"/>
</sec:http>

<sec:http auto-config="true" pattern="/admin/**"
use-expressions="true" access-decision-manager-ref="accessDecisionManager" >
<sec:intercept-url pattern="*" access="hasRole('ROLE_ADMIN')"/>
- </sec:http>
+ </sec:http> -->
<!--
<sec:filter-security-metadata-source
id="pluginSecurityFilterDefinitions" lowercase-comparisons="true"
path-type="ant">
<sec:intercept-url pattern="/r/person/**" access="ROLE_ADMIN,
ROLE_PARANCOE"/>
=======================================
--- /examples/basicWebAppEvolution/src/main/webapp/WEB-INF/web.xml Tue Sep
7 07:52:07 2010
+++ /examples/basicWebAppEvolution/src/main/webapp/WEB-INF/web.xml Sun Feb
19 18:00:42 2012
@@ -40,6 +40,13 @@
<filter-name>httpMethodFilter</filter-name>

<filter-class>org.parancoe.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
+
+ <!-- spring security filter definition -->
+ <filter>
+ <filter-name>springSecurityFilterChain</filter-name>
+
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
+ </filter>
+

<filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name>
@@ -50,6 +57,14 @@
<filter-name>httpMethodFilter</filter-name>
<servlet-name>parancoe</servlet-name>
</filter-mapping>
+
+ <!-- spring security filter definition -->
+ <filter-mapping>
+ <filter-name>springSecurityFilterChain</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+

<servlet>
<servlet-name>parancoe</servlet-name>
@@ -98,4 +113,7 @@
<extension>css</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
+
+
+
</web-app>
=======================================
---
/plugins/parancoe-plugin-springsecurity-evolution/src/main/java/org/parancoe/plugins/securityevolution/SecureInterceptor.java
Tue Dec 13 13:41:54 2011
+++
/plugins/parancoe-plugin-springsecurity-evolution/src/main/java/org/parancoe/plugins/securityevolution/SecureInterceptor.java
Sun Feb 19 18:00:42 2012
@@ -36,9 +36,7 @@
public class SecureInterceptor extends HandlerInterceptorAdapter {

public static final String USERNAME_LOG4J_MDC_KEY = "psec_username";
- private static final String STRATEGY_CLASS_NAME =
- "org.parancoe.plugins.securityevolution.ParancoeSecurityContextHolderStrategy";
- private Filter delegate;
+
private static final Logger logger =
Logger.getLogger(SecureInterceptor.class);

@@ -47,28 +45,19 @@
* has set.
*
*/
- public SecureInterceptor() {
-
- SecurityContextHolder.setStrategyName(STRATEGY_CLASS_NAME);
+ public SecureInterceptor() {
logger.info("SecureInterceptor set up");
-
}

/**
* Delegates request to filter chain.
*/
+
@Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse
res,
- Object handler) throws Exception {
- delegate.doFilter(req, res, new ParancoeFilterChain());
- populateLog4JMDC();
- req.getSession(false);
- if (res.isCommitted()) {
- logger.debug("Response is committed!");
- return false;
- }
+ Object handler) throws Exception {
+ populateLog4JMDC();
return true;
-
}

@Override
@@ -99,29 +88,6 @@
MDC.remove(USERNAME_LOG4J_MDC_KEY);
}

- /**
- * Inner class for basic implementation of FilterChain.
- *
- */
- private class ParancoeFilterChain implements FilterChain {
-
- public ParancoeFilterChain() {
- logger.debug("Instantiated");
- }
-
- public void doFilter(ServletRequest arg0, ServletResponse arg1)
throws
- IOException,
- ServletException {
- // TODO Auto-generated method stub
- }
- }//end of inner class
-
- public Filter getDelegate() {
- return delegate;
- }
-
- public void setDelegate(Filter delegate) {
- this.delegate = delegate;
- }
+
}//end of class

=======================================
---
/plugins/parancoe-plugin-springsecurity-evolution/src/main/resources/applicationContext-plugin.xml
Fri Jan 20 09:32:50 2012
+++
/plugins/parancoe-plugin-springsecurity-evolution/src/main/resources/applicationContext-plugin.xml
Sun Feb 19 18:00:42 2012
@@ -47,14 +47,15 @@
<bean id="userDetailsService"
class="org.parancoe.plugins.securityevolution.ParancoeUserDetailsService"/>


- <!-- <security:http auto-config="true" pattern="/admin/**"
use-expressions="true" access-decision-manager-ref="accessDecisionManager" >
+ <security:http auto-config="true" pattern="/admin/**"
use-expressions="true" access-decision-manager-ref="accessDecisionManager" >
<security:intercept-url pattern="*"
access="hasRole('ROLE_ADMIN')"/>
- </security:http> -->
-
- <!--
+ </security:http>
+
+
<security:http auto-config="true" pattern="/pages/**"
use-expressions="true" access-decision-manager-ref="accessDecisionManager" >
<security:intercept-url pattern="*" access="hasRole('ROLE_USER')"/>
- </security:http> -->
+ </security:http>
+

=======================================
---
/plugins/parancoe-plugin-springsecurity-evolution/src/main/resources/parancoe-plugin.xml
Fri Jan 20 09:32:50 2012
+++
/plugins/parancoe-plugin-springsecurity-evolution/src/main/resources/parancoe-plugin.xml
Sun Feb 19 18:00:42 2012
@@ -32,16 +32,13 @@

<!-- Interceptor specifico per questo plugin -->
<bean id="pluginSecurityInterceptor"
class="org.parancoe.plugins.securityevolution.SecureInterceptor">
- <property name="delegate">
+ <!-- <property name="delegate">
<ref bean="filterChainProxy"/>
- </property>
- </bean>
-
- <!-- to evaluate this -->
-
- <bean id="filterChainProxy"
class="org.springframework.web.filter.DelegatingFilterProxy">
-
- </bean>
+ </property> -->
+ </bean>
+
+ <!-- <bean id="filterChainProxy"
class="org.springframework.web.filter.DelegatingFilterProxy" /> -->
+


<!-- -->

Reply all
Reply to author
Forward
0 new messages