-
Bug
-
Resolution: Unresolved
-
Major
-
None
JCasC allows to configure jobs through a url:
jobs:
- url: https://example.acme.org/job-dsl/testjob.groovy
We need to add credentials here for basic auth:
https://myid:mypw@example.acme.org/job-dsl/testjob.groovy
The way that this is handled in Java & https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/casc/FromUrlScriptSource.java#L23
ignores the userInfo. I suggest to replace that line with
URL realurl = new URL(url);
URLConnection con = realurl.openConnection();
if (realurl.getUserInfo() != null) {
String basicAuth = "Basic " + new String(new Base64().getEncoder().encode(realurl.getUserInfo().getBytes()));
con.setRequestProperty("Authorization", basicAuth);
}
return IOUtils.toString(con.getInputStream());
I know this straddles the line between feature and bug, but it is a blocker for us. I am also willing to issue a pull request.