Find Answers
Qlik Community
Collaborate with over 60,000 Qlik technologists and members around the world to get answers to your questions, and maximize success.
Join Us
package package1;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
import java.util.HashSet;
import java.util.Set;
// singleton
enum WhitelistHostnameVerifier implements HostnameVerifier {
// these hosts get whitelisted
INSTANCE("localhost", "10.76.200.70");
private Set<String> whitelist = new HashSet<>();
private HostnameVerifier defaultHostnameVerifier =
HttpsURLConnection.getDefaultHostnameVerifier();
WhitelistHostnameVerifier(String... hostnames) {
for (String hostname : hostnames) {
whitelist.add(hostname);
}
}
@Override
public boolean verify(String host, SSLSession session) {
if (whitelist.contains(host)) {
return true;
}
// important: use default verifier for all other hosts
return defaultHostnameVerifier.verify(host, session);
}
}
package package1; import javax.net.ssl.*; import java.io.*; import java.net.URL; import java.security.*; import java.security.cert.CertificateException; ..... /************** BEGIN HTTPS Connection **************/ System.out.println("Browsing to: " + "https://" + host + ":4243/qps/" + vproxy + "/ticket?xrfkey=" + xrfkey); URL url = new URL("https://" + host + ":4243/qps/" + vproxy + "/ticket?xrfkey=" + xrfkey); HttpsURLConnection.setDefaultHostnameVerifier(WhitelistHostnameVerifier.INSTANCE); HttpsURLConnection connection = (HttpsURLConnection ) url.openConnection(); connection.setSSLSocketFactory(sslSocketFactory); connection.setRequestProperty("x-qlik-xrfkey", xrfkey); connection.setDoOutput(true);
"C:\Program Files\Java\jdk1.8.0_221\bin\javac.exe" package1/WhitelistHostnameVerifier.java "C:\Program Files\Java\jdk1.8.0_221\bin\javac.exe" package1/Ticket.java
"C:\Program Files\Java\jdk1.8.0_221\bin\java.exe" package1.Ticket administrator MYDOMAIN Result: Browsing to: https://10.76.200.70:4243/qps/bip/ticket?xrfkey=7rBHABt65vFflaZ7 Payload: { 'UserId':'administrator','UserDirectory':'MYDOMAIN','Attributes': [],} The from the server is: {"UserDirectory":"MYDOMAIN","UserId":"administrator","Attributes":[],"Ticket":"jfDmfNrzK9asYj3e","TargetUri":null}
Collaborate with over 60,000 Qlik technologists and members around the world to get answers to your questions, and maximize success.
Join UsSearch Qlik's Support Knowledge database or request assisted support for highly complex issues.
Submit a caseExperiencing a serious issue, please contact us by phone. For Data Integration related issues please refer to your onboarding documentation for current phone number.
Call Us