Package org.apache.sshd.common.config
Class SshConfigFileReader
java.lang.Object
org.apache.sshd.common.config.SshConfigFileReader
Reads and interprets some useful configurations from an OpenSSH configuration file.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <M extends AbstractFactoryManager>
Mconfigure(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) Configures anAbstractFactoryManagerwith the values read from some configuration.static <M extends AbstractFactoryManager>
MconfigureCiphers(M manager, String value, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureCiphers(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureCompression(M manager, String value, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureCompression(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) Configure the factory manager using one of the knownCompressionConfigValues.static <M extends AbstractFactoryManager>
MconfigureKeyExchanges(M manager, String value, boolean lenient, Function<? super DHFactory, ? extends KeyExchangeFactory> xformer, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureKeyExchanges(M manager, PropertyResolver props, boolean lenient, Function<? super DHFactory, ? extends KeyExchangeFactory> xformer, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureMacs(M manager, String value, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureMacs(M manager, PropertyResolver resolver, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureSignatures(M manager, String value, boolean lenient, boolean ignoreUnsupported) static <M extends AbstractFactoryManager>
MconfigureSignatures(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) static BuiltinCiphers.ParseResultgetCiphers(PropertyResolver props) static CompressionFactorygetCompression(PropertyResolver props) getKexFactories(PropertyResolver props) static BuiltinMacs.ParseResultgetMacs(PropertyResolver props) getSignatures(PropertyResolver props)
-
Constructor Details
-
SshConfigFileReader
private SshConfigFileReader()
-
-
Method Details
-
getCiphers
- Parameters:
props- ThePropertyResolver- ignored ifnull/empty- Returns:
- A
ParseResultof all theNamedFactory-ies whose name appears in the string and represent a built-in cipher. Any unknown name is ignored. The order of the returned result is the same as the original order - bar the unknown ciphers. Note: it is up to caller to ensure that the lists do not contain duplicates - See Also:
-
getMacs
- Parameters:
props- ThePropertyResolver- ignored ifnull/empty- Returns:
- A
ParseResultof all theNamedFactory-ies whose name appears in the string and represent a built-in MAC. Any unknown name is ignored. The order of the returned result is the same as the original order - bar the unknown MACs. Note: it is up to caller to ensure that the list does not contain duplicates - See Also:
-
getSignatures
- Parameters:
props- ThePropertyResolver- ignored ifnull/empty- Returns:
- A
ParseResultof all theNamedFactorywhose name appears in the string and represent a built-in signature. Any unknown name is ignored. The order of the returned result is the same as the original order - bar the unknown signatures. Note: it is up to caller to ensure that the list does not contain duplicates - See Also:
-
getKexFactories
- Parameters:
props- ThePropertyResolver- ignored ifnull/empty- Returns:
- A
ParseResultof all theDHFactory-ies whose name appears in the string and represent a built-in value. Any unknown name is ignored. The order of the returned result is the same as the original order - bar the unknown ones. Note: it is up to caller to ensure that the list does not contain duplicates - See Also:
-
getCompression
- Parameters:
props- ThePropertyResolver- ignored ifnull/empty- Returns:
- The matching
NamedFactoryfor the configured value.nullif no configuration or unknown name specified - See Also:
-
configure
public static <M extends AbstractFactoryManager> M configure(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) Configures an
AbstractFactoryManagerwith the values read from some configuration. Currently it configures:- The
Ciphers - via theConfigFileReaderSupport.CIPHERS_CONFIG_PROP - The
Macs - via theConfigFileReaderSupport.MACS_CONFIG_PROP - The
Signatures - via theConfigFileReaderSupport.HOST_KEY_ALGORITHMS_CONFIG_PROP - The
Compression- via theConfigFileReaderSupport.COMPRESSION_PROP
- Type Parameters:
M- The generic factory manager- Parameters:
manager- TheAbstractFactoryManagerto configureprops- ThePropertyResolverto use for configuration - Note: if any known configuration value has a default and does not appear in the properties, the default is usedlenient- Iftruethen any unknown configuration values are ignored. Otherwise anIllegalArgumentExceptionis thrownignoreUnsupported- filter out unsupported configuration values (e.g., ciphers, key exchanges, etc..). Note: if after filtering out all the unknown or unsupported values there is an empty configuration exception is thrown- Returns:
- The configured manager
- The
-
configureCiphers
public static <M extends AbstractFactoryManager> M configureCiphers(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) -
configureCiphers
public static <M extends AbstractFactoryManager> M configureCiphers(M manager, String value, boolean lenient, boolean ignoreUnsupported) -
configureSignatures
public static <M extends AbstractFactoryManager> M configureSignatures(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) -
configureSignatures
public static <M extends AbstractFactoryManager> M configureSignatures(M manager, String value, boolean lenient, boolean ignoreUnsupported) -
configureMacs
public static <M extends AbstractFactoryManager> M configureMacs(M manager, PropertyResolver resolver, boolean lenient, boolean ignoreUnsupported) -
configureMacs
public static <M extends AbstractFactoryManager> M configureMacs(M manager, String value, boolean lenient, boolean ignoreUnsupported) -
configureKeyExchanges
public static <M extends AbstractFactoryManager> M configureKeyExchanges(M manager, PropertyResolver props, boolean lenient, Function<? super DHFactory, ? extends KeyExchangeFactory> xformer, boolean ignoreUnsupported) - Type Parameters:
M- The generic factory manager- Parameters:
manager- TheAbstractFactoryManagerto set up (may not benull)props- The (non-null)PropertyResolvercontaining the configurationlenient- Iftruethen any unknown/unsupported configuration values are ignored. Otherwise anIllegalArgumentExceptionis thrownxformer- AFunctionto convert the configuredDHFactory-ies toNamedFactory-ies ofKeyExchangeignoreUnsupported- Filter out any un-supported configurations - Note: if after ignoring the unknown and un-supported values the result is an empty list of factories and exception is thrown- Returns:
- The configured manager
- See Also:
-
configureKeyExchanges
public static <M extends AbstractFactoryManager> M configureKeyExchanges(M manager, String value, boolean lenient, Function<? super DHFactory, ? extends KeyExchangeFactory> xformer, boolean ignoreUnsupported) -
configureCompression
public static <M extends AbstractFactoryManager> M configureCompression(M manager, PropertyResolver props, boolean lenient, boolean ignoreUnsupported) Configure the factory manager using one of the knownCompressionConfigValues.- Type Parameters:
M- The generic factory manager- Parameters:
manager- TheAbstractFactoryManagerto configureprops- The configurationPropertieslenient- Iftrueand an unknown value is provided then it is ignoredignoreUnsupported- Iffalsethen check if the compression is currently supported before setting it- Returns:
- The configured manager - Note: if the result of filtering due to lenient mode or ignored unsupported value is empty then no factories are set
-
configureCompression
public static <M extends AbstractFactoryManager> M configureCompression(M manager, String value, boolean lenient, boolean ignoreUnsupported)
-