You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2007/02/19 14:11:18 UTC

svn commit: r509192 - in /cocoon/trunk: blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/resources/META-INF/cocoon/avalon/ blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/ blocks/cocoon-a...

Author: cziegeler
Date: Mon Feb 19 05:11:17 2007
New Revision: 509192

URL: http://svn.apache.org/viewvc?view=rev&rev=509192
Log:
Apply patch from Felix Knecht to make authentication samples work.

Added:
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/welcome.xml
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/avalon/
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/avalon/auth-manager.xconf
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/spring/
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/spring/cocoon-authentication-fw-sample-blockServlet.xml
Removed:
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/config/
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/flow.xmap
Modified:
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-authentication-fw.xconf
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/authentication-fw.xsamples
    cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/trunk/core/cocoon-webapp/pom.xml

Modified: cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-authentication-fw.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-authentication-fw.xconf?view=diff&rev=509192&r1=509191&r2=509192
==============================================================================
--- cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-authentication-fw.xconf (original)
+++ cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-authentication-fw.xconf Mon Feb 19 05:11:17 2007
@@ -24,8 +24,6 @@
   <!-- Include roles -->
   <include src="resource://org/apache/cocoon/webapps/authentication/authentication.roles"/>
   
-  <authentication-manager logger="core.authentication-manager"/>
-
   <session-context-providers>
       <component-instance class="org.apache.cocoon.webapps.authentication.context.AuthenticationContextProvider" name="authentication"/>
   </session-context-providers>

Modified: cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/authentication-fw.xsamples
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/authentication-fw.xsamples?view=diff&rev=509192&r1=509191&r2=509192
==============================================================================
--- cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/authentication-fw.xsamples (original)
+++ cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/authentication-fw.xsamples Mon Feb 19 05:11:17 2007
@@ -19,13 +19,9 @@
 <xsamples xpath="/samples" unless="group[@name='Authentication Framework']">
 
   <group name="Authentication Framework">
-    <sample name="Authentication Framework Block" href="authentication-fw/login">
-      This is a demo of the authentication framework integrated into Cocoon.
-    </sample>
-    <sample name="Authentication Framework Block (with Flow)" href="authentication-fw/flow/login">
-      This is the same demo of the authentication framework, but using flow
-      instead of actions.
+    <sample name="Authentication Framework Block">
+      Cocoon Authentication Framework examples (deprecated, use <a href="cocoon-auth-sample/">Cocoon Auth Block</a> instead).
     </sample>
   </group>
-  
+
 </xsamples>

Modified: cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/sitemap.xmap?view=diff&rev=509192&r1=509191&r2=509192
==============================================================================
--- cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/sitemap.xmap Mon Feb 19 05:11:17 2007
@@ -24,16 +24,23 @@
 
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 
+  <!-- =========================== Flowscripts ================================= -->
+  <map:flow language="javascript" />
+
   <!-- =========================== Pipelines ================================= -->
   <map:pipelines>
     <map:pipeline>
-      <map:match pattern="flow/**">
-        <map:mount src="flow.xmap" uri-prefix="flow"/>
-      </map:match>
-      
       <map:match pattern="">
-        <map:redirect-to uri="login"/>
+        <map:generate src="welcome.xml" />
+        <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
+          <map:parameter name="contextPath" value="{request:contextPath}" />
+        </map:transform>
+        <map:serialize />
       </map:match>
+    </map:pipeline>
+
+    <!-- Non flow part -->
+    <map:pipeline>
 
       <!-- ================= -->
       <!-- Simple login page -->
@@ -41,13 +48,13 @@
       <map:match pattern="login">
         <!-- if we are already logged in, redirect to the protected document -->
         <map:act type="auth-loggedIn">
-          <map:parameter name="handler" value="demohandler"/> 
-          <map:redirect-to uri="protected"/>
-        </map:act> 
-        <map:generate src="docs/login.xml"/>
-        <map:transform src="stylesheets/simple-page2html.xsl"/>
-        <map:transform type="encodeURL"/>
-        <map:serialize/>
+          <map:parameter name="handler" value="demohandler" />
+          <map:redirect-to uri="protected" />
+        </map:act>
+        <map:generate src="docs/login.xml" />
+        <map:transform src="stylesheets/simple-page2html.xsl" />
+        <map:transform type="encodeURL" />
+        <map:serialize />
       </map:match>
 
       <!-- ========================================= -->
@@ -56,12 +63,12 @@
       <map:match pattern="do-login">
         <!-- try to login -->
         <map:act type="auth-login">
-          <map:parameter name="handler" value="demohandler"/>
-          <map:parameter name="parameter_name" value="{request-param:username}"/>
-          <map:redirect-to uri="protected"/>
+          <map:parameter name="handler" value="demohandler" />
+          <map:parameter name="parameter_name" value="{request-param:username}" />
+          <map:redirect-to uri="protected" />
         </map:act>
         <!-- something was wrong, try it again -->
