/** * @param name Property name - never {@code null}/empty * @return Property value or {@code null} if no such property * @see #getProperty(String, String) */ public String getProperty(String name) { return getProperty(name, null); }
/** * @param name Property name - never {@code null}/empty * @return Property value or {@code null} if no such property * @see #getProperty(String, String) */ public String getProperty(String name) { return getProperty(name, null); }
@Override public String getProperty(String name, String defaultValue) { // Upstream bug fix (SSHD-867): if there are _no_ properties at all, the // super implementation returns always null even if a default value is // given. // // See https://issues.apache.org/jira/projects/SSHD/issues/SSHD-867 // // TODO: remove this override once we're based on sshd > 2.1.0 Map<String, String> properties = getProperties(); if (properties == null || properties.isEmpty()) { return defaultValue; } return super.getProperty(name, defaultValue); }
private int getNumberOfPasswordPrompts(HostConfigEntry hostConfig) { String prompts = hostConfig .getProperty(SshConstants.NUMBER_OF_PASSWORD_PROMPTS); if (prompts != null) { prompts = prompts.trim(); int value = positive(prompts); if (value > 0) { return value; } log.warn(format(SshdText.get().configInvalidPositive, SshConstants.NUMBER_OF_PASSWORD_PROMPTS, prompts)); } // Default for NumberOfPasswordPrompts according to // https://man.openbsd.org/ssh_config return 3; }
HostConfigEntry entry = ((JGitClientSession) session) .getHostConfigEntry(); String value = entry.getProperty( SshConstants.STRICT_HOST_KEY_CHECKING, "ask"); switch (value.toLowerCase(Locale.ROOT)) {
String curValue = getProperty(key); if (GenericUtils.length(curValue) > 0) { continue;
String curValue = getProperty(key); if (GenericUtils.length(curValue) > 0) { continue;
JGitSshClient.HOST_CONFIG_ENTRY); String hostKeyAlgorithms = config .getProperty(SshConstants.HOST_KEY_ALGORITHMS); if (hostKeyAlgorithms != null && !hostKeyAlgorithms.isEmpty()) { char first = hostKeyAlgorithms.charAt(0);
/** * Appends a value using a <U>comma</U> to an existing one. If no previous * value then same as calling {@link #setProperty(String, String)}. * * @param name Property name - never {@code null}/empty * @param value The value to be appended - ignored if {@code null}/empty * @return The value <U>before</U> appending - {@code null} if no previous value */ public String appendPropertyValue(String name, String value) { String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property name"); String curVal = getProperty(key); if (GenericUtils.isEmpty(value)) { return curVal; } if (GenericUtils.isEmpty(curVal)) { return setProperty(key, value); } return setProperty(key, curVal + ',' + value); }
/** * Appends a value using a <U>comma</U> to an existing one. If no previous * value then same as calling {@link #setProperty(String, String)}. * * @param name Property name - never {@code null}/empty * @param value The value to be appended - ignored if {@code null}/empty * @return The value <U>before</U> appending - {@code null} if no previous value */ public String appendPropertyValue(String name, String value) { String key = ValidateUtils.checkNotNullAndNotEmpty(name, "No property name"); String curVal = getProperty(key); if (GenericUtils.isEmpty(value)) { return curVal; } if (GenericUtils.isEmpty(curVal)) { return setProperty(key, value); } return setProperty(key, curVal + ',' + value); }
hostConfig.getProperty(SshConstants.PREFERRED_AUTHENTICATIONS, getAttribute(PREFERRED_AUTHENTICATIONS)), PREFERRED_AUTHS);