Hi
I am using confluence 2.7.3 and able to export space as type HTML by programatically in client app (XML-RPC).
Now I want to download the exported zip file which is on server programatically. I am using HTTP basic authentication mechanism to make connection and download the zip file but it seems not working.
URL dnUrl = new URL(downloadFileUrl);
URLConnection connection = dnUrl.openConnection();
byte[] encoded = Base64.encodeBase64((userName+":"+password).getBytes());
connection.setRequestProperty ("Authorization", "Basic "+new String(encoded));
It is throwing HTTP 403 exception.
Same code is working fine with Confluence 3.5 to download exported zip file.
Can someone tell me how to do basic authentication with Confluence 2.7.3?
Community moderators have prevented the ability to post new answers.
Have you tried appending the "os_authType=basic" query parameter to the URL to ensure that Confluence accepts the basic auth header?
Hi Joseph,
You are right
We have to append the "os_authType=basic" as query parameter to downloadable URL.
So final code will look like
downloadFileUrl += "?os_authType=basic"
URL dnUrl = new URL(downloadFileUrl);
URLConnection connection = dnUrl.openConnection();
byte[] encoded = Base64.encodeBase64((userName+":"+password).getBytes());
connection.setRequestProperty ("Authorization", "Basic "+new String(encoded));
Thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After digging for a while I found, If we set cookie 'crowd.token_value' then we can do SSO and open URLConnection with downloadURL to download the exported zip file.
I just copied the cookie value from Browser and inserted in my java program to test. It works fine with Confluence 2.7.3.
But now question is How to get the value for cookie 'crowd.token_value'? It's encrypted value, don't know how confluence is setting in Browser.
Help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.