continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From car...@apache.org
Subject svn commit: r418822 - in /maven/continuum/branches/continuum-acegi: ./ continuum-webapp/ continuum-webapp/src/main/webapp/ continuum-webapp/src/main/webapp/WEB-INF/ continuum-webapp/src/main/webapp/navigations/ continuum-webapp/src/main/webapp/secure/
Date Mon, 03 Jul 2006 18:26:42 GMT
Author: carlos
Date: Mon Jul  3 11:26:42 2006
New Revision: 418822

URL: http://svn.apache.org/viewvc?rev=418822&view=rev
Log:
Reapply rev. 365925

Added:
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/applicationContext-acegi-security.xml
  (with props)
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/logoff.jsp 
 (with props)
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/secure/
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/secure/debug.jsp
  (with props)
Modified:
    maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/web.xml
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/login.jsp
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/navigations/DefaultTop.jsp
    maven/continuum/branches/continuum-acegi/pom.xml

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml?rev=418822&r1=418821&r2=418822&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml (original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/pom.xml Mon Jul  3 11:26:42
2006
@@ -1,4 +1,9 @@
-<project>
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
   <parent>
     <artifactId>continuum-parent</artifactId>
     <groupId>org.apache.maven.continuum</groupId>

Added: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/applicationContext-acegi-security.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/applicationContext-acegi-security.xml?rev=418822&view=auto
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/applicationContext-acegi-security.xml
(added)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/applicationContext-acegi-security.xml
Mon Jul  3 11:26:42 2006
@@ -0,0 +1,193 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<!--
+  - Application context containing authentication, channel
+  - security and web URI beans.
+  -
+  - Only used by "filter" artifact.
+  -->
+
+<beans>
+
+   <!-- ======================== FILTER CHAIN ======================= -->
+
+    <!--  if you wish to use channel security, add "channelProcessingFilter," in front
+          of "httpSessionContextIntegrationFilter" in the list below -->
+    <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
+      <property name="filterInvocationDefinitionSource">
+         <value>
+            CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
+            PATTERN_TYPE_APACHE_ANT
+            /**=httpSessionContextIntegrationFilter,authenticationProcessingFilter,securityEnforcementFilter
+         </value>
+      </property>
+    </bean>
+
+   <!-- ======================== AUTHENTICATION ======================= -->
+
+   <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
+      <property name="providers">
+         <list>
+            <ref local="daoAuthenticationProvider"/>
+         </list>
+      </property>
+   </bean>
+
+   <bean id="dao" class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
+      <property name="userMap">
+         <value>
+      marissa=koala,ROLE_USER,ROLE_SUPERVISOR
+      dianne=emu,ROLE_USER
+      scott=wombat,ROLE_USER
+         </value>
+      </property>
+   </bean>
+
+<!-- 
+   <bean id="dao" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
+      <property name="dataSource"><ref bean="dataSource"/></property>
+   </bean>
+
+   <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+      <property name="driverClassName">
+         <value>org.hsqldb.jdbcDriver</value>
+      </property>
+      <property name="url">
+         <value>jdbc:hsqldb:mem:contacts</value>
+      </property>
+      <property name="username">
+         <value>sa</value>
+      </property>
+      <property name="password">
+         <value></value>
+      </property>
+   </bean>
+
+   <bean id="passwordEncoder" class="org.acegisecurity.providers.encoding.Md5PasswordEncoder"/>
+-->
+
+   <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
+      <property name="userDetailsService"><ref local="dao"/></property>
+      <!-- <property name="userCache"><ref local="userCache"/></property>
-->
+      <!-- <property name="passwordEncoder"><ref local="passwordEncoder"/></property>
-->
+   </bean>
+
+<!--
+   <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>
+    
+   <bean id="userCacheBackend" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+      <property name="cacheManager">
+         <ref local="cacheManager"/>
+      </property>
+      <property name="cacheName">
+         <value>userCache</value>
+      </property>
+   </bean>
+   
+   <bean id="userCache" class="org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">
+      <property name="cache"><ref local="userCacheBackend"/></property>
+   </bean>
+-->
+
+   <!-- Automatically receives AuthenticationEvent messages -->
+   <bean id="loggerListener" class="org.acegisecurity.event.authentication.LoggerListener"/>
+
+   <!-- basic authentication
+   <bean id="basicProcessingFilter" class="org.acegisecurity.ui.basicauth.BasicProcessingFilter">
+      <property name="authenticationManager"><ref local="authenticationManager"/></property>
+      <property name="authenticationEntryPoint"><ref local="basicProcessingFilterEntryPoint"/></property>
+   </bean>
+
+   <bean id="basicProcessingFilterEntryPoint" class="org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint">
+      <property name="realmName"><value>Continuum</value></property>
+   </bean>
+
+   <bean id="anonymousProcessingFilter" class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
+      <property name="key"><value>foobar</value></property>
+      <property name="userAttribute"><value>anonymousUser,ROLE_ANONYMOUS</value></property>
+   </bean>
+
+   <bean id="anonymousAuthenticationProvider" class="org.acegisecurity.providers.anonymous.AnonymousAuthenticationProvider">
+      <property name="key"><value>foobar</value></property>
+   </bean>
+   -->
+
+   <bean id="httpSessionContextIntegrationFilter" class="org.acegisecurity.context.HttpSessionContextIntegrationFilter">
+   </bean>
+
+   <!-- 
+   <bean id="rememberMeProcessingFilter" class="org.acegisecurity.ui.rememberme.RememberMeProcessingFilter">
+      <property name="rememberMeServices"><ref local="rememberMeServices"/></property>
+   </bean>
+
+   <bean id="rememberMeServices" class="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices">
+      <property name="userDetailsService"><ref local="dao"/></property>
+      <property name="key"><value>springRocks</value></property>
+   </bean>
+   
+   <bean id="rememberMeAuthenticationProvider" class="org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider">
+      <property name="key"><value>springRocks</value></property>
+   </bean>
+   -->
+
+   <!-- ===================== HTTP REQUEST SECURITY ==================== -->
+
+   <bean id="securityEnforcementFilter" class="org.acegisecurity.intercept.web.SecurityEnforcementFilter">
+      <property name="filterSecurityInterceptor"><ref local="filterInvocationInterceptor"/></property>
+      <property name="authenticationEntryPoint"><ref local="authenticationProcessingFilterEntryPoint"/></property>
+   </bean>
+
+   <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
+      <property name="authenticationManager"><ref bean="authenticationManager"/></property>
+      <property name="authenticationFailureUrl"><value>/login!default.action?login_error=1</value></property>
+      <property name="defaultTargetUrl"><value>/</value></property>
+      <property name="filterProcessesUrl"><value>/j_acegi_security_check</value></property>
+      <!-- <property name="rememberMeServices"><ref local="rememberMeServices"/></property>
-->
+   </bean>
+
+   <bean id="authenticationProcessingFilterEntryPoint" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
+      <property name="loginFormUrl"><value>/login!default.action</value></property>
+      <property name="forceHttps"><value>false</value></property>
+   </bean>
+
+   <bean id="httpRequestAccessDecisionManager" class="org.acegisecurity.vote.AffirmativeBased">
+      <property name="allowIfAllAbstainDecisions"><value>false</value></property>
+      <property name="decisionVoters">
+         <list>
+            <ref bean="roleVoter"/>
+         </list>
+      </property>
+   </bean>
+
+   <!-- Note the order that entries are placed against the objectDefinitionSource is critical.
+        The FilterSecurityInterceptor will work from the top of the list down to the FIRST
pattern that matches the request URL.
+        Accordingly, you should place MOST SPECIFIC (ie a/b/c/d.*) expressions first, with
LEAST SPECIFIC (ie a/.*) expressions last -->
+   <bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
+      <property name="authenticationManager"><ref bean="authenticationManager"/></property>
+      <property name="accessDecisionManager"><ref local="httpRequestAccessDecisionManager"/></property>
+      <property name="objectDefinitionSource">
+         <value>
+                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
+                PATTERN_TYPE_APACHE_ANT
+                /secure/**=ROLE_USER
+         </value>
+      </property>
+   </bean>
+
+   <!-- Filter used to switch the user context. Note: the switch and exit url must be
secured 
+        based on the role granted the ability to 'switch' to another user -->
+   <!-- In this example 'marissa' has ROLE_SUPERVISOR that can switch to regular ROLE_USER(s)
-->
+   <!--
+   <bean id="switchUserProcessingFilter" class="org.acegisecurity.ui.switchuser.SwitchUserProcessingFilter">
+      <property name="userDetailsService" ref="dao" />
+      <property name="switchUserUrl"><value>/j_acegi_switch_user</value></property>
+      <property name="exitUserUrl"><value>/j_acegi_exit_user</value></property>
+      <property name="targetUrl"><value>/acegi-security-sample-contacts-filter/secure/index.htm</value></property>
+   </bean>    
+   -->
+
+   <!-- An access decision voter that reads ROLE_* configuration settings -->
+   <bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter"/>
+
+</beans>

Propchange: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/applicationContext-acegi-security.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/applicationContext-acegi-security.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/web.xml?rev=418822&r1=418821&r2=418822&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/web.xml
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/WEB-INF/web.xml
Mon Jul  3 11:26:42 2006
@@ -6,7 +6,7 @@
 
 <web-app>
 
-  <display-name>Plexus and WebWork Test App</display-name>
+  <display-name>Continuum</display-name>
 
   <context-param>
     <param-name>extremecomponentsPreferencesLocation</param-name>
@@ -18,6 +18,26 @@
     <param-value>localization/Continuum</param-value>
   </context-param>
 
+  <!--
+    - Location of the XML file that defines the root application context
+    - Applied by ContextLoaderListener.
+    -->
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>
+      /WEB-INF/applicationContext-acegi-security.xml
+    </param-value>
+  </context-param>
+
+  <filter>
+    <filter-name>Acegi Filter Chain Proxy</filter-name>
+    <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
+    <init-param>
+      <param-name>targetClass</param-name>
+      <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
+    </init-param>
+  </filter>
+
   <!-- this should be before the webwork filter -->
   <filter>
     <filter-name>plexus</filter-name>
@@ -39,6 +59,11 @@
     <filter-class>com.opensymphony.webwork.dispatcher.FilterDispatcher</filter-class>
   </filter>
 
+  <filter-mapping>
+    <filter-name>Acegi Filter Chain Proxy</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
   <!-- this should be before the webwork filter -->
   <filter-mapping>
     <filter-name>plexus</filter-name>
@@ -59,6 +84,15 @@
     <filter-name>webwork</filter-name>
     <url-pattern>/*</url-pattern>
   </filter-mapping>
+
+  <!--
+    - Loads the root application context of this web app at startup.
+    - The application context is then available via 
+    - WebApplicationContextUtils.getWebApplicationContext(servletContext).
+    -->
+  <listener>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
 
   <listener>
     <listener-class>org.codehaus.plexus.xwork.PlexusLifecycleListener</listener-class>

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/login.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/login.jsp?rev=418822&r1=418821&r2=418822&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/login.jsp (original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/login.jsp Mon
Jul  3 11:26:42 2006
@@ -8,12 +8,21 @@
     <body>
       <div id="axial" class="h3">
         <h3><ww:text name="login.section.title"/></h3>
+
+        <%-- TODO check parameter login_error, when = 1 means that there was an error
+        This is how I did with JSTL
+
+        <c:if test="${not empty param.login_error}">
+          login error
+        </c:if>
+        --%>
+
         <div class="axial">
-        <ww:form action="login" method="post">
+        <ww:form action="j_acegi_security_check" method="post">
           <table>
             <tbody>
-              <ww:textfield label="%{getText('login.username')}" name="username" required="true"/>
-              <ww:password label="%{getText('login.password')}" name="password" required="true"/>
+              <ww:textfield label="%{getText('login.username')}" name="j_username" required="true"/>
+              <ww:password label="%{getText('login.password')}" name="j_password" required="true"/>
               <ww:checkbox label="%{getText('login.rememberMe')}" name="rememberMe" value="rememberMe"
fieldValue="true"/>
             </tbody>
           </table>
@@ -21,7 +30,7 @@
             <c1:submitcancel value="%{getText('login.submit')}" cancel="%{getText('cancel')}"/>
           </div>
         </ww:form>
-        </div>
+      </div>
       </div>
     </body>
   </ww:i18n>

Added: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/logoff.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/logoff.jsp?rev=418822&view=auto
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/logoff.jsp (added)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/logoff.jsp Mon
Jul  3 11:26:42 2006
@@ -0,0 +1,9 @@
+<%@ page import="javax.servlet.http.Cookie" %>
+<%@ page import="org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices" %>
+<%
+session.invalidate();
+Cookie terminate = new Cookie(TokenBasedRememberMeServices.ACEGI_SECURITY_HASHED_REMEMBER_ME_COOKIE_KEY,
null);
+terminate.setMaxAge(0);
+response.addCookie(terminate);
+response.sendRedirect("index.jsp");
+%>

Propchange: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/logoff.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/logoff.jsp
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/navigations/DefaultTop.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/navigations/DefaultTop.jsp?rev=418822&r1=418821&r2=418822&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/navigations/DefaultTop.jsp
(original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/navigations/DefaultTop.jsp
Mon Jul  3 11:26:42 2006
@@ -1,4 +1,6 @@
 <%@ taglib uri="/webwork" prefix="ww" %>
+<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
+
 <ww:i18n name="localization.Continuum">
 <div id="banner">
   <table border="1" cellpadding="8" cellspacing="0" width="100%">

Added: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/secure/debug.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/secure/debug.jsp?rev=418822&view=auto
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/secure/debug.jsp
(added)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/secure/debug.jsp
Mon Jul  3 11:26:42 2006
@@ -0,0 +1,64 @@
+<%@ page import="org.acegisecurity.context.SecurityContextHolder" %>
+<%@ page import="org.acegisecurity.context.SecurityContextHolder" %>
+<%@ page import="org.acegisecurity.Authentication" %>
+<%@ page import="org.acegisecurity.GrantedAuthority" %>
+<%@ page import="org.acegisecurity.adapters.AuthByAdapter" %>
+
+<% 
+		Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+		if (auth != null) { %>
+			Authentication object is of type: <%= auth.getClass().getName() %><BR><BR>
+			Authentication object as a String: <%= auth.toString() %><BR><BR>
+			
+			Authentication object holds the following granted authorities:<BR><BR>
+<%			GrantedAuthority[] granted = auth.getAuthorities();
+			for (int i = 0; i < granted.length; i++) { %>
+				<%= granted[i].toString() %> (getAuthority(): <%= granted[i].getAuthority()
%>)<BR>
+<%			}
+
+			if (auth instanceof AuthByAdapter) { %>
+				<BR><B>SUCCESS! Your container adapter appears to be properly configured!</B><BR><BR>
+<%			} else { %>
+				<BR><B>SUCCESS! Your web filters appear to be properly configured!</B><BR>
+<%			}
+			
+		} else { %>
+			Authentication object is null.<BR>
+			This is an error and your Acegi Security application will not operate properly until corrected.<BR><BR>
+<%		}
+%>
+<%@ page import="org.acegisecurity.Authentication" %>
+<%@ page import="org.acegisecurity.GrantedAuthority" %>
+<%@ page import="org.acegisecurity.adapters.AuthByAdapter" %>
+
+<% 
+		Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+		if (auth != null) { %>
+			Authentication object is of type: <%= auth.getClass().getName() %><BR><BR>
+			Authentication object as a String: <%= auth.toString() %><BR><BR>
+			
+			Authentication object holds the following granted authorities:<BR><BR>
+<%			GrantedAuthority[] granted = auth.getAuthorities();
+			for (int i = 0; i < granted.length; i++) { %>
+				<%= granted[i].toString() %> (getAuthority(): <%= granted[i].getAuthority()
%>)<BR>
+<%			}
+
+			if (auth instanceof AuthByAdapter) { %>
+				<BR><B>SUCCESS! Your container adapter appears to be properly configured!</B><BR><BR>
+<%			} else { %>
+				<BR><B>SUCCESS! Your web filters appear to be properly configured!</B><BR>
+<%			}
+			
+		} else { %>
+			Authentication object is null.<BR>
+			This is an error and your Acegi Security application will not operate properly until corrected.<BR><BR>
+<%		}
+%>
+
+
+<%-- other way to access the info using taglibs
+
+  <c:set var="authentication" value="${sessionScope['ACEGI_SECURITY_AUTHENTICATION']}"/>
+  user: ${authentication.principal}
+
+--%>
\ No newline at end of file

Propchange: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/secure/debug.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/secure/debug.jsp
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/continuum/branches/continuum-acegi/pom.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/pom.xml?rev=418822&r1=418821&r2=418822&view=diff
==============================================================================
--- maven/continuum/branches/continuum-acegi/pom.xml (original)
+++ maven/continuum/branches/continuum-acegi/pom.xml Mon Jul  3 11:26:42 2006
@@ -404,6 +404,12 @@
         <artifactId>plexus-security-summit</artifactId>
         <version>1.0-alpha-3</version>
       </dependency>
+      <dependency>
+        <groupId>org.acegisecurity</groupId>
+        <artifactId>acegi-security</artifactId>
+        <version>1.0.1</version>
+        <scope>runtime</scope>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 </project>



Mime
View raw message