You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by ra...@apache.org on 2010/11/21 11:57:42 UTC

svn commit: r1037414 - in /lenya/branches/BRANCH_2_0_X/src: modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java modules/webdav/webdav.js pubs/default/sitemap.xmap webapp/lenya/config/sitemap/pipelines.xmap

Author: rainer
Date: Sun Nov 21 10:57:42 2010
New Revision: 1037414

URL: http://svn.apache.org/viewvc?rev=1037414&view=rev
Log:
WebDAV Fix for 

    https://issues.apache.org/bugzilla/show_bug.cgi?id=42854

Catch AccessControlException raised when neither username nor password are set.
Fix sitemaps and webdav.js.

Modified:
    lenya/branches/BRANCH_2_0_X/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java
    lenya/branches/BRANCH_2_0_X/src/modules/webdav/webdav.js
    lenya/branches/BRANCH_2_0_X/src/pubs/default/sitemap.xmap
    lenya/branches/BRANCH_2_0_X/src/webapp/lenya/config/sitemap/pipelines.xmap   (contents, props changed)

Modified: lenya/branches/BRANCH_2_0_X/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java?rev=1037414&r1=1037413&r2=1037414&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java (original)
+++ lenya/branches/BRANCH_2_0_X/src/modules-core/ac/java/src/org/apache/lenya/cms/cocoon/acting/DelegatingAuthenticatorAction.java Sun Nov 21 10:57:42 2010
@@ -29,6 +29,8 @@ import org.apache.cocoon.environment.Red
 import org.apache.cocoon.environment.Request;
 import org.apache.cocoon.environment.SourceResolver;
 
+import org.apache.lenya.ac.AccessControlException;
+
 /**
  * Authenticator action that delegates the authentication to an access controller.
  */
@@ -49,13 +51,19 @@ public class DelegatingAuthenticatorActi
 
         Request request = ObjectModelHelper.getRequest(objectModel);
         Map result = null;
-        if (getAccessController().authenticate(request)) {
-            getLogger().debug("Authentication successful.");
-            result = Collections.EMPTY_MAP;
-        }
-        else {
-            getLogger().debug("Authentication failed.");
-        }
+
+	try {
+	    if (getAccessController().authenticate(request)) {
+		getLogger().debug("Authentication successful.");
+		result = Collections.EMPTY_MAP;
+	    }
+	    else {
+		getLogger().debug("Authentication failed.");
+	    }
+	}
+	catch (AccessControlException e) {
+	    getLogger().debug("Authentication failed due to AccessControlException: " + e.getMessage());
+	}
         return result;
     }
 

