You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:13:01 UTC
[sling-org-apache-sling-security] 02/30: Use latest Commons OSGi
and return 403 instead of 500
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.0.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit dfbcc5735fca50821bed129b85838fbe2e1c67ad
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Aug 11 12:27:19 2011 +0000
Use latest Commons OSGi and return 403 instead of 500
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1156594 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
.../java/org/apache/sling/security/impl/ReferrerFilter.java | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index 99b37e5..7098fd6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>
diff --git a/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java b/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
index b2a784f..ddb4ca1 100644
--- a/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
+++ b/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
@@ -43,7 +43,7 @@ import org.apache.felix.scr.annotations.Component;
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 Filter {
* 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 Filter {
}
}
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 Filter {
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;
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.