@Override public void handle(URLConnection connection) { if (connection instanceof HttpURLConnection && matches(connection) && oauth2Token != null) { if (!(connection instanceof HttpsURLConnection)) logger.debug("using bearer authentication with http instead of https, this is very insecure: {}", connection.getURL()); connection.setRequestProperty(HEADER_AUTHORIZATION, authentication); } }
public BearerAuthentication(String oauth2Token, Reporter reporter) { setReporter(reporter); this.oauth2Token = oauth2Token; this.authentication = PREFIX_BEARER_AUTH + oauth2Token; }
SettingsURLConnectionHandler(ServerDTO serverDTO, Processor processor) { match = new Glob(serverDTO.match != null ? serverDTO.match : serverDTO.id); if (serverDTO.password == null) { handler = null; } else if (serverDTO.username != null) { handler = new BasicAuthentication(serverDTO.username, serverDTO.password, processor); } else { handler = new BearerAuthentication(serverDTO.password, processor); } // verify=false, trust.isEmpty -> void default check // verify=false, !trust.isEmpty -> ignore // verify=true, trust.isEmpty -> use default check // verify=true, !trust.isEmpty -> verify against given certs boolean hasCerts = serverDTO.trust != null && !serverDTO.trust.isEmpty(); if (serverDTO.verify == false || hasCerts) https = new HttpsVerification(serverDTO.trust, serverDTO.verify, processor); else https = null; // verify & no certs ==> default }
SettingsURLConnectionHandler(ServerDTO serverDTO, Processor processor) { match = new Glob(serverDTO.match != null ? serverDTO.match : serverDTO.id); if (serverDTO.password == null) { handler = null; } else if (serverDTO.username != null) { handler = new BasicAuthentication(serverDTO.username, serverDTO.password, processor); } else { handler = new BearerAuthentication(serverDTO.password, processor); } // verify=false, trust.isEmpty -> void default check // verify=false, !trust.isEmpty -> ignore // verify=true, trust.isEmpty -> use default check // verify=true, !trust.isEmpty -> verify against given certs boolean hasCerts = serverDTO.trust != null && !serverDTO.trust.isEmpty(); if (serverDTO.verify == false || hasCerts) https = new HttpsVerification(serverDTO.trust, serverDTO.verify, processor); else https = null; // verify & no certs ==> default }
@Override public void handle(URLConnection connection) { if (connection instanceof HttpURLConnection && matches(connection) && oauth2Token != null) { if (!(connection instanceof HttpsURLConnection)) logger.debug("using bearer authentication with http instead of https, this is very insecure: {}", connection.getURL()); connection.setRequestProperty(HEADER_AUTHORIZATION, authentication); } }
public BearerAuthentication(String oauth2Token, Reporter reporter) { setReporter(reporter); this.oauth2Token = oauth2Token; this.authentication = PREFIX_BEARER_AUTH + oauth2Token; }