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:14:31 UTC
[sling-org-apache-sling-security] annotated tag
org.apache.sling.security-1.1.4 created (now df038a5)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git.
at df038a5 (tag)
tagging c2b9f58fce00fe313ac664f26099ab543d7eb9d1 (commit)
by Antonio Sanso
on Tue Jun 13 12:37:29 2017 +0000
- Log -----------------------------------------------------------------
org.apache.sling.security-1.1.4
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 039593a SLING-2141 - Add a way to check the referrer for modification requests
new 6b5f16b Ignore target
new 78f00c6 SLING-2141 - Add a way to check the referrer for modification requests
new ac5acb3 SLING-2141 - Add a way to check the referrer for modification requests
new 8256705 SLING-2141 - Add a way to check the referrer for modification requests
new 2e74bb2 SLING-2141 - Add a way to check the referrer for modification requests
new a493d9f SLING-2150 : Update plugins to use the latest available versions
new 2989f95 SLING-2141 : Update localhost and server handling
new bb90451 Update to recent snapshot
new 3f3a1c3 Allow empty referrers by default
new ea48c8c Update default list
new e782ad3 Using latest released parent pom
new 04c948c SLING-2664 : Use global filter instead of Sling filter
new dfbcc57 Use latest Commons OSGi and return 403 instead of 500
new d87917c SLING-2198 - allowing request if the referrer host name matches the request host name (also, internalizing the PropertiesUtil class for compatibility purposes)
new 23166c5 SLING-2200 - adding a configuration printer to the referrer filter
new 01f70f8 Remove duplicate entry
new 7a45910 SLING-2279 : ReferrerFilter should not reverse lookup the IPs of interfaces. Apply patch from Tobias Bocanegra
new ceda7a9 [maven-release-plugin] prepare release org.apache.sling.security-1.0.0
new d431bfd [maven-release-plugin] prepare for next development iteration
new 37a4ee1 Use latest parent pom in all projects
new 9962937 Use latest parent pom everywhere
new c537035 Set svn:ignore
new b9b53a5 SLING-2694 : Only check referrer header if request is from a browser
new fa7665e [maven-release-plugin] prepare release org.apache.sling.security-1.0.2
new 38c657b [maven-release-plugin] prepare for next development iteration
new 64faf10 Use latest releases and update to new parent pom
new 0f149ec Update to latest parent pom and use latest releases in launchpad
new fbfc8e8 SLING-2836 : Missing @(De)Activate annotations in ReferrerFilter#(de)activate() methods cause Sling Referrer Filter Tab clones
new 4c40987 [maven-release-plugin] prepare release org.apache.sling.security-1.0.4
new 6c3a2d5 [maven-release-plugin] prepare for next development iteration
new fc2c9e5 Correct reactor pom and update to parent pom 16
new 45dec5c FELIX-2870 : Support allowed hosts patterns in ReferrerFilter . Apply patch from Timothee Maret
new 604b0b7 [maven-release-plugin] prepare release org.apache.sling.security-1.0.6
new 6bd5364 [maven-release-plugin] prepare for next development iteration
new a456ca7 SLING-4019 - ReferrerFilter should have DEFAULT_ALLOW_EMPTY set to false
new daac5d7 SLING-4019 - ReferrerFilter should have DEFAULT_ALLOW_EMPTY set to false
new 16d9866 [maven-release-plugin] prepare release org.apache.sling.security-1.0.8
new a04352b [maven-release-plugin] prepare for next development iteration
new bd06fa0 SLING-3829 - Add support for Content-Disposition attachment
new 5621fdb [maven-release-plugin] prepare release org.apache.sling.security-1.0.10
new 1bbc61c [maven-release-plugin] prepare for next development iteration
new b53e819 Remove duplicate dependency
new 66f4cf3 Use latest parent pom
new 19340b9 Update contrib modules to Parent 23
new 9f722df set parent version to 24 and add empty relativePath where missing
new bdc9688 SLING-4604 - Multiple Content-Disposition headers added
new 11ae6ca SLING-4604 - Multiple Content-Disposition headers added
new 5137124 SLING-4883 - Extend content disposition filter protection to jcr:data
new e9d32c8 SLING-4883 - Extend content disposition filter protection to jcr:data
new 0ff3107 SLING-4883 - Extend content disposition filter protection to jcr:data
new 19b2034 SLING-4883 - Extend content disposition filter protection to jcr:data
new 25c5733 SLING-4883 - Extend content disposition filter protection to jcr:data
new ffbe306 SLING-4883 - Extend content disposition filter protection to jcr:data
new 982486c [maven-release-plugin] prepare release org.apache.sling.security-1.0.12
new 56503a7 [maven-release-plugin] prepare for next development iteration
new 0e3d293 SLING-4973 - Add Content Disposition Excluded Paths
new 1b66ab6 [maven-release-plugin] prepare release org.apache.sling.security-1.0.14
new c2314a8 [maven-release-plugin] prepare for next development iteration
new 5842e4a SLING-4982 - NPE in ContentDispositionFilter
new e9492aa SLING-4982 - NPE in ContentDispositionFilter
new 782ea38 SLING-4983 - Limit the Content Disposition Filter to GET operations
new ca77486 [maven-release-plugin] prepare release org.apache.sling.security-1.0.16
new 9d0060f [maven-release-plugin] prepare for next development iteration
new e68f471 Update the contrib reactor to parent 25
new bc3799f SLING-5273 - Content-Disposition attachment filter: improve the description of the properties
new 6a77f2c SLING-5297 - Incorrect resource in ContentDispositionFilter
new eaf0d42 [maven-release-plugin] prepare release org.apache.sling.security-1.0.18
new 6e39b9d [maven-release-plugin] prepare for next development iteration
new 7a7a97e Switch to parent pom 26
new cf3c4e7 Migrate to parent pom 27
new 9d6aac0 SLING-5942 : Use http whiteboard for filter registration
new 94b44f7 [maven-release-plugin] prepare release org.apache.sling.security-1.1.0
new 58ec7a8 [maven-release-plugin] prepare for next development iteration
new 39e822a [maven-release-plugin] rollback the release of org.apache.sling.security-1.1.0
new e3e9998 SLING-5942 : Apply filter to all contexts
new dfae105 [maven-release-plugin] prepare release org.apache.sling.security-1.1.0
new a66ce27 [maven-release-plugin] prepare for next development iteration
new d6e3215 switch parent pom reference everywhere to 28 where it was 27 before this can be safely done because the only difference between 27 and 28 is an updated maven-source-plugin (fix heap space error)
new a735144 SLING-6271 - ContentDispositionFilter can suppress content type upon request forwarding
new bb828c0 [maven-release-plugin] prepare release org.apache.sling.security-1.1.2
new e1547dc [maven-release-plugin] prepare for next development iteration
new e2f9262 SLING-6316 clarify description of OSGi configuration of the ContentDispositionFilter
new 7668185 SLING-6561 - Test case for SLING-6271
new 1053282 use Sling Parent 30
new 8ee298c add missing Felix SCR annotations
new cdc320c SLING-6937 - Referrer Filter: Allow Regex User Agent Exclusions
new ef32c69 SLING-6937 - Referrer Filter: Allow Regex User Agent Exclusions
new 426e4d5 @trivial fixing javadoc
new bff6fe9 [maven-release-plugin] prepare release org.apache.sling.security-1.1.4
new c2b9f58 [maven-release-plugin] copy for tag org.apache.sling.security-1.1.4
The 91 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
--
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].
[sling-org-apache-sling-security] 01/10: [maven-release-plugin]
prepare for next development iteration
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit e1547dcb7bac5c7cd159eef2c80a9384d7b0a397
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Wed Nov 16 15:08:51 2016 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1769996 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index ff66572..08180f4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
</parent>
<artifactId>org.apache.sling.security</artifactId>
- <version>1.1.2</version>
+ <version>1.1.3-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Apache Sling Security</name>
@@ -37,9 +37,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.security-1.1.2</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.security-1.1.2</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.security-1.1.2</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/security</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 03/10: SLING-6561 - Test case for
SLING-6271
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit 7668185df072cf8a1be82dc50872ba08f23bda5b
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Fri Feb 24 12:30:36 2017 +0000
SLING-6561 - Test case for SLING-6271
* applied patch from Rob Ryan. Thanks!!
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1784271 13f79535-47bb-0310-9956-ffa450edef68
---
.../impl/ContentDispositionFilterTest.java | 107 +++++++++++++++++++++
1 file changed, 107 insertions(+)
diff --git a/src/test/java/org/apache/sling/security/impl/ContentDispositionFilterTest.java b/src/test/java/org/apache/sling/security/impl/ContentDispositionFilterTest.java
index e614879..4c74977 100644
--- a/src/test/java/org/apache/sling/security/impl/ContentDispositionFilterTest.java
+++ b/src/test/java/org/apache/sling/security/impl/ContentDispositionFilterTest.java
@@ -1021,6 +1021,68 @@ public class ContentDispositionFilterTest {
rewriterResponse.setContentType("text/html");
Assert.assertEquals(1, counter.intValue());
}
+
+ /**
+ * Test multiple calls of setContentType which each result in a content-disposition header being needed.
+ * Only one header should be added.
+ * @throws Throwable
+ */
+ @Test
+ public void test_doFilter21b() throws Throwable{
+ final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
+ final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
+ final Resource resource = context.mock(Resource.class, "resource" );
+ final ValueMap properties = context.mock(ValueMap.class);
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{"/content"});
+
+ final AtomicInteger counter = new AtomicInteger();
+
+ context.checking(new Expectations() {
+ {
+ allowing(request).getMethod();
+ will(returnValue("GET"));
+ allowing(response).containsHeader("Content-Disposition");
+ will(returnValue(false));
+ exactly(1).of(response).reset();
+ exactly(1).of(request).removeAttribute(RewriterResponse.ATTRIBUTE_NAME);
+ allowing(request).getAttribute(RewriterResponse.ATTRIBUTE_NAME);
+ will(returnValue(null));
+ allowing(request).setAttribute(RewriterResponse.ATTRIBUTE_NAME, "text/html");
+ allowing(request).setAttribute(RewriterResponse.ATTRIBUTE_NAME, "text/html");
+ allowing(request).getResource();
+ will(returnValue(resource));
+ allowing(resource).getPath();
+ will(returnValue("/content/usergenerated"));
+ allowing(resource).adaptTo(ValueMap.class);
+ will(returnValue(properties));
+ allowing(properties).containsKey(PROP_JCR_DATA);
+ will(returnValue(true));
+
+ // Exactly 2 setContentType should reach the mock response.
+ exactly(1).of(response).setContentType("text/html");
+ exactly(1).of(response).setContentType("text/html");
+ //CONTENT DISPOSITION IS SET
+ exactly(1).of(response).addHeader("Content-Disposition", "attachment");
+ }
+ });
+ final ContentDispositionFilter.RewriterResponse rewriterResponse = contentDispositionFilter. new RewriterResponse(request, response) {
+ @Override
+ public void addHeader(String name, String value) {
+ counter.incrementAndGet();
+ }
+ };
+ rewriterResponse.setContentType("text/html");
+ Assert.assertEquals(1, counter.intValue());
+ rewriterResponse.reset();
+
+ /* Reset on the response clears all the headers, so if we setContentType again the content type header *and* the
+ * content disposition should both reappear. The counter counts each time the content disposition header is added.
+ * The setContentType calls on the mock response are enforced in the Expectations checked above.
+ */
+ rewriterResponse.setContentType("text/html");
+
+ Assert.assertEquals(2, counter.intValue());
+ }
@Test
public void test_doFilter22() throws Throwable{
@@ -1063,7 +1125,52 @@ public class ContentDispositionFilterTest {
rewriterResponse.setContentType("text/html");
Assert.assertEquals(0, counter.intValue());
}
+
+ @Test
+ public void test_doFilter22b() throws Throwable{
+ final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
+ final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
+ final Resource resource = context.mock(Resource.class, "resource" );
+ final ValueMap properties = context.mock(ValueMap.class);
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{"/content/usergenerated"});
+ final AtomicInteger counter = new AtomicInteger();
+ context.checking(new Expectations() {
+ {
+ allowing(request).getMethod();
+ will(returnValue("GET"));
+ allowing(response).containsHeader("Content-Disposition");
+ will(returnValue(false));
+ exactly(1).of(response).reset();
+ allowing(request).getAttribute(RewriterResponse.ATTRIBUTE_NAME);
+ will(returnValue(null));
+ allowing(request).setAttribute(RewriterResponse.ATTRIBUTE_NAME, "text/html");
+ exactly(1).of(request).removeAttribute(RewriterResponse.ATTRIBUTE_NAME);
+ allowing(request).getResource();
+ will(returnValue(resource));
+ allowing(resource).getPath();
+ will(returnValue("/content/usergenerated"));
+ allowing(resource).adaptTo(ValueMap.class);
+ will(returnValue(properties));
+ allowing(properties).containsKey(PROP_JCR_DATA);
+ will(returnValue(true));
+ exactly(2).of(response).setContentType("text/html");
+ //CONTENT DISPOSITION IS NOT SET
+ never(response).addHeader("Content-Disposition", "attachment");
+ }
+ });
+ final ContentDispositionFilter.RewriterResponse rewriterResponse = contentDispositionFilter. new RewriterResponse(request, response) {
+ @Override
+ public void addHeader(String name, String value) {
+ counter.incrementAndGet();
+ }
+ };
+
+ rewriterResponse.setContentType("text/html");
+ rewriterResponse.reset();
+ rewriterResponse.setContentType("text/html");
+ Assert.assertEquals(0, counter.intValue());
+ }
@Test
public void test_isJcrData1() throws Throwable {
contentDispositionFilter = new ContentDispositionFilter();
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 06/10: SLING-6937 - Referrer
Filter: Allow Regex User Agent Exclusions
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit cdc320c46418ad1608371aba493bc925d0bfdf0a
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Jun 13 12:15:53 2017 +0000
SLING-6937 - Referrer Filter: Allow Regex User Agent Exclusions
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1798584 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 ++++
.../apache/sling/security/impl/ReferrerFilter.java | 40 ++++++++++++++++++----
.../OSGI-INF/metatype/metatype.properties | 3 ++
.../sling/security/impl/ReferrerFilterTest.java | 18 +++++++++-
4 files changed, 59 insertions(+), 8 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4dd1bea..11a50d0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,6 +110,12 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.4</version>
+ <scope>provided</scope>
+ </dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
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 e8ca762..bda2225 100644
--- a/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
+++ b/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
@@ -115,6 +115,12 @@ public class ReferrerFilter implements Filter {
@Property(unbounded=PropertyUnbounded.ARRAY, value={"POST", "PUT", "DELETE"})
private static final String PROP_METHODS = "filter.methods";
+ private static final String[] DEFAULT_PROP_AGENTS = {};
+
+ /** Excluded regexp user agents property */
+ @Property(unbounded = PropertyUnbounded.ARRAY)
+ private static final String PROP_EXCLUDED_AGENTS_REGEX = "exclude.agents.regexp";
+
/** Do we allow empty referrer? */
@@ -129,6 +135,9 @@ public class ReferrerFilter implements Filter {
/** Methods to be filtered. */
private String[] filterMethods;
+ /** Paths to be excluded */
+ private Pattern[] excludedRegexUserAgents;
+
private ServiceRegistration<Object> configPrinterRegistration;
/**
@@ -200,7 +209,7 @@ public class ReferrerFilter implements Filter {
/**
* Create Patterns out of the regexp referrer list
*/
- private Pattern[] createReferrerPatterns(final String[] regexps) {
+ private Pattern[] createRegexPatterns(final String[] regexps) {
final List<Pattern> patterns = new ArrayList<Pattern>();
for(final String regexp : regexps) {
try {
@@ -222,7 +231,11 @@ public class ReferrerFilter implements Filter {
final String[] allowRegexHosts = defaultIfEmpty(PropertiesUtil.toStringArray(props.get(PROP_HOSTS_REGEX),
DEFAULT_PROP_HOSTS), DEFAULT_PROP_HOSTS);
- this.allowedRegexReferrers = createReferrerPatterns(allowRegexHosts);
+ this.allowedRegexReferrers = createRegexPatterns(allowRegexHosts);
+
+ final String[] excludedUserAgents = defaultIfEmpty(PropertiesUtil.toStringArray(props.get(PROP_EXCLUDED_AGENTS_REGEX),
+ DEFAULT_PROP_AGENTS), DEFAULT_PROP_AGENTS);
+ this.excludedRegexUserAgents = createRegexPatterns(excludedUserAgents);
final Set<String> allowUriReferrers = getDefaultAllowedReferrers();
final String[] allowHosts = defaultIfEmpty(PropertiesUtil.toStringArray(props.get(PROP_HOSTS),
@@ -421,6 +434,20 @@ public class ReferrerFilter implements Filter {
}
/**
+ * Returns <code>true</code> if the provided user agent matches any present exclusion regexp pattern.
+ * @param userAgent The user agent string to check
+ * @return <code>true</code> if the user agent matches any exclusion pattern.
+ */
+ private boolean isExcludedRegexUserAgent(String userAgent) {
+ for(final Pattern pattern : this.excludedRegexUserAgents) {
+ if (pattern.matcher(userAgent).matches()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* @return The <code>defaultProperties</code> if <code>properties</code> contains a single empty string,
* <code>properties</code> otherwise.
*/
@@ -444,12 +471,11 @@ public class ReferrerFilter implements Filter {
* @return <code>true</code> if the request is assumed to be sent by a
* browser.
*/
- private boolean isBrowserRequest(final HttpServletRequest request) {
+ protected boolean isBrowserRequest(final HttpServletRequest request) {
final String userAgent = request.getHeader(USER_AGENT);
- if (userAgent != null && (userAgent.contains(BROWSER_CLASS_MOZILLA) || userAgent.contains(BROWSER_CLASS_OPERA))) {
- return true;
- }
- return false;
+ return userAgent != null
+ && (userAgent.contains(BROWSER_CLASS_MOZILLA) || userAgent.contains(BROWSER_CLASS_OPERA))
+ && !isExcludedRegexUserAgent(userAgent);
}
public class ConfigurationPrinter {
diff --git a/src/main/resources/OSGI-INF/metatype/metatype.properties b/src/main/resources/OSGI-INF/metatype/metatype.properties
index 0905fb1..2ea3998 100644
--- a/src/main/resources/OSGI-INF/metatype/metatype.properties
+++ b/src/main/resources/OSGI-INF/metatype/metatype.properties
@@ -27,6 +27,9 @@
referrer.name = Apache Sling Referrer Filter
referrer.description = Request filter checking the referrer of modification requests.
+exclude.agents.regexp.name = Exclude Regexp User Agent
+exclude.agents.regexp.description = List of regexp for user agents not to check the referrer.
+
allow.empty.name = Allow Empty
allow.empty.description = Allow an empty or missing referrer
diff --git a/src/test/java/org/apache/sling/security/impl/ReferrerFilterTest.java b/src/test/java/org/apache/sling/security/impl/ReferrerFilterTest.java
index 7eb6d16..1b84bb1 100644
--- a/src/test/java/org/apache/sling/security/impl/ReferrerFilterTest.java
+++ b/src/test/java/org/apache/sling/security/impl/ReferrerFilterTest.java
@@ -28,6 +28,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
+import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -45,6 +46,7 @@ public class ReferrerFilterTest {
final Map<String, Object> props = new HashMap<String, Object>(){{
put("allow.hosts", new String[]{"relhost"});
put("allow.hosts.regexp", new String[]{"http://([^.]*.)?abshost:80"});
+ put("exclude.agents.regexp", new String[]{"[a-zA-Z]*\\/[0-9]*\\.[0-9]*;Some-Agent\\s.*"});
}};
doReturn(reg).when(bundleCtx).registerService(any(String[].class), any(), any(Dictionary.class));
doNothing().when(reg).unregister();
@@ -69,14 +71,21 @@ public class ReferrerFilterTest {
Assert.assertEquals(null, filter.getHost("http:/admin:admin@somehost:4343/somewhere"));
}
- private HttpServletRequest getRequest(final String referrer) {
+ private HttpServletRequest getRequest(final String referrer, final String userAgent) {
final HttpServletRequest request = mock(HttpServletRequest.class);
when(request.getMethod()).thenReturn("POST");
when(request.getRequestURI()).thenReturn("http://somehost/somewhere");
when(request.getHeader("referer")).thenReturn(referrer);
+ if (StringUtils.isNotBlank(userAgent)) {
+ when(request.getHeader("User-Agent")).thenReturn(userAgent);
+ }
return request;
}
+ private HttpServletRequest getRequest(final String referrer) {
+ return getRequest(referrer, null);
+ }
+
@Test public void testValidRequest() {
Assert.assertEquals(false, filter.isValidRequest(getRequest(null)));
Assert.assertEquals(true, filter.isValidRequest(getRequest("relative")));
@@ -95,4 +104,11 @@ public class ReferrerFilterTest {
Assert.assertEquals(true, filter.isValidRequest(getRequest("http://another.abshost:80")));
Assert.assertEquals(false, filter.isValidRequest(getRequest("http://yet.another.abshost:80")));
}
+
+ @Test public void testIsBrowserRequest() {
+ String userAgent = "Mozilla/5.0;Some-Agent (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko)";
+ Assert.assertEquals(false, filter.isBrowserRequest(getRequest(null, userAgent)));
+ userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/603.2.4 (KHTML, like Gecko)";
+ Assert.assertEquals(true, filter.isBrowserRequest(getRequest(null, userAgent)));
+ }
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 04/10: use Sling Parent 30
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit 105328284874c560b8d2099c26e4a183477233ca
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Mar 6 10:31:22 2017 +0000
use Sling Parent 30
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1785622 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 08180f4..379eefd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>28</version>
+ <version>30</version>
<relativePath />
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 07/10: SLING-6937 - Referrer
Filter: Allow Regex User Agent Exclusions
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit ef32c695ddb97e293c6e6d29db59052b87f8a2aa
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Jun 13 12:20:36 2017 +0000
SLING-6937 - Referrer Filter: Allow Regex User Agent Exclusions
* Applied patch from Dominique Jaeggi! Thanks
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1798585 13f79535-47bb-0310-9956-ffa450edef68
---
src/main/java/org/apache/sling/security/impl/ReferrerFilter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 bda2225..0cf6658 100644
--- a/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
+++ b/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
@@ -207,7 +207,7 @@ public class ReferrerFilter implements Filter {
}
/**
- * Create Patterns out of the regexp referrer list
+ * Create Patterns out of the regular expression referrer list
*/
private Pattern[] createRegexPatterns(final String[] regexps) {
final List<Pattern> patterns = new ArrayList<Pattern>();
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 10/10: [maven-release-plugin]
copy for tag org.apache.sling.security-1.1.4
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit c2b9f58fce00fe313ac664f26099ab543d7eb9d1
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Jun 13 12:37:29 2017 +0000
[maven-release-plugin] copy for tag org.apache.sling.security-1.1.4
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.security-1.1.4@1798591 13f79535-47bb-0310-9956-ffa450edef68
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 08/10: @trivial fixing javadoc
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit 426e4d52c31da6adf1e59a320d8e64501081a02e
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Jun 13 12:36:14 2017 +0000
@trivial fixing javadoc
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1798588 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 ++++++
src/main/java/org/apache/sling/security/impl/ReferrerFilter.java | 4 +---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 11a50d0..6279aab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -116,6 +116,12 @@
<version>3.4</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.webconsole</artifactId>
+ <version>3.1.0</version>
+ <scope>provided</scope>
+ </dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
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 0cf6658..9fef94b 100644
--- a/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
+++ b/src/main/java/org/apache/sling/security/impl/ReferrerFilter.java
@@ -222,9 +222,6 @@ public class ReferrerFilter implements Filter {
return patterns.toArray(new Pattern[patterns.size()]);
}
- /**
- * Activate
- */
@Activate
protected void activate(final BundleContext context, final Map<String, Object> props) {
this.allowEmpty = PropertiesUtil.toBoolean(props.get(PROP_ALLOW_EMPTY), DEFAULT_ALLOW_EMPTY);
@@ -483,6 +480,7 @@ public class ReferrerFilter implements Filter {
/**
* Print out the allowedReferrers
* @see org.apache.felix.webconsole.ConfigurationPrinter#printConfiguration(java.io.PrintWriter)
+ * @param pw the PrintWriter object
*/
public void printConfiguration(final PrintWriter pw) {
pw.println("Current Apache Sling Referrer Filter Allowed Referrers:");
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 09/10: [maven-release-plugin]
prepare release org.apache.sling.security-1.1.4
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit bff6fe92c5515d2f1da620bea44798fe6de35b62
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Jun 13 12:37:15 2017 +0000
[maven-release-plugin] prepare release org.apache.sling.security-1.1.4
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1798590 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 6279aab..ab6e0ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,7 +28,7 @@
</parent>
<artifactId>org.apache.sling.security</artifactId>
- <version>1.1.3-SNAPSHOT</version>
+ <version>1.1.4</version>
<packaging>bundle</packaging>
<name>Apache Sling Security</name>
@@ -37,9 +37,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/security</url>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/org.apache.sling.security-1.1.4</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/org.apache.sling.security-1.1.4</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/org.apache.sling.security-1.1.4</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 05/10: add missing Felix SCR
annotations
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit 8ee298c862ed33fabbeda10fdcd7d494eb775ce2
Author: Oliver Lietz <ol...@apache.org>
AuthorDate: Mon Mar 6 19:00:48 2017 +0000
add missing Felix SCR annotations
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1785732 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pom.xml b/pom.xml
index 379eefd..4dd1bea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,6 +90,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.1.0</version>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-org-apache-sling-security] 02/10: SLING-6316 clarify
description of OSGi configuration of the ContentDispositionFilter
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.security-1.1.4
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git
commit e2f9262efed228969153aa45f97cb5f266e784e1
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Nov 24 14:30:41 2016 +0000
SLING-6316 clarify description of OSGi configuration of the ContentDispositionFilter
change from Felix DS to OSGi annotations
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1771152 13f79535-47bb-0310-9956-ffa450edef68
---
.../security/impl/ContentDispositionFilter.java | 51 +---
.../ContentDispositionFilterConfiguration.java | 38 +++
.../impl/ContentDispositionFilterTest.java | 320 ++++++---------------
3 files changed, 142 insertions(+), 267 deletions(-)
diff --git a/src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java b/src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java
index ca4c92f..a0f148b 100644
--- a/src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java
+++ b/src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java
@@ -33,53 +33,24 @@ import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Properties;
-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.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.api.wrappers.SlingHttpServletResponseWrapper;
-import org.apache.sling.commons.osgi.PropertiesUtil;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.metatype.annotations.Designate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Component(metatype = true,
-description = "Request filter adding Content Disposition attachment for certain paths/content types",
-label=" Apache Sling Content Disposition Filter")
-@Service(value = Filter.class)
-@Properties({
- @Property(name = "sling.filter.scope", value = { "request" }, propertyPrivate = true),
- @Property(name = "service.ranking", intValue = -25000, propertyPrivate = true) })
+@Component(property={"sling.filter.scope=request", "service.ranking:Integer=25000"})
+@Designate(ocd=ContentDispositionFilterConfiguration.class)
public class ContentDispositionFilter implements Filter {
/** Logger. */
private final Logger logger = LoggerFactory.getLogger(this.getClass());
- @Property(label = "Content Disposition Paths",
- description = "These paths are checked by the filter. "+
- "Each entry is of the form 'path [ \":\" CSV of excluded content types ]'. " +
- "Invalid entries are logged and ignored."
- , unbounded = PropertyUnbounded.ARRAY, value = { "" })
- private static final String PROP_CONTENT_DISPOSTION_PATHS = "sling.content.disposition.paths";
-
- @Property(label = "Content Disposition Excluded Paths",
- description = "These paths are excluded by the filter. "+
- "Each entry is of the form 'path'. "
- , unbounded = PropertyUnbounded.ARRAY, value = { "" })
- private static final String PROP_CONTENT_DISPOSTION_EXCLUDED_PATHS = "sling.content.disposition.excluded.paths";
-
- private static final boolean DEFAULT_ENABLE_CONTENT_DISPOSTION_ALL_PATHS = false;
- @Property(boolValue = DEFAULT_ENABLE_CONTENT_DISPOSTION_ALL_PATHS ,
- label = "Enable Content Disposition for all paths",
- description ="This flag controls whether to enable" +
- " Content Disposition for all paths, except for the excluded paths defined by sling.content.disposition.excluded.paths")
- private static final String PROP_ENABLE_CONTENT_DISPOSTION_ALL_PATHS = "sling.content.disposition.all.paths";
-
/**
* Set of paths
*/
@@ -97,14 +68,14 @@ public class ContentDispositionFilter implements Filter {
private boolean enableContentDispositionAllPaths;
@Activate
- private void activate(final Map<String, Object> props) {
- String[] contentDispostionProps = PropertiesUtil.toStringArray(props.get(PROP_CONTENT_DISPOSTION_PATHS));
+ private void activate(ContentDispositionFilterConfiguration configuration) {
+ String[] contentDispositionPathsConfiguredValue = configuration.sling_content_disposition_paths();
Set<String> paths = new HashSet<String>();
List<String> pfxs = new ArrayList<String>();
Map<String, Set<String>> contentTypesMap = new HashMap<String, Set<String>>();
- for (String path : contentDispostionProps) {
+ for (String path : contentDispositionPathsConfiguredValue) {
path = path.trim();
if (path.length() > 0) {
int idx = path.indexOf('*');
@@ -112,7 +83,7 @@ public class ContentDispositionFilter implements Filter {
if (colonIdx > -1 && colonIdx < idx) {
// ':' in paths is not allowed
- logger.info("':' in paths is not allowed.");
+ logger.info("wildcard ('*') in content type is not allowed, but found content type with value '{}'", path.substring(colonIdx));
} else {
String p = null;
if (idx >= 0) {
@@ -145,10 +116,10 @@ public class ContentDispositionFilter implements Filter {
contentDispositionPathsPfx = pfxs.toArray(new String[pfxs.size()]);
contentTypesMapping = contentTypesMap.isEmpty()?Collections.<String, Set<String>>emptyMap(): contentTypesMap;
- enableContentDispositionAllPaths = PropertiesUtil.toBoolean(props.get(PROP_ENABLE_CONTENT_DISPOSTION_ALL_PATHS),DEFAULT_ENABLE_CONTENT_DISPOSTION_ALL_PATHS);
+ enableContentDispositionAllPaths = configuration.sling_content_disposition_all_paths();
- String[] contentDispostionExcludedPathsArray = PropertiesUtil.toStringArray(props.get(PROP_CONTENT_DISPOSTION_EXCLUDED_PATHS));
+ String[] contentDispostionExcludedPathsArray = configuration.sling_content_disposition_excluded_paths();
contentDispositionExcludedPaths = new HashSet<String>(Arrays.asList(contentDispostionExcludedPathsArray));
diff --git a/src/main/java/org/apache/sling/security/impl/ContentDispositionFilterConfiguration.java b/src/main/java/org/apache/sling/security/impl/ContentDispositionFilterConfiguration.java
new file mode 100644
index 0000000..eeb7f9b
--- /dev/null
+++ b/src/main/java/org/apache/sling/security/impl/ContentDispositionFilterConfiguration.java
@@ -0,0 +1,38 @@
+/*
+ * 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.security.impl;
+
+import org.osgi.service.metatype.annotations.AttributeDefinition;
+import org.osgi.service.metatype.annotations.ObjectClassDefinition;
+
+@ObjectClassDefinition(name="Apache Sling Content Disposition Filter", description="Request filter adding Content Disposition header with value 'attachment' for certain paths/content types. Independent of the configuration only resource paths are covered which contain a property named 'jcr:data' or 'jcr:content\\jcr:data'.")
+public @interface ContentDispositionFilterConfiguration {
+
+ @AttributeDefinition(name="Included Resource Paths & Content Types", description="These resource paths are covered by the filter. "+
+ "Each entry is of the form '<path> [ : <excluded content type> {,<excluded content type>} ]'. " +
+ "Invalid entries are logged and ignored. <path> must be an absolute path and may contain a wildcard ('*') at the end, to match every resource path with the given path prefix.")
+ String[] sling_content_disposition_paths() default {};
+
+ @AttributeDefinition(name="Excluded Resource Paths", description="These resource paths are excluded from the filter. "+
+ "Each resource path must be given as absolute and fully qualified path. Prefix matching/wildcards are not supported.")
+ String[] sling_content_disposition_excluded_paths() default {};
+
+ @AttributeDefinition(name="Enable For All Resource Paths", description="This flag controls whether to enable" +
+ " this filter for all paths, except for the excluded paths defined by sling.content.disposition.excluded.paths. Setting this to 'true' leads to ignoring 'sling.content.disposition.path'.")
+ boolean sling_content_disposition_all_paths() default false;
+
+}
diff --git a/src/test/java/org/apache/sling/security/impl/ContentDispositionFilterTest.java b/src/test/java/org/apache/sling/security/impl/ContentDispositionFilterTest.java
index ccb1406..e614879 100644
--- a/src/test/java/org/apache/sling/security/impl/ContentDispositionFilterTest.java
+++ b/src/test/java/org/apache/sling/security/impl/ContentDispositionFilterTest.java
@@ -16,7 +16,7 @@
*/
package org.apache.sling.security.impl;
-import java.util.HashMap;
+import java.lang.annotation.Annotation;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@@ -30,6 +30,7 @@ import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import junitx.util.PrivateAccessor;
@@ -43,15 +44,67 @@ public class ContentDispositionFilterTest {
private static final String JCR_CONTENT_LEAF = "jcr:content";
+ @Before
+ public void setUp() {
+ contentDispositionFilter = new ContentDispositionFilter();
+ }
+
+ /**
+ * Implementation of the annotation class used for the configuration of the ContentDispositionFilter.
+ * Unfortunately there is no way to hide the compiler warning: http://stackoverflow.com/a/13261789/5155923
+ */
+ private static final class Configuration implements ContentDispositionFilterConfiguration {
+
+ public Configuration(String[] paths, String[] excludedPaths, boolean enableForAllPaths) {
+ super();
+ this.paths = paths;
+ this.excludedPaths = excludedPaths;
+ this.enableForAllPaths = enableForAllPaths;
+ }
+
+ private final String paths[];
+ private final String excludedPaths[];
+ private final boolean enableForAllPaths;
+
+ @Override
+ public Class<? extends Annotation> annotationType() {
+ return ContentDispositionFilterConfiguration.class;
+ }
+
+ @Override
+ public String[] sling_content_disposition_paths() {
+ return paths;
+ }
+
+ @Override
+ public String[] sling_content_disposition_excluded_paths() {
+ return excludedPaths;
+ }
+
+ @Override
+ public boolean sling_content_disposition_all_paths() {
+ return enableForAllPaths;
+ }
+ }
+
+ private void callActivateWithConfiguration(String[] paths) throws Throwable {
+ callActivateWithConfiguration(paths, new String[]{});
+ }
+
+ private void callActivateWithConfiguration(String[] paths, String[] excludedPaths) throws Throwable {
+ callActivateWithConfiguration(paths, excludedPaths, false);
+ }
+
+
+ private void callActivateWithConfiguration(String[] paths, String[] excludedPaths, boolean enableForAllPaths) throws Throwable {
+ ContentDispositionFilterConfiguration configuration = new Configuration(paths, excludedPaths, enableForAllPaths);
+ PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{ContentDispositionFilterConfiguration.class},new Object[]{configuration});
+ }
+
@SuppressWarnings("unchecked")
@Test
public void test_activator1() throws Throwable{
- contentDispositionFilter = new ContentDispositionFilter();
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String []{""});
Set<String> contentDispositionPaths = ( Set<String> ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPaths");
Assert.assertEquals(1, contentDispositionPaths.size());
String[] contentDispositionPathsPfx = ( String[] ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPathsPfx");
@@ -63,13 +116,7 @@ public class ContentDispositionFilterTest {
@SuppressWarnings("unchecked")
@Test
public void test_activator2() throws Throwable{
- contentDispositionFilter = new ContentDispositionFilter();
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated/*"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated/*"}, new String []{""});
Set<String> contentDispositionPaths = ( Set<String> ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPaths");
Assert.assertEquals(0, contentDispositionPaths.size());
String[] contentDispositionPathsPfx = ( String[] ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPathsPfx");
@@ -81,13 +128,7 @@ public class ContentDispositionFilterTest {
@SuppressWarnings("unchecked")
@Test
public void test_activator3() throws Throwable{
- contentDispositionFilter = new ContentDispositionFilter();
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/libs", "/content/usergenerated/*"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/libs", "/content/usergenerated/*"}, new String[]{""});
Set<String> contentDispositionPaths = ( Set<String> ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPaths");
Assert.assertEquals(1, contentDispositionPaths.size());
String[] contentDispositionPathsPfx = ( String[] ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPathsPfx");
@@ -99,13 +140,7 @@ public class ContentDispositionFilterTest {
@SuppressWarnings("unchecked")
@Test
public void test_activator5() throws Throwable{
- contentDispositionFilter = new ContentDispositionFilter();
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"*"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"*"}, new String[]{""});
Set<String> contentDispositionPaths = ( Set<String> ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPaths");
Assert.assertEquals(0, contentDispositionPaths.size());
String[] contentDispositionPathsPfx = ( String[] ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPathsPfx");
@@ -117,13 +152,7 @@ public class ContentDispositionFilterTest {
@SuppressWarnings("unchecked")
@Test
public void test_activator6() throws Throwable{
- contentDispositionFilter = new ContentDispositionFilter();
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/libs:*"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/libs:*"}, new String[]{""});
Set<String> contentDispositionPaths = ( Set<String> ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPaths");
Assert.assertEquals(0, contentDispositionPaths.size());
String[] contentDispositionPathsPfx = ( String[] ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPathsPfx");
@@ -135,13 +164,7 @@ public class ContentDispositionFilterTest {
@SuppressWarnings("unchecked")
@Test
public void test_activator7() throws Throwable{
- contentDispositionFilter = new ContentDispositionFilter();
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/libs:text/html,text/plain","/content/usergenerated/*:image/jpeg"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/libs:text/html,text/plain","/content/usergenerated/*:image/jpeg"}, new String[]{""});
Set<String> contentDispositionPaths = ( Set<String> ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPaths");
Assert.assertEquals(1, contentDispositionPaths.size());
String[] contentDispositionPathsPfx = ( String[] ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionPathsPfx");
@@ -158,29 +181,19 @@ public class ContentDispositionFilterTest {
userGeneratedMapping.contains("image/jpeg");
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("unchecked")
@Test
public void test_activator8() throws Throwable{
- contentDispositionFilter = new ContentDispositionFilter();
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/libs:text/html,text/plain","/content/usergenerated/*:image/jpeg"});
- props.put("sling.content.disposition.excluded.paths", new String []{});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/libs:text/html,text/plain","/content/usergenerated/*:image/jpeg"}, new String[]{});
+
Set<String> contentDispositionExcludedPaths = ( Set<String> ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionExcludedPaths");
Assert.assertEquals(0, contentDispositionExcludedPaths.size());
- }
-
+ }
+
@SuppressWarnings("unchecked")
@Test
public void test_activator9() throws Throwable{
- contentDispositionFilter = new ContentDispositionFilter();
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/libs:text/html,text/plain","/content/usergenerated/*:image/jpeg"});
- props.put("sling.content.disposition.excluded.paths", new String []{"/content", "/libs"});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/libs:text/html,text/plain","/content/usergenerated/*:image/jpeg"}, new String[]{"/content", "/libs"});
Set<String> contentDispositionExcludedPaths = ( Set<String> ) PrivateAccessor.getField(contentDispositionFilter, "contentDispositionExcludedPaths");
Assert.assertEquals(2, contentDispositionExcludedPaths.size());
@@ -210,15 +223,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
-
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -247,14 +252,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -283,14 +281,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{""});
final AtomicInteger counter = new AtomicInteger();
@@ -331,14 +322,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated/*"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated/*"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -367,13 +351,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated/*"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated/*"}, new String[]{""});
final AtomicInteger counter = new AtomicInteger();
@@ -415,13 +393,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated/*"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated/*"}, new String[]{""});
final AtomicInteger counter = new AtomicInteger();
@@ -462,14 +434,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated:text/html,text/plain"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated:text/html,text/plain"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -498,14 +463,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated:text/html,text/plain"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated:text/html,text/plain"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -533,14 +491,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated:text/html,text/plain"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated:text/html,text/plain"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -570,12 +521,7 @@ public class ContentDispositionFilterTest {
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated:text/html,text/plain"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated:text/html,text/plain"}, new String[]{""});
final AtomicInteger counter = new AtomicInteger();
@@ -616,14 +562,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated/*:text/html,text/plain"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated/*:text/html,text/plain"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -652,14 +591,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated/*:text/html,text/plain"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated/*:text/html,text/plain"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -687,14 +619,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated/*:text/html,text/plain"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated/*:text/html,text/plain"}, new String[]{""});
context.checking(new Expectations() {
{
@@ -723,13 +648,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated/*:text/html,text/plain"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated/*:text/html,text/plain"}, new String[]{""});
final AtomicInteger counter = new AtomicInteger();
@@ -775,13 +694,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{""});
final AtomicInteger counter = new AtomicInteger();
@@ -830,13 +743,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{""});
final AtomicInteger counter = new AtomicInteger();
@@ -887,13 +794,7 @@ public class ContentDispositionFilterTest {
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
- props.put("sling.content.disposition.all.paths", false);
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{""}, false);
final AtomicInteger counter = new AtomicInteger();
@@ -935,21 +836,13 @@ public class ContentDispositionFilterTest {
Assert.assertEquals(0, counter.intValue());
}
-
@Test
public void test_doFilter18() throws Throwable{
final SlingHttpServletRequest request = context.mock(SlingHttpServletRequest.class);
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{""});
- props.put("sling.content.disposition.all.paths", true);
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{""}, true);
final AtomicInteger counter = new AtomicInteger();
@@ -997,14 +890,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{"/content"});
- props.put("sling.content.disposition.all.paths", true);
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{"/content"}, true);
final AtomicInteger counter = new AtomicInteger();
@@ -1052,14 +938,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{"/content/other"});
- props.put("sling.content.disposition.all.paths", true);
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{"/content/other"}, true);
final AtomicInteger counter = new AtomicInteger();
@@ -1107,14 +986,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{"/content"});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
-
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{"/content"});
final AtomicInteger counter = new AtomicInteger();
@@ -1156,13 +1028,7 @@ public class ContentDispositionFilterTest {
final SlingHttpServletResponse response = context.mock(SlingHttpServletResponse.class);
final Resource resource = context.mock(Resource.class, "resource" );
final ValueMap properties = context.mock(ValueMap.class);
- contentDispositionFilter = new ContentDispositionFilter();
-
- final Map<String, Object> props = new HashMap<String, Object>();
- props.put("sling.content.disposition.paths", new String []{"/content/usergenerated"});
- props.put("sling.content.disposition.excluded.paths", new String []{"/content/usergenerated"});
-
- PrivateAccessor.invoke(contentDispositionFilter,"activate", new Class[]{Map.class},new Object[]{props});
+ callActivateWithConfiguration(new String[]{"/content/usergenerated"}, new String[]{"/content/usergenerated"});
final AtomicInteger counter = new AtomicInteger();
context.checking(new Expectations() {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.