-        <map:redirect-to uri="login"/>
+        <map:redirect-to uri="login" />
       </map:match>
 
       <!-- ================ -->
@@ -69,16 +76,16 @@
       <!-- ================ -->
       <map:match pattern="protected">
         <map:act type="auth-protect">
-          <map:parameter name="handler" value="demohandler"/> 
+          <map:parameter name="handler" value="demohandler" />
 
-          <map:generate src="docs/protected.xml"/>
-          <map:transform type="session"/>
-          <map:transform src="stylesheets/simple-page2html.xsl"/>
-          <map:transform type="encodeURL"/>
-          <map:serialize/>
+          <map:generate src="docs/protected.xml" />
+          <map:transform type="session" />
+          <map:transform src="stylesheets/simple-page2html.xsl" />
+          <map:transform type="encodeURL" />
+          <map:serialize />
         </map:act>
         <!-- something was wrong, redirect to login page -->
-        <map:redirect-to uri="login"/>
+        <map:redirect-to uri="login" />
       </map:match>
 
       <!-- ========================================= -->
@@ -86,22 +93,84 @@
       <!-- ========================================= -->
       <map:match pattern="do-logout">
         <map:act type="auth-protect">
-          <map:parameter name="handler" value="demohandler"/> 
-
-          <map:act type="auth-logout"/>
+          <map:parameter name="handler" value="demohandler" />
+          <map:act type="auth-logout" />
         </map:act>
-        <map:redirect-to uri="login"/>
+        <map:redirect-to uri="login" />
+      </map:match>
+    </map:pipeline>
+
+    <!-- Flow part -->
+    <map:pipeline>
+      <!-- ================= -->
+      <!-- Simple login page -->
+      <!-- ================= -->
+      <map:match pattern="flow/login">
+        <map:call function="isLoggedIn">
+          <map:parameter name="handler" value="flowdemohandler" />
+          <map:parameter name="protected-redirect" value="protected" />
+          <map:parameter name="failure-internal" value="flow/internal/login" />
+        </map:call>
+      </map:match>
+
+      <!-- ========================================= -->
+      <!-- Form target which performs auth service   -->
+      <!-- ========================================= -->
+      <map:match pattern="flow/do-login">
+        <!-- try to login -->
+        <map:call function="login">
+          <map:parameter name="handler" value="flowdemohandler" />
+          <map:parameter name="parameter_name" value="{request-param:username}" />
+          <map:parameter name="protected-redirect" value="protected" />
+          <map:parameter name="failure-redirect" value="login" />
+        </map:call>
+      </map:match>
+
+      <!-- ================ -->
+      <!-- Protected area   -->
+      <!-- ================ -->
+      <map:match pattern="flow/protected">
+        <map:call function="protect">
+          <map:parameter name="handler" value="flowdemohandler" />
+          <map:parameter name="protected-internal" value="flow/internal/protected" />
+          <map:parameter name="failure-redirect" value="login" />
+        </map:call>
+      </map:match>
+
+      <!-- ========================================= -->
+      <!-- Logout link which invalidates the session -->
+      <!-- ========================================= -->
+      <map:match pattern="flow/do-logout">
+        <map:call function="logout">
+          <map:parameter name="handler" value="flowdemohandler" />
+          <map:parameter name="failure-redirect" value="login" />
+        </map:call>
       </map:match>
     </map:pipeline>
 
     <map:pipeline internal-only="true">
       <!-- This is the authentication resource -->
       <map:match pattern="authenticate">
-        <map:generate src="docs/userlist.xml"/>
+        <map:generate src="docs/userlist.xml" />
         <map:transform src="stylesheets/authenticate.xsl">
-          <map:parameter name="use-request-parameters" value="true"/>
+          <map:parameter name="use-request-parameters" value="true" />
         </map:transform>
-        <map:serialize type="xml"/>
+        <map:serialize type="xml" />
+      </map:match>
+
+      <map:match pattern="flow/internal/login">
+        <map:generate src="docs/login.xml" />
+        <map:transform src="stylesheets/simple-page2html.xsl" />
+        <map:transform type="encodeURL" />
+        <map:serialize />
+      </map:match>
+
+      <map:match pattern="flow/internal/protected">
+        <map:generate src="docs/protected.xml" />
+        <map:transform type="session" />
+        <map:transform src="stylesheets/simple-page2html.xsl" />
+        <map:transform type="encodeURL" />
+        <map:serialize />
       </map:match>
     </map:pipeline>
 

