temporary bypassing certificate validation with redirected trustStore to use apitest-server
This commit is contained in:
parent
c57972af35
commit
1d4670f2c6
src/main
java/se/su/dsv/scipro/io/http
resources
@ -86,6 +86,7 @@ public class HttpRequestSender {
|
||||
conn.setReadTimeout(READ_TIMEOUT);
|
||||
if(user != null && password != null)
|
||||
conn.setRequestProperty("Authorization", getBasicEncodedAuthData());
|
||||
conn.setRequestProperty("Accept", getAcceptContentType());
|
||||
//Handle POST-style requests
|
||||
if(requestType == REQUEST_TYPE.POST){
|
||||
conn.setDoOutput(true);
|
||||
@ -142,6 +143,9 @@ public class HttpRequestSender {
|
||||
String encodedAuthorization = Base64.encodeBase64String(userpassword.getBytes());
|
||||
return ("Basic "+encodedAuthorization);
|
||||
}
|
||||
private String getAcceptContentType() {
|
||||
return "application/json";
|
||||
}
|
||||
protected HttpURLConnection getConnection(final URL url) throws IOException{
|
||||
return (HttpURLConnection)url.openConnection();
|
||||
}
|
||||
|
@ -5,7 +5,9 @@ import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLSession;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@ -16,7 +18,17 @@ public class HttpsRequestSender extends HttpRequestSender{
|
||||
}
|
||||
@Override
|
||||
protected HttpURLConnection getConnection(final URL url) throws IOException{
|
||||
HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
|
||||
return con;
|
||||
System.setProperty("javax.net.ssl.trustStore", "C:/Java/myKeys");
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", "testing");
|
||||
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier(){
|
||||
@Override
|
||||
public boolean verify(String arg0, SSLSession arg1) {
|
||||
logger.warn("Bypassing SSL verification for: "+arg0+", session: "+arg1);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
|
||||
return con;
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
<bean id="externalImporter" class="se.su.dsv.scipro.io.impl.ExternalImporterDaisyImpl"/>
|
||||
<!-- Defines global settings for the application -->
|
||||
<bean id="applicationSettings" class="se.su.dsv.scipro.ApplicationSettings">
|
||||
<property name="remoteLookupUrl" value="https://api.dsv.su.se"/>
|
||||
<property name="remoteLookupUrl" value="https://apitest.dsv.su.se/rest"/>
|
||||
<property name="remoteLookupUser" value="thesis"/>
|
||||
<property name="remoteLookupPassword" value="dqyhIM8LU5LQ53T3aJNz4SVXeTQ95dLGkN7JlLOv7X7jeTR2NR"/>
|
||||
<!-- This property points to the location of the remote system used for json requests -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user