Dear Support,
our system supports the possibility to get images from the shared drive or via OpenSearch from different nodes.
In the past we were able to search and donwload files. Now we receive http 401 when we try to download.
The system makes and opensearch query, it works, then takes the link from the Atom result and make a request to download the file.
Our code (in Java) used the http authentication that worked before.
The code snippet is:
________________________________________
// Basic HTTP Authentication
m_oLogger.debug("ProviderAdapter.downloadViaHttp: sDownloadUser = " + sDownloadUser);
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
try {
return new PasswordAuthentication(sDownloadUser, sDownloadPassword.toCharArray());
} catch (Exception oEx) {
m_oLogger.error("ProviderAdapter.downloadViaHttp: exception setting auth " + org.apache.commons.lang.exception.ExceptionUtils.getStackTrace(oEx));
}
return null;
}
});
m_oLogger.debug("ProviderAdapter.downloadViaHttp: FileUrl = " + sFileURL);
URL oUrl = new URL(sFileURL);
HttpURLConnection oHttpConn = (HttpURLConnection) oUrl.openConnection();
oHttpConn.setRequestMethod("GET");
oHttpConn.setRequestProperty("Accept", "*/*");
oHttpConn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0");
int responseCode = oHttpConn.getResponseCode();
// always check HTTP response code first
if (responseCode == HttpURLConnection.HTTP_OK) {
m_oLogger.debug("ProviderAdapter.downloadViaHttp: Connected");
________________________________________
I'm sure that user and password are correct (tried with user interface).
Can you help us to solve this issue? Is Basic Authentication already supported? Is there any other way to authenticate "by code" ? Or any other way to download the products by code and not by hand?
Thank you very much
Paolo
Comments
Dear Dirk, we made some test
Hi Paolo, basic
Link
Hi Paolo,
Hi Paolo,