Modified: lenya/branches/BRANCH_2_0_X/src/modules/webdav/webdav.js
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/modules/webdav/webdav.js?rev=1037414&r1=1037413&r2=1037414&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/modules/webdav/webdav.js (original)
+++ lenya/branches/BRANCH_2_0_X/src/modules/webdav/webdav.js Sun Nov 21 10:57:42 2010
@@ -219,9 +219,9 @@ function executeUsecase(usecaseName) {
         while (!ready) {
 
             try {
-                var templateUri = view.getTemplateURI();
+                var templateUri = view.getViewURI();
                 if (templateUri) {
-                    var viewUri = "view/" + menu + "/" + view.getTemplateURI();
+                    var viewUri = "view/" + menu + "/" + view.getViewURI();
                     if (cocoon.log.isDebugEnabled())
                         cocoon.log.debug("usecases.js::executeUsecase() in usecase " + usecaseName + ", creating view, calling Cocoon with viewUri = [" + viewUri + "]");
 

Modified: lenya/branches/BRANCH_2_0_X/src/pubs/default/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/pubs/default/sitemap.xmap?rev=1037414&r1=1037413&r2=1037414&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/pubs/default/sitemap.xmap (original)
+++ lenya/branches/BRANCH_2_0_X/src/pubs/default/sitemap.xmap Sun Nov 21 10:57:42 2010
@@ -43,8 +43,8 @@
          FIXME: the whole webdav shebang should be handled by the webdav module sitemap.
       -->
       <!-- catch webdav GET requests. -->
-      <map:match pattern="*/webdav**">
-        <map:mount uri-prefix="{1}/" src="{fallback:lenya/modules/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>    
+      <map:match pattern="webdav**">
+        <map:mount uri-prefix="" src="{fallback:lenya/modules/webdav/sitemap.xmap}" check-reload="true" reload-method="synchron"/>    
       </map:match>
 
       <!-- catch PUT requests (used by webdav clients) -->

Modified: lenya/branches/BRANCH_2_0_X/src/webapp/lenya/config/sitemap/pipelines.xmap
URL: http://svn.apache.org/viewvc/lenya/branches/BRANCH_2_0_X/src/webapp/lenya/config/sitemap/pipelines.xmap?rev=1037414&r1=1037413&r2=1037414&view=diff
==============================================================================
--- lenya/branches/BRANCH_2_0_X/src/webapp/lenya/config/sitemap/pipelines.xmap (original)
+++ lenya/branches/BRANCH_2_0_X/src/webapp/lenya/config/sitemap/pipelines.xmap Sun Nov 21 10:57:42 2010
@@ -1,30 +1,30 @@
-<?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.
--->
-
-<xmap remove="/sitemap/pipelines"
-      unless="/sitemap/pipelines/pipeline/match[@pattern = 'lenya-screen.xsl']"
-      xpath="/sitemap"
-      insert-after="/sitemap/resources"
-      xmlns:map="http://apache.org/cocoon/sitemap/1.0">
-
-<!-- =========================== Pipelines ================================= -->
-
-  <map:pipelines>
+<?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.
+-->
+
+<xmap remove="/sitemap/pipelines"
+      unless="/sitemap/pipelines/pipeline/match[@pattern = 'lenya-screen.xsl']"
+      xpath="/sitemap"
+      insert-after="/sitemap/resources"
+      xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+<!-- =========================== Pipelines ================================= -->
+
+  <map:pipelines>
 
     <map:pipeline internal-only="true">
       
@@ -55,7 +55,7 @@
       </map:match>
     </map:pipeline>
     
-    <map:pipeline>
+    <map:pipeline>
 
     <map:match pattern="**">
       
@@ -63,48 +63,50 @@
       <map:act type="ssl-redirect">
         <map:redirect-to uri="{redirectUri}" session="true"/>
       </map:act>
-      
-      <map:match pattern="*/webdav**">
-        <map:act type="authorizer">
-            <map:mount check-reload="true" reload-method="synchron" src="global-sitemap.xmap" uri-prefix=""/> 
-        </map:act>
-        <map:act type="authenticator">
-          <map:act type="authorizer">
-            <map:mount uri-prefix="" src="global-sitemap.xmap" check-reload="true" reload-method="synchron"/> 
-          </map:act>
-          <map:act type="set-header">
-            <map:parameter name="WWW-Authenticate" value="Basic Realm=lenya" />
-            <map:generate src="context://lenya/content/util/empty.xml" />
-            <map:transform src="fallback://lenya/xslt/exception/forbidden.xsl">
-              <map:parameter name="documentid" value="{page-envelope:document-uuid}"/>
-              <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
-              <map:parameter name="area" value="{page-envelope:area}"/>
-            </map:transform>
-            <map:serialize type="xhtml" status-code="401"/>
-          </map:act>
-        </map:act>
-        <map:act type="set-header">
-          <map:parameter name="WWW-Authenticate" value="Basic Realm=lenya" />
-          <map:generate src="context://lenya/content/util/empty.xml" />
-          <map:transform src="fallback://lenya/xslt/exception/forbidden.xsl">
-              <map:parameter name="documentid" value="{page-envelope:document-uuid}"/>
-              <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
-              <map:parameter name="area" value="{page-envelope:area}"/>
-          </map:transform>
-          <map:serialize type="xhtml" status-code="401"/>
-        </map:act>
-      </map:match>
-      <map:act type="authorizer">
-        <map:mount uri-prefix="" src="global-sitemap.xmap" check-reload="true" reload-method="synchron"/>
-      </map:act>
+      
+      <map:match pattern="*/webdav**">
+        <map:act type="authorizer">
+            <map:mount check-reload="true" reload-method="synchron" src="global-sitemap.xmap" uri-prefix=""/> 
+        </map:act>
+        <map:act type="authenticator">
+          <map:act type="authorizer">
+            <map:mount uri-prefix="" src="global-sitemap.xmap" check-reload="true" reload-method="synchron"/> 
+          </map:act>
+          <map:act type="set-header">
+            <map:parameter name="WWW-Authenticate" value="Basic Realm=lenya" />
+            <map:generate src="context://lenya/content/util/empty.xml" />
+            <map:transform src="fallback://lenya/xslt/exception/forbidden.xsl">
+              <map:parameter name="documentid" value="{page-envelope:document-uuid}"/>
+              <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+              <map:parameter name="area" value="{page-envelope:area}"/>
+            </map:transform>
+            <map:call resource="style-cms-page"/>
+            <map:serialize type="xhtml" status-code="401"/>
+          </map:act>
+        </map:act>
+        <map:act type="set-header">
+          <map:parameter name="WWW-Authenticate" value="Basic Realm=lenya" />
+          <map:generate src="context://lenya/content/util/empty.xml" />
+          <map:transform src="fallback://lenya/xslt/exception/forbidden.xsl">
+              <map:parameter name="documentid" value="{page-envelope:document-uuid}"/>
+              <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+              <map:parameter name="area" value="{page-envelope:area}"/>
+          </map:transform>
+          <map:call resource="style-cms-page"/>
+          <map:serialize type="xhtml" status-code="401"/>
+        </map:act>
+      </map:match>
+      <map:act type="authorizer">
+        <map:mount uri-prefix="" src="global-sitemap.xmap" check-reload="true" reload-method="synchron"/>
+      </map:act>
       <map:redirect-to session="true" uri="{proxy:/{1}}?lenya.usecase=ac.login&amp;referrerQueryString={url-encode:{request:queryString}}"/>        
-    </map:match>
-
-    </map:pipeline>
-
-    <!-- this is the default error handler -->
+    </map:match>
+
+    </map:pipeline>
+
+    <!-- this is the default error handler -->
     <map:handle-errors>
       <map:mount src="{fallback:error.xmap}" check-reload="true" reload-method="synchron" uri-prefix=""/>
-    </map:handle-errors>    
-    
-  </map:pipelines></xmap>
+    </map:handle-errors>    
+    
+  </map:pipelines></xmap>

Propchange: lenya/branches/BRANCH_2_0_X/src/webapp/lenya/config/sitemap/pipelines.xmap
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org