Skip to content

Instantly share code, notes, and snippets.

View harniman's full-sized avatar

Nigel Harniman harniman

View GitHub Profile
package net.harniman.workflow.jenkins
String test (host, user, pass, cmd) {
node("shared") {
init="curl -s -c .cookies ${host}"
userAttr="j_username=${user}"
passAttr="j_password=${pass}"
@harniman
harniman / Server.groovy
Last active June 13, 2016 16:42
A Jenkins Workflow shared library class to perform a Form Based authentication to a Jenkins Server and retrieve the body from a URL.
package net.harniman.workflow.jenkins
//import org.apache.commons.httpclient.*
//import org.apache.commons.httpclient.auth.*
import org.apache.commons.httpclient.Header
import org.apache.commons.httpclient.HostConfiguration
import org.apache.commons.httpclient.HttpClient
import org.apache.commons.httpclient.NameValuePair
import org.apache.commons.httpclient.methods.GetMethod