diff --git a/src/main/java/com/cdancy/jenkins/rest/JenkinsConstants.java b/src/main/java/com/cdancy/jenkins/rest/JenkinsConstants.java index b0263214..a5259744 100644 --- a/src/main/java/com/cdancy/jenkins/rest/JenkinsConstants.java +++ b/src/main/java/com/cdancy/jenkins/rest/JenkinsConstants.java @@ -41,6 +41,8 @@ public class JenkinsConstants { public static final String OPTIONAL_FOLDER_PATH_PARAM = "optionalFolderPath"; + public static final String JENKINS_COOKIES_JSESSIONID = "JSESSIONID"; + protected JenkinsConstants() { throw new UnsupportedOperationException("Purposefully not implemented"); } diff --git a/src/main/java/com/cdancy/jenkins/rest/parsers/CrumbParser.java b/src/main/java/com/cdancy/jenkins/rest/parsers/CrumbParser.java index 9e04cdb9..92853ac7 100644 --- a/src/main/java/com/cdancy/jenkins/rest/parsers/CrumbParser.java +++ b/src/main/java/com/cdancy/jenkins/rest/parsers/CrumbParser.java @@ -17,6 +17,8 @@ package com.cdancy.jenkins.rest.parsers; +import static com.cdancy.jenkins.rest.JenkinsConstants.JENKINS_COOKIES_JSESSIONID; + import com.cdancy.jenkins.rest.domain.crumb.Crumb; import com.google.common.base.Function; @@ -55,7 +57,7 @@ private static String crumbValue(HttpResponse input) throws IOException { private static String sessionIdCookie(HttpResponse input) { return input.getHeaders().get(HttpHeaders.SET_COOKIE).stream() - .filter(c -> c.startsWith("JSESSIONID")) + .filter(c -> c.startsWith(JENKINS_COOKIES_JSESSIONID)) .findFirst() .orElse(""); }