Added: cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/welcome.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/welcome.xml?view=auto&rev=509192
==============================================================================
--- cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/welcome.xml (added)
+++ cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/COB-INF/welcome.xml Mon Feb 19 05:11:17 2007
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<!--
+  @version $Id: welcome.xml 491930 2007-01-02 20:44:30Z jeremy $
+-->
+<samples name="Authentication Framework Block Samples" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <group name="Back">
+  <sample name="Back" href="../..">to Cocoon Samples main page</sample>
+  <sample name="Back" href="..">to Cocoon Blocks Samples main page</sample>
+  <sample name="Cocoon Forms Documentation" href="http://cocoon.apache.org/2.1/userdocs/basics/index.html">
+    Documentation is available on the Cocoon site.
+  </sample>
+ </group>
+
+  <group name="Authentication Framework">
+    <sample name="Authentication Framework Block" href="login">
+      This is a demo of the authentication framework integrated into Cocoon.
+    </sample>
+    <sample name="Authentication Framework Block (with Flow)" href="flow/login">
+      This is the same demo of the authentication framework, but using flow
+      instead of actions.
+    </sample>
+  </group>
+</samples>

Added: cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/avalon/auth-manager.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/avalon/auth-manager.xconf?view=auto&rev=509192
==============================================================================
--- cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/avalon/auth-manager.xconf (added)
+++ cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/avalon/auth-manager.xconf Mon Feb 19 05:11:17 2007
@@ -0,0 +1,67 @@
+<?xml version="1.0"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+<!--+
+    | This is the configuration for the authentication-fw.
+    |
+    | @version $Id: auth-manager.xconf 496350 2007-01-15 14:54:40Z cziegeler $
+    +-->
+<components>
+  <authentication-manager logger="core.authentication-manager">
+    <handlers>
+      <!-- A handler is responsible for protecting documents (pipelines).
+           The handler requires three configuration values. One of them is
+           a unique name that is used as a reference for the handler.
+           The other values are documented inline below.
+      -->
+      <handler name="demohandler">
+        <!-- The redirect-to configuration defines a pipeline that is called
+                 whenever a not authenticated user tries to access a protected
+                 document (pipeline) -->
+        <redirect-to uri="cocoon:/login"/>
+        <!-- The authentication configuration defines the authentication process.
+                 In this example, an internal pipeline "authenticate" is called.
+                 This pipeline gets all necessary information like user name and
+                 password as parameters and tries to authenticate this user.
+                 On successful authentication the pipeline delivers a specific
+                 XML format.
+        -->
+        <authentication uri="cocoon:raw:/authenticate"/>
+        <!-- In addition you can specifiy a logout-uri parameter above. Then
+                 the pipeline denoted by that parameter is called on logout.
+        -->
+      </handler>
+      <handler name="flowdemohandler">
+        <!-- The redirect-to configuration defines a pipeline that is called
+                 whenever a not authenticated user tries to access a protected
+                 document (pipeline) -->
+        <redirect-to uri="cocoon:/login"/>
+        <!-- The authentication configuration defines the authentication process.
+                 In this example, an internal pipeline "authenticate" is called.
+                 This pipeline gets all necessary information like user name and
+                 password as parameters and tries to authenticate this user.
+                 On successful authentication the pipeline delivers a specific
+                 XML format.
+        -->
+        <authentication uri="cocoon:raw:/authenticate"/>
+        <!-- In addition you can specifiy a logout-uri parameter above. Then
+             the pipeline denoted by that parameter is called on logout.
+        -->
+      </handler>
+    </handlers>
+  </authentication-manager>
+</components>

Added: cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/spring/cocoon-authentication-fw-sample-blockServlet.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/spring/cocoon-authentication-fw-sample-blockServlet.xml?view=auto&rev=509192
==============================================================================
--- cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/spring/cocoon-authentication-fw-sample-blockServlet.xml (added)
+++ cocoon/trunk/blocks/cocoon-authentication-fw/cocoon-authentication-fw-sample/src/main/resources/META-INF/cocoon/spring/cocoon-authentication-fw-sample-blockServlet.xml Mon Feb 19 05:11:17 2007
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You 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.
+-->
+
+<!-- @version $Id$ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:servlet="http://cocoon.apache.org/schema/servlet"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://cocoon.apache.org/schema/servlet http://cocoon.apache.org/schema/servlet/cocoon-servlet-1.0.xsd">
+
+    <bean id="org.apache.cocoon.authentication_fw.sample.servlet" class="org.apache.cocoon.sitemap.SitemapServlet">
+        <servlet:context mount-path="/cocoon-authentication-fw-sample" context-path="blockcontext:/cocoon-authentication-fw-sample/"/>
+    </bean>
+</beans>

Modified: cocoon/trunk/core/cocoon-webapp/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/pom.xml?view=diff&rev=509192&r1=509191&r2=509192
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/pom.xml (original)
+++ cocoon/trunk/core/cocoon-webapp/pom.xml Mon Feb 19 05:11:17 2007
@@ -116,6 +116,11 @@
         </dependency>
         <dependency>
           <groupId>org.apache.cocoon</groupId>
+          <artifactId>cocoon-authentication-fw-sample</artifactId>
+          <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.cocoon</groupId>
           <artifactId>cocoon-databases-sample</artifactId>
           <version>1.0.0-SNAPSHOT</version>
         </dependency>