/** * Convenience method to make it easier to verify connections * * @param connection The connection to match * @return true if this connection should be handled. */ protected boolean matches(URLConnection connection) { return matches(connection.getURL()); }
/** * Set the properties. */ public void setProperties(Map<String,String> map) throws Exception { super.setProperties(map); for (Entry<String,String> entry : headers.entrySet()) { if (Character.isUpperCase(entry.getKey().charAt(0))) headers.put(entry.getKey(), entry.getValue()); } config = Converter.cnv(Config.class, map); }
/** * Set the properties. */ public void setProperties(Map<String,String> map) throws Exception { super.setProperties(map); for (Entry<String,String> entry : headers.entrySet()) { if (Character.isUpperCase(entry.getKey().charAt(0))) headers.put(entry.getKey(), entry.getValue()); } config = Converter.cnv(Config.class, map); }
/** * Convenience method to make it easier to verify connections * * @param connection The connection to match * @return true if this connection should be handled. */ protected boolean matches(URLConnection connection) { return matches(connection.getURL()); }
/** * Set the properties. */ @Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); for (Entry<String, String> entry : map.entrySet()) { if (Character.isUpperCase(entry.getKey() .charAt(0))) { headers.put(entry.getKey(), entry.getValue()); } } config = Converter.cnv(Config.class, map); }
/** * Convenience method to make it easier to verify connections * * @param connection * The connection to match * @return true if this connection should be handled. */ protected boolean matches(URLConnection connection) { return matches(connection.getURL()); }
/** * Set the properties. */ @Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); for (Entry<String, String> entry : map.entrySet()) { if (Character.isUpperCase(entry.getKey() .charAt(0))) { headers.put(entry.getKey(), entry.getValue()); } } config = Converter.cnv(Config.class, map); }
/** * Convenience method to make it easier to verify connections * * @param connection * The connection to match * @return true if this connection should be handled. */ protected boolean matches(URLConnection connection) { return matches(connection.getURL()); }
/** * Set the properties */ @Override public void setProperties(Map<String,String> map) throws Exception { super.setProperties(map); String paths = map.get("trusted"); if (paths != null) { for (String path : paths.split("\\s*,\\s*")) { File file = IO.getFile(path); if (file.isFile()) { InputStream inStream = new FileInputStream(file); try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream); certificates.add(cert); } finally { inStream.close(); } } } } } }
/** * Set the properties */ @Override public void setProperties(Map<String,String> map) throws Exception { super.setProperties(map); String paths = map.get("trusted"); if (paths != null) { for (String path : paths.split("\\s*,\\s*")) { File file = IO.getFile(path); if (file.isFile()) { InputStream inStream = new FileInputStream(file); try { CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate) cf.generateCertificate(inStream); certificates.add(cert); } finally { inStream.close(); } } } } } }
/** * Set the properties */ @Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); Config config = Converter.cnv(Config.class, map); certificatesPath = config.trusted(); }
@Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); Config config = Converter.cnv(Config.class, map); this.oauth2Token = config._oauth2Token(); this.authentication = PREFIX_BEARER_AUTH + oauth2Token; }
@Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); Config config = Converter.cnv(Config.class, map); this.oauth2Token = config._oauth2Token(); this.authentication = PREFIX_BEARER_AUTH + oauth2Token; }
/** * Set the properties */ @Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); Config config = Converter.cnv(Config.class, map); certificatesPath = config.trusted(); }
public void setProperties(Map<String,String> map) throws Exception { super.setProperties(map); this.password = map.get(PASSWORD); this.user = map.get(USER); if (this.password == null) { error("No .password property set on this plugin %s", map); } if (this.password == null) { error("No user property set on this plugin %s", map); } String authString = user + ":" + password; try { String encoded = Base64.encodeBase64(authString.getBytes("UTF-8")); this.authentication = PREFIX_BASIC_AUTH + encoded; } catch (UnsupportedEncodingException e) { // cannot happen, UTF-8 is always present } }
public void setProperties(Map<String,String> map) throws Exception { super.setProperties(map); this.password = map.get(PASSWORD); this.user = map.get(USER); if (this.password == null) { error("No .password property set on this plugin %s", map); } if (this.password == null) { error("No user property set on this plugin %s", map); } String authString = user + ":" + password; try { String encoded = Base64.encodeBase64(authString.getBytes("UTF-8")); this.authentication = PREFIX_BASIC_AUTH + encoded; } catch (UnsupportedEncodingException e) { // cannot happen, UTF-8 is always present } }
@Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); Config config = Converter.cnv(Config.class, map); this.password = config._password(); this.user = config.user(); init(map); }
@Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); Config config = Converter.cnv(Config.class, map); this.password = config._password(); this.user = config.user(); init(map); }
@Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); String email = map.get(EMAIL); if (email == null) { Settings settings = registry.getPlugin(Settings.class); email = settings.getEmail(); if (email == null) { error( "The bnd authentication URL connection handler has no email set as property, nor have the bnd settings been set"); return; } credentials(email, settings.getPublicKey(), settings.getPrivateKey()); } else { String pub = map.get(PUBLIC_KEY); String prv = map.get(PRIVATE_KEY); if (pub == null || !Hex.isHex(pub)) { error("The bnd authentication URL public key for email %s is not a hex string %s", email, pub); return; } if (prv == null || !Hex.isHex(prv)) { error("The bnd authentication URL private key for email %s is not a hex string", email); return; } credentials(email, Hex.toByteArray(pub), Hex.toByteArray(prv)); } machine = map.get(MACHINE); }
@Override public void setProperties(Map<String, String> map) throws Exception { super.setProperties(map); String email = map.get(EMAIL); if (email == null) { Settings settings = registry.getPlugin(Settings.class); email = settings.getEmail(); if (email == null) { error( "The bnd authentication URL connection handler has no email set as property, nor have the bnd settings been set"); return; } credentials(email, settings.getPublicKey(), settings.getPrivateKey()); } else { String pub = map.get(PUBLIC_KEY); String prv = map.get(PRIVATE_KEY); if (pub == null || !Hex.isHex(pub)) { error("The bnd authentication URL public key for email %s is not a hex string %s", email, pub); return; } if (prv == null || !Hex.isHex(prv)) { error("The bnd authentication URL private key for email %s is not a hex string", email); return; } credentials(email, Hex.toByteArray(pub), Hex.toByteArray(prv)); } machine = map.get(MACHINE); }