protected boolean isStoreSSLClientCertificatePassphrases(SVNURL url) { String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storeCertPassphrases = (String) properties.get("store-ssl-client-cert-pp"); if (storeCertPassphrases == null) { return true; } return "yes".equalsIgnoreCase(storeCertPassphrases) || "on".equalsIgnoreCase(storeCertPassphrases) || "true".equalsIgnoreCase(storeCertPassphrases); }
protected boolean isStoreSSLClientCertificatePassphrases(SVNURL url) { String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storeCertPassphrases = (String) properties.get("store-ssl-client-cert-pp"); if (storeCertPassphrases == null) { return true; } return "yes".equalsIgnoreCase(storeCertPassphrases) || "on".equalsIgnoreCase(storeCertPassphrases) || "true".equalsIgnoreCase(storeCertPassphrases); }
protected String getUserName(SVNURL url) { String host = url != null ? url.getHost() : null; // if (url != null && url.getUserInfo() != null) { // return url.getUserInfo(); // } Map properties = getHostProperties(host); String userName = (String) properties.get("username"); return userName; }
protected boolean isAuthStorageEnabled(SVNURL url) { String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storeAuthCreds = (String) properties.get("store-auth-creds"); if (storeAuthCreds == null) { return myIsStoreAuth; } return "yes".equalsIgnoreCase(storeAuthCreds) || "on".equalsIgnoreCase(storeAuthCreds) || "true".equalsIgnoreCase(storeAuthCreds); }
protected boolean isAuthStorageEnabled(SVNURL url) { String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storeAuthCreds = (String) properties.get("store-auth-creds"); if (storeAuthCreds == null) { return myIsStoreAuth; } return "yes".equalsIgnoreCase(storeAuthCreds) || "on".equalsIgnoreCase(storeAuthCreds) || "true".equalsIgnoreCase(storeAuthCreds); }
protected String getUserName(SVNURL url) { String host = url != null ? url.getHost() : null; // if (url != null && url.getUserInfo() != null) { // return url.getUserInfo(); // } Map properties = getHostProperties(host); String userName = (String) properties.get("username"); return userName; }
public Collection getAuthTypes(SVNURL url) { List schemes = new ArrayList(); String host = url.getHost(); Map hostProperties = getHostProperties(host); String authTypes = (String) hostProperties.get("http-auth-types"); if (authTypes == null || "".equals(authTypes.trim())) { return schemes; } for(StringTokenizer tokens = new StringTokenizer(authTypes, ";"); tokens.hasMoreTokens();) { String scheme = tokens.nextToken(); if (!schemes.contains(scheme)) { schemes.add(scheme); } } return schemes; }
public Collection getAuthTypes(SVNURL url) { List schemes = new ArrayList(); String host = url.getHost(); Map hostProperties = getHostProperties(host); String authTypes = (String) hostProperties.get("http-auth-types"); if (authTypes == null || "".equals(authTypes.trim())) { return schemes; } for(StringTokenizer tokens = new StringTokenizer(authTypes, ";"); tokens.hasMoreTokens();) { String scheme = tokens.nextToken(); if (!schemes.contains(scheme)) { schemes.add(scheme); } } return schemes; }
public TrustManager getTrustManager(SVNURL url) throws SVNException { String host = url.getHost(); Map properties = getHostProperties(host); boolean trustAll = !"no".equalsIgnoreCase((String) properties.get("ssl-trust-default-ca")); // jdk keystore String sslAuthorityFiles = (String) properties.get("ssl-authority-files"); // "pem" files Collection trustStorages = new ArrayList(); if (sslAuthorityFiles != null) { for(StringTokenizer files = new StringTokenizer(sslAuthorityFiles, ";"); files.hasMoreTokens();) { String fileName = files.nextToken(); fileName = fileName == null ? null : fileName.trim(); if (fileName != null && !"".equals(fileName)) { trustStorages.add(new File(fileName)); } } } File[] serverCertFiles = (File[]) trustStorages.toArray(new File[trustStorages.size()]); File authDir = new File(myConfigDirectory, "auth/svn.ssl.server"); return new DefaultSVNSSLTrustManager(authDir, url, serverCertFiles, trustAll, this); }
protected boolean isStorePasswords(SVNURL url) { boolean store = true; String value = getConfigFile().getPropertyValue("auth", "store-passwords"); if (value != null) { store = "yes".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value); } String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storePasswords = (String) properties.get("store-passwords"); if (storePasswords == null) { return store; } return "yes".equalsIgnoreCase(storePasswords) || "on".equalsIgnoreCase(storePasswords) || "true".equalsIgnoreCase(storePasswords); }
public TrustManager getTrustManager(SVNURL url) throws SVNException { String host = url.getHost(); Map properties = getHostProperties(host); boolean trustAll = !"no".equalsIgnoreCase((String) properties.get("ssl-trust-default-ca")); // jdk keystore String sslAuthorityFiles = (String) properties.get("ssl-authority-files"); // "pem" files Collection trustStorages = new ArrayList(); if (sslAuthorityFiles != null) { for(StringTokenizer files = new StringTokenizer(sslAuthorityFiles, ";"); files.hasMoreTokens();) { String fileName = files.nextToken(); fileName = fileName == null ? null : fileName.trim(); if (fileName != null && !"".equals(fileName)) { trustStorages.add(new File(fileName)); } } } File[] serverCertFiles = (File[]) trustStorages.toArray(new File[trustStorages.size()]); File authDir = new File(myConfigDirectory, "auth/svn.ssl.server"); return new DefaultSVNSSLTrustManager(authDir, url, serverCertFiles, trustAll, this); }
protected boolean isStorePasswords(SVNURL url) { boolean store = true; String value = getConfigFile().getPropertyValue("auth", "store-passwords"); if (value != null) { store = "yes".equalsIgnoreCase(value) || "on".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value); } String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storePasswords = (String) properties.get("store-passwords"); if (storePasswords == null) { return store; } return "yes".equalsIgnoreCase(storePasswords) || "on".equalsIgnoreCase(storePasswords) || "true".equalsIgnoreCase(storePasswords); }
public long getHTTPTimeout(SVNRepository repository) { String host = repository.getLocation().getHost(); Map properties = getHostProperties(host); String timeout = (String) properties.get("http-timeout"); long value = -1; if (timeout != null) { try { value = Integer.parseInt(timeout)*1000; } catch (NumberFormatException nfe) { } } return value; } }
protected boolean isStorePlainTextPassphrases(String realm, SVNAuthentication auth) throws SVNException { SVNURL url = auth.getURL(); String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storePlainTextPassphrases = (String) properties.get("store-ssl-client-cert-pp-plaintext"); if (storePlainTextPassphrases == null) { if (myAuthStoreHandler != null) { return myAuthStoreHandler.canStorePlainTextPassphrases(realm, auth); } return false; } return "yes".equalsIgnoreCase(storePlainTextPassphrases) || "on".equalsIgnoreCase(storePlainTextPassphrases) || "true".equalsIgnoreCase(storePlainTextPassphrases); }
protected boolean isStorePlainTextPasswords(String realm, SVNAuthentication auth) throws SVNException { SVNURL url = auth.getURL(); String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storePlainTextPasswords = (String) properties.get("store-plaintext-passwords"); if (storePlainTextPasswords == null) { if (myAuthStoreHandler != null) { return myAuthStoreHandler.canStorePlainTextPasswords(realm, auth); } return false; } return "yes".equalsIgnoreCase(storePlainTextPasswords) || "on".equalsIgnoreCase(storePlainTextPasswords) || "true".equalsIgnoreCase(storePlainTextPasswords); }
protected boolean isStorePlainTextPasswords(String realm, SVNAuthentication auth) throws SVNException { SVNURL url = auth.getURL(); String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storePlainTextPasswords = (String) properties.get("store-plaintext-passwords"); if (storePlainTextPasswords == null) { if (myAuthStoreHandler != null) { return myAuthStoreHandler.canStorePlainTextPasswords(realm, auth); } return false; } return "yes".equalsIgnoreCase(storePlainTextPasswords) || "on".equalsIgnoreCase(storePlainTextPasswords) || "true".equalsIgnoreCase(storePlainTextPasswords); }
protected boolean isStorePlainTextPassphrases(String realm, SVNAuthentication auth) throws SVNException { SVNURL url = auth.getURL(); String host = url != null ? url.getHost() : null; Map properties = getHostProperties(host); String storePlainTextPassphrases = (String) properties.get("store-ssl-client-cert-pp-plaintext"); if (storePlainTextPassphrases == null) { if (myAuthStoreHandler != null) { return myAuthStoreHandler.canStorePlainTextPassphrases(realm, auth); } return false; } return "yes".equalsIgnoreCase(storePlainTextPassphrases) || "on".equalsIgnoreCase(storePlainTextPassphrases) || "true".equalsIgnoreCase(storePlainTextPassphrases); }
public ISVNProxyManager getProxyManager(SVNURL url) throws SVNException { String host = url.getHost(); Map properties = getHostProperties(host); String proxyHost = (String) properties.get("http-proxy-host"); if (proxyHost == null || "".equals(proxyHost.trim())) { return null; } String proxyExceptions = (String) properties.get("http-proxy-exceptions"); if (proxyExceptions != null) { for(StringTokenizer exceptions = new StringTokenizer(proxyExceptions, ","); exceptions.hasMoreTokens();) { String exception = exceptions.nextToken().trim(); if (DefaultSVNOptions.matches(exception, host)) { return null; } } } String proxyPort = (String) properties.get("http-proxy-port"); String proxyUser = (String) properties.get("http-proxy-username"); String proxyPassword = (String) properties.get("http-proxy-password"); return new SimpleProxyManager(proxyHost, proxyPort, proxyUser, proxyPassword); }
public int getReadTimeout(SVNRepository repository) { String protocol = repository.getLocation().getProtocol(); if ("http".equals(protocol) || "https".equals(protocol)) { String host = repository.getLocation().getHost(); Map properties = getHostProperties(host); String timeout = (String) properties.get("http-timeout"); if (timeout != null) { try { return Integer.parseInt(timeout)*1000; } catch (NumberFormatException nfe) { } } return 3600*1000; } return 0; }
public int getReadTimeout(SVNRepository repository) { String protocol = repository.getLocation().getProtocol(); if ("http".equals(protocol) || "https".equals(protocol)) { String host = repository.getLocation().getHost(); Map properties = getHostProperties(host); String timeout = (String) properties.get("http-timeout"); if (timeout != null) { try { return Integer.parseInt(timeout)*1000; } catch (NumberFormatException nfe) { } } return 3600*1000; } return 0; }