@Override public boolean isHostMatch(String host, int port) { if (super.isHostMatch(host, port)) { return true; } KnownHostHashValue hash = getHashedEntry(); return (hash != null) && hash.isHostMatch(host); }
/** * Resolves the effective username * * @param originalUser The original requested username * @return If the configured host entry username is not {@code null}/empty * then it is used, otherwise the original one. * @see #resolveUsername(String) */ public String resolveUsername(String originalUser) { return resolveUsername(originalUser, getUsername()); }
/** * Checks if a given host name / address matches the entry's host pattern(s) * * @param host The host name / address - ignored if {@code null}/empty * @param port The connection port * @return {@code true} if the name / address matches the pattern(s) * @see #isHostMatch(String, Pattern) */ public boolean isHostMatch(String host, int port) { return isHostMatch(host, port, getPatterns()); }
public HostConfigEntry(String pattern, String host, int port, String username) { setHost(pattern); setHostName(host); setPort(port); setUsername(username); }
/** * @param portValue The global port value - ignored if not positive * or already have a configured port * @return {@code true} if updated the port value */ public boolean updateGlobalPort(int portValue) { if ((portValue <= 0) || (getPort() > 0)) { return false; } setPort(portValue); return true; }
/** * Resolves the effective port to use * * @param originalPort The original requested port * @return If the host entry port is positive, then it is used, otherwise * the original requested port * @see #resolvePort(int, int) */ public int resolvePort(int originalPort) { return resolvePort(originalPort, getPort()); }
public void setHost(String host) { this.host = host; setPatterns(parsePatterns(parseConfigValue(host))); }
/** * @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 identitiesOnly Whether to use only the identities in this entry. * Ignored if already set * @return {@code true} if updated the option value */ public boolean updateGlobalIdentityOnly(boolean identitiesOnly) { if (exclusiveIdentites != null) { return false; } setIdentitiesOnly(identitiesOnly); return true; }
/** * @param strict If {@code true} then makes sure that the containing folder * has 0700 access and the file 0644. <B>Note:</B> for <I>Windows</I> it * does not check these permissions * @see #validateStrictConfigFilePermissions(Path, LinkOption...) */ public DefaultConfigFileHostEntryResolver(boolean strict) { this(HostConfigEntry.getDefaultHostConfigFile(), strict); }
public HostConfigEntry(String pattern, String host, int port, String username) { setHost(pattern); setHostName(host); setPort(port); setUsername(username); }
@Override public boolean isHostMatch(String host, int port) { if (super.isHostMatch(host, port)) { return true; } KnownHostHashValue hash = getHashedEntry(); return (hash != null) && hash.isHostMatch(host, port); }
/** * Resolves the effective username * * @param originalUser The original requested username * @return If the configured host entry username is not {@code null}/empty * then it is used, otherwise the original one. * @see #resolveUsername(String) */ public String resolveUsername(String originalUser) { return resolveUsername(originalUser, getUsername()); }
/** * @param portValue The global port value - ignored if not positive * or already have a configured port * @return {@code true} if updated the port value */ public boolean updateGlobalPort(int portValue) { if ((portValue <= 0) || (getPort() > 0)) { return false; } setPort(portValue); return true; }
/** * Resolves the effective port to use * * @param originalPort The original requested port * @return If the host entry port is positive, then it is used, otherwise * the original requested port * @see #resolvePort(int, int) */ public int resolvePort(int originalPort) { return resolvePort(originalPort, getPort()); }
public void setHost(String host) { this.host = host; setPatterns(parsePatterns(parseConfigValue(host))); }
/** * Checks if a given host name / address matches the entry's host pattern(s) * * @param host The host name / address - ignored if {@code null}/empty * @param port The connection port * @return {@code true} if the name / address matches the pattern(s) * @see #isHostMatch(String, Pattern) */ public boolean isHostMatch(String host, int port) { return isHostMatch(host, port, getPatterns()); }
/** * @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 identitiesOnly Whether to use only the identities in this entry. * Ignored if already set * @return {@code true} if updated the option value */ public boolean updateGlobalIdentityOnly(boolean identitiesOnly) { if (exclusiveIdentites != null) { return false; } setIdentitiesOnly(identitiesOnly); return true; }
/** * @param strict If {@code true} then makes sure that the containing folder * has 0700 access and the file 0644. <B>Note:</B> for <I>Windows</I> it * does not check these permissions * @see #validateStrictConfigFilePermissions(Path, LinkOption...) */ public DefaultConfigFileHostEntryResolver(boolean strict) { this(HostConfigEntry.getDefaultHostConfigFile(), strict); }