Hi Team,
We are trying to Automate the Process of Uploading the Project Configuration XML.
But since the UI is available behind the JIRA Websudo, we are facing difficulties in doing so.
Any help in figuring out how to automate the Process of Configuration Upload would be helpfull.
Thanks,
Somnath
Hi Somnath,
AFAIK, in order to go past the websudo page you only need to navigate to the url:
../jira/secure/admin/WebSudoAuthenticate.jspa
and supply the administrator password as parameter
"webSudoPassword".
After that, just call the URL to upload the configuration.
You need not do anything special with redirections, just call one URL and then the other.
Also check that your websudo timeout (propertyjira.websudo.timeout)
is not too low.
Default is 10 minutes which should be more than enough.
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jose !!!
I am hitting on an Issue over here :
When I am trying to Upload to :
<JIRA_URL>/secure/project-config-file-upload.jspa
JIRA is returning me a WebSudo Authentication page asking for Password, for my Logged in User.
I have attached all the Cookies which came along with the Login.
How to pass that ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you attach a dump of your shell session, with the commands you have issued and the responses?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jose,
With JIRA WebSudo Authorization Turned OFF, the automation steps described works fine. But once thats ON, I am facing problem.
To get past the WebSudo Password Entry page, I am doing something like this, but I fail to get past the Password Entry page.
Please see the attached program.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if (redirect) {
// get redirect url from "location" header field
String newUrl = conn.getHeaderField("Location");
// get the cookie if need, for login
String cookies = conn.getHeaderField("Set-Cookie");
// open the new connnection again
conn = (HttpURLConnection) new URL(newUrl).openConnection();
conn.setRequestProperty("Cookie", cookies);
conn.addRequestProperty("Authorization", "Basic Y3NmYWRtaW46VGFqbWFoYWw2OA==");
conn.addRequestProperty("X-Atlassian-Token", "no-check");
conn.setRequestMethod("POST");
System.out.println("Redirect to URL : " + newUrl);
}
BufferedReader in = new BufferedReader(
new InputStreamReader(conn.getInputStream()));
String inputLine;
StringBuffer html = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
html.append(inputLine);
}
in.close();
System.out.println("URL Content... \n" + html.toString());
System.out.println("Done");
} catch (Exception e) {
e.printStackTrace();
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if (redirect) { // get redirect url from "location" header field String newUrl = conn.getHeaderField("Location"); // get the cookie if need, for login String cookies = conn.getHeaderField("Set-Cookie"); // open the new connnection again conn = (HttpURLConnection) new URL(newUrl).openConnection(); conn.setRequestProperty("Cookie", cookies); conn.addRequestProperty("Authorization", "Basic Y3NmYWRtaW46VGFqbWFoYWw2OA=="); conn.addRequestProperty("X-Atlassian-Token", "no-check"); conn.setRequestMethod("POST"); System.out.println("Redirect to URL : " + newUrl); } BufferedReader in = new BufferedReader( new InputStreamReader(conn.getInputStream())); String inputLine; StringBuffer html = new StringBuffer(); while ((inputLine = in.readLine()) != null) { html.append(inputLine); } in.close(); System.out.println("URL Content... \n" + html.toString()); System.out.println("Done"); } catch (Exception e) { e.printStackTrace(); } } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
public class RestClientJIRAProjectConfigImpExp_HTTP { public static void main(String[] args) { try { String url = "http://<JIRA_URL>/secure/admin/WebSudoAuthenticate.jspa?webSudoPassword=XXXXX&webSudoDestination=/secure/project-config-file-upload.jspa"; URL obj = new URL(url); HttpURLConnection conn = (HttpURLConnection) obj.openConnection(); conn.setReadTimeout(5000); conn.addRequestProperty("Authorization", "Basic Y3NmYWRtaW46VGFqbWFoYWw2OA=="); conn.setRequestMethod("POST"); conn.addRequestProperty("X-Atlassian-Token", "no-check"); conn.setInstanceFollowRedirects(false); System.out.println("Request URL ... " + url); boolean redirect = false; // normally, 3xx is redirect int status = conn.getResponseCode(); if (status != HttpURLConnection.HTTP_OK) { if (status == HttpURLConnection.HTTP_MOVED_TEMP || status == HttpURLConnection.HTTP_MOVED_PERM || status == HttpURLConnection.HTTP_SEE_OTHER) redirect = true; } System.out.println("Response Code ... " + status);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.