incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1059730 - in /sling/trunk: bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/ launchpad/builder/src/main/bundles/ launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/
Date Mon, 17 Jan 2011 02:41:33 GMT
Author: justin
Date: Mon Jan 17 02:41:32 2011
New Revision: 1059730

URL: http://svn.apache.org/viewvc?rev=1059730&view=rev
Log:
SLING-1932 - fixing SLING-1932. if requestContextPath is "/", make it "". also adding a unit
test

Added:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java
Modified:
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java
    sling/trunk/launchpad/builder/src/main/bundles/list.xml

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java?rev=1059730&r1=1059729&r2=1059730&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java
(original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java
Mon Jan 17 02:41:32 2011
@@ -185,7 +185,8 @@ public abstract class AbstractAuthentica
         } else {
             b.append(resource);
         }
-        return b.toString();
+        String contextPath = b.toString();
+        return contextPath.equals("/") ? "" : contextPath;
     }
 
     /**

Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=1059730&r1=1059729&r2=1059730&view=diff
==============================================================================
--- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original)
+++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Mon Jan 17 02:41:32 2011
@@ -61,7 +61,7 @@
         <bundle>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.auth.core</artifactId>
-            <version>1.0.4</version>
+            <version>1.0.5-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.apache.sling</groupId>

Added: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java?rev=1059730&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java
(added)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java
Mon Jan 17 02:41:32 2011
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+package org.apache.sling.launchpad.webapp.integrationtest.login;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+/**
+ * Test of form generation from auth.core.
+ */
+public class FormGenerationTest extends HttpTestBase {
+
+    public void testSelectorForm() throws Exception {
+        String contextPath = getContextPath(HTTP_BASE_URL);
+        String content = getContent(HTTP_BASE_URL + "/system/sling/selector/login", CONTENT_TYPE_HTML,
+                Arrays.asList(new NameValuePair("resource", "/")), 200);
+
+        assertTrue("form action is not correct.", content.contains("action=\"" + contextPath
+ "/j_security_check\""));
+    }
+
+    private static String getContextPath(String baseURL) {
+        // get the index of the first slash after http:// or https://
+        int idx = baseURL.indexOf('/', 8);
+        if (idx == -1) {
+            return "";
+        } else {
+            return baseURL.substring(idx);
+        }
+    }
+
+}



Mime
View raw message