Skip to content

Commit

Permalink
Merge pull request #1 from varyvol/JENKINS-39470
Browse files Browse the repository at this point in the history
[JENKINS-39470] Migrate to 2.17 parent POM
  • Loading branch information
jglick committed Nov 8, 2016
2 parents d67300b + ebc2327 commit dd1660d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
12 changes: 8 additions & 4 deletions pom.xml
Expand Up @@ -3,9 +3,9 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<!-- TODO switch to 1.532.2 if JENKINS-16936 is backported -->
<version>1.537</version>
<version>2.17</version>
</parent>

<artifactId>secure-requester-whitelist</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>hpi</packaging>
Expand All @@ -18,25 +18,29 @@
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>

<scm>
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
</scm>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

<properties>
<!-- TODO until bc4c132 in 1.545, or below 1.536 -->
<concurrency>1</concurrency>
<jenkins.version>1.580.1</jenkins.version>
<java.level>6</java.level>
</properties>
</project>
Expand Up @@ -24,6 +24,7 @@

package org.jenkinsci.plugins.secure_requester_whitelist;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import jenkins.model.GlobalConfiguration;
import jenkins.model.GlobalConfigurationCategory;
Expand All @@ -33,6 +34,7 @@

@Extension public class Whitelist extends GlobalConfiguration {

@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public static Whitelist get() {
return Jenkins.getInstance().getDescriptorByType(Whitelist.class);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/index.jelly
@@ -1,3 +1,4 @@
<?jelly escape-by-default='true'?>
<div>
Allows an administrator to specify sites trusted to make JSONP or primitive-XPath REST API requests.
</div>
Expand Up @@ -25,7 +25,7 @@
package org.jenkinsci.plugins.secure_requester_whitelist;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebRequestSettings;
import com.gargoylesoftware.htmlunit.WebRequest;
import java.net.URL;
import net.sf.json.JSONObject;
import static org.junit.Assert.*;
Expand All @@ -51,13 +51,15 @@ public class SecureRequesterImplTest {
assertJSONP("huh?", 403);
}

private void assertJSONP(String referer, int expectedStatusCode) throws Exception {
JenkinsRule.WebClient wc = r.createWebClient();
private void assertJSONP(final String referer, final int expectedStatusCode) throws Exception {
final JenkinsRule.WebClient wc = r.createWebClient();
wc.login("alice");
WebRequestSettings req = new WebRequestSettings(new URL(wc.getContextPath() + "api/json?jsonp"));

final WebRequest req = new WebRequest(new URL(wc.getContextPath() + "api/json?jsonp"));
if (referer != null) {
req.setAdditionalHeader("Referer", referer);
}

try {
wc.getPage(req);
assertEquals(expectedStatusCode, 200);
Expand Down

0 comments on commit dd1660d

Please sign in to comment.