use of de.tum.in.tumcampusapp.utils.Const.API_HOSTNAME in project TumCampusApp by TCA-Team.
the class Helper method getOkClient.
public static OkHttpClient getOkClient(Context c) {
if (client != null) {
return client;
}
final CertificatePinner certificatePinner = new CertificatePinner.Builder().add(API_HOSTNAME, // Fakultaet fuer Informatik
"sha256/dVphPQ9xG7woPpEKXrNalw4eMUQ4Fw9r3OXTzxfuL5A=").add(API_HOSTNAME, // Technische Universitaet Muenchen
"sha256/SwdQoHL7SB/6o12XsIhbQJ9bANVnbrJoHTLzlu/qXT0=").add(API_HOSTNAME, // DFN-Verein PCA Global
"sha256/VzL+FtAKvzb4N5igmFJyv83GD7CBK7Yyw+R6XdRRfmg=").add(API_HOSTNAME, // Deutsche Telekom Root CA 2
"sha256/0d4q5hyN8vpiOWYWPUxz1GC/xCjldYW+a/65pWMj0bY=").add(API_HOSTNAME, // Let's Encrypt Authority X3
"sha256/YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg=").add(API_HOSTNAME, // LE Cross Sign: DST Root CA X3
"sha256/Vjs8r4z+80wjNcr1YKepWQboSIRi63WsWXhIMN+eWys=").add(API_HOSTNAME_NEW, // Fakultaet fuer Informatik
"sha256/dVphPQ9xG7woPpEKXrNalw4eMUQ4Fw9r3OXTzxfuL5A=").add(API_HOSTNAME_NEW, // Technische Universitaet Muenchen
"sha256/SwdQoHL7SB/6o12XsIhbQJ9bANVnbrJoHTLzlu/qXT0=").add(API_HOSTNAME_NEW, // DFN-Verein PCA Global
"sha256/VzL+FtAKvzb4N5igmFJyv83GD7CBK7Yyw+R6XdRRfmg=").add(API_HOSTNAME_NEW, // Deutsche Telekom Root CA 2
"sha256/0d4q5hyN8vpiOWYWPUxz1GC/xCjldYW+a/65pWMj0bY=").add(API_HOSTNAME_NEW, // Let's Encrypt Authority X3
"sha256/YLh1dUR9y6Kja30RrAn7JKnbQG/uEtLMkBgFF2Fuihg=").add(API_HOSTNAME_NEW, // LE Cross Sign: DST Root CA X3
"sha256/Vjs8r4z+80wjNcr1YKepWQboSIRi63WsWXhIMN+eWys=").add(STUDYROOM_HOST, // wwwv2.tum.de
"sha256/dVphPQ9xG7woPpEKXrNalw4eMUQ4Fw9r3OXTzxfuL5A=").add(STUDYROOM_HOST, // wwwv4.tum.de
"sha256/K64RzAqr/RSxwfpHN6fe0DcmdaIVmzAyi511ufYaK1s=").add(STUDYROOM_HOST, // Zertifizierungsstelle der TUM
"sha256/SwdQoHL7SB/6o12XsIhbQJ9bANVnbrJoHTLzlu/qXT0=").add(STUDYROOM_HOST, // DFN-Verein PCA Global - G01
"sha256/VzL+FtAKvzb4N5igmFJyv83GD7CBK7Yyw+R6XdRRfmg=").add(STUDYROOM_HOST, // Deutsche Telekom Root CA 2
"sha256/0d4q5hyN8vpiOWYWPUxz1GC/xCjldYW+a/65pWMj0bY=").build();
// We want to persist our cookies through app session
ClearableCookieJar cookieJar = new PersistentCookieJar(new SetCookieCache(), new SharedPrefsCookiePersistor(c));
// Start building the http client
OkHttpClient.Builder builder = new OkHttpClient.Builder().cookieJar(cookieJar).certificatePinner(certificatePinner);
// Add the device identifying header
builder.addInterceptor(Helper.getDeviceInterceptor(c));
builder.connectTimeout(Helper.HTTP_TIMEOUT, TimeUnit.MILLISECONDS);
builder.readTimeout(Helper.HTTP_TIMEOUT, TimeUnit.MILLISECONDS);
builder.addNetworkInterceptor(new TumHttpLoggingInterceptor(message -> Utils.logwithTag(TAG, message)));
// Save it to the static handle and return
client = builder.build();
return client;
}
Aggregations