incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1156594 - in /sling/trunk/contrib/extensions/security: pom.xml src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
Date Thu, 11 Aug 2011 12:27:19 GMT
Author: cziegeler
Date: Thu Aug 11 12:27:19 2011
New Revision: 1156594

URL: http://svn.apache.org/viewvc?rev=1156594&view=rev
Log:
Use latest Commons OSGi and return 403 instead of 500

Modified:
    sling/trunk/contrib/extensions/security/pom.xml
    sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java

Modified: sling/trunk/contrib/extensions/security/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/security/pom.xml?rev=1156594&r1=1156593&r2=1156594&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/security/pom.xml (original)
+++ sling/trunk/contrib/extensions/security/pom.xml Thu Aug 11 12:27:19 2011
@@ -71,7 +71,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.osgi</artifactId>
-            <version>2.0.6</version>
+            <version>2.1.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>

Modified: sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java?rev=1156594&r1=1156593&r2=1156594&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
(original)
+++ sling/trunk/contrib/extensions/security/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
Thu Aug 11 12:27:19 2011
@@ -43,7 +43,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.PropertyUnbounded;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -162,8 +162,8 @@ public class ReferrerFilter implements F
      * Activate
      */
     protected void activate(final ComponentContext ctx) {
-        this.allowEmpty = OsgiUtil.toBoolean(ctx.getProperties().get(PROP_ALLOW_EMPTY), DEFAULT_ALLOW_EMPTY);
-        String[] allowHosts = OsgiUtil.toStringArray(ctx.getProperties().get(PROP_HOSTS));
+        this.allowEmpty = PropertiesUtil.toBoolean(ctx.getProperties().get(PROP_ALLOW_EMPTY),
DEFAULT_ALLOW_EMPTY);
+        String[] allowHosts = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_HOSTS));
         if ( allowHosts != null ) {
             if ( allowHosts.length == 0 ) {
                 allowHosts = null;
@@ -178,7 +178,7 @@ public class ReferrerFilter implements F
             }
         }
         this.allowedReferrers = this.createReferrerUrls(allowedReferrers);
-        this.filterMethods = OsgiUtil.toStringArray(ctx.getProperties().get(PROP_METHODS));
+        this.filterMethods = PropertiesUtil.toStringArray(ctx.getProperties().get(PROP_METHODS));
         if ( this.filterMethods != null && this.filterMethods.length == 1 &&
(this.filterMethods[0] == null || this.filterMethods[0].trim().length() == 0) ) {
             this.filterMethods = null;
         }
@@ -212,8 +212,8 @@ public class ReferrerFilter implements F
             if ( this.isModification(request) ) {
                 if ( !this.isValidRequest(request) ) {
                     final HttpServletResponse response = (HttpServletResponse)res;
-                    // we use 500
-                    response.sendError(500);
+                    // we use 403
+                    response.sendError(403);
                     return;
                 }
             }



Mime
View raw message