@Override public void init() { String authorizedKeyPath = getContext().getProperty(AUTHORIZED_KEY_PATH); if (authorizedKeyPath != null) { File f = new File(authorizedKeyPath); if (f.exists() && f.isFile()) { log.log(Level.FINE, "Found authorized key path " + authorizedKeyPath); Set<PublicKey> keys; keys = new LinkedHashSet<PublicKey>(); KeyPairProvider provider = new FilePublicKeyProvider(new String[]{authorizedKeyPath}); for (String type : TYPES) { KeyPair pair = provider.loadKey(type); if (pair != null) { PublicKey key = pair.getPublic(); if (key != null) { keys.add(key); } } } authorizedKeys = keys; } else { log.log(Level.FINE, "Ignoring invalid authorized key path " + authorizedKeyPath); } } }
/** * @param name The factory name (case <U>insensitive</U>) - ignored if {@code null}/empty * @return The matching factory instance - {@code null} if no match found */ public static UserAuthFactory fromFactoryName(String name) { Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); if (factory == null) { return null; } return factory.create(); }
/** * @param resolver The {@link PropertyResolver} instance * @param name The property name * @param value The new value - if {@code null} or an empty {@link CharSequence} * the property is <U>removed</U> * @return The previous value - {@code null} if none */ public static Object updateProperty(PropertyResolver resolver, String name, Object value) { return updateProperty(resolver.getProperties(), name, value); }
public void setNioWorkers(int nioWorkers) { if (nioWorkers > 0) { PropertyResolverUtils.updateProperty(this, NIO_WORKERS, nioWorkers); } else { PropertyResolverUtils.updateProperty(this, NIO_WORKERS, null); } }
@Override public Digest getHash() throws Exception { return factory.create(); } }
/** * @param name The curve name (case <U>insensitive</U> - ignored if * {@code null}/empty * @return The matching {@link ECCurves} instance - {@code null} if no * match found */ public static ECCurves fromCurveName(String name) { return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); }
@Override public boolean isSupported() { if (factory instanceof OptionalFeature) { return ((OptionalFeature) factory).isSupported(); } else { return true; } }
public static int getNioWorkers(FactoryManager manager) { int nb = manager.getIntProperty(FactoryManager.NIO_WORKERS, FactoryManager.DEFAULT_NIO_WORKERS); if (nb > 0) { return nb; } else { return FactoryManager.DEFAULT_NIO_WORKERS; } } }
public static String getAuthCommandName(int cmd) { switch(cmd) { case SshConstants.SSH_MSG_USERAUTH_REQUEST: return "SSH_MSG_USERAUTH_REQUEST"; case SshConstants.SSH_MSG_USERAUTH_INFO_REQUEST: return "SSH_MSG_USERAUTH_INFO_REQUEST"; default: return SshConstants.getCommandMessageName(cmd); } } }
protected String nextServiceName() { synchronized (lock) { return nextServiceFactory.getName(); } }
public static boolean toBoolean(Object value, boolean defaultValue) { if (value == null) { return defaultValue; } else { return toBoolean(value); } }
/** * @param name The factory name (case <U>insensitive</U>) - ignored if {@code null}/empty * @return The matching factory instance - {@code null} if no match found */ public static UserAuthFactory fromFactoryName(String name) { Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); if (factory == null) { return null; } return factory.create(); }
/** * @param resolver The {@link PropertyResolver} instance * @param name The property name * @param value The new value - if {@code null} or an empty {@link CharSequence} * the property is <U>removed</U> * @return The previous value - {@code null} if none */ public static Object updateProperty(PropertyResolver resolver, String name, Object value) { return updateProperty(resolver.getProperties(), name, value); }
public void setNioWorkers(int nioWorkers) { if (nioWorkers > 0) { PropertyResolverUtils.updateProperty(this, NIO_WORKERS, nioWorkers); } else { PropertyResolverUtils.updateProperty(this, NIO_WORKERS, null); } }
/** * @param name The factory name - ignored if {@code null}/empty * @return The matching {@link BuiltinSignatures} whose factory name matches * (case <U>insensitive</U>) the provided name - {@code null} if no match */ public static BuiltinSignatures fromFactoryName(String name) { return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); }
/** * @param name The factory name (case <U>insensitive</U>) - ignored if {@code null}/empty * @return The matching factory instance - {@code null} if no match found */ public static UserAuthFactory fromFactoryName(String name) { Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); if (factory == null) { return null; } return factory.create(); }
public static Object updateProperty(PropertyResolver resolver, String name, long value) { return updateProperty(resolver.getProperties(), name, value); }
/** * @param name The request name - ignored if {@code null}/empty * @return The matching {@link Type} value - case <U>insensitive</U>, * or {@code null} if no match found */ public static Type fromName(String name) { return NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); }
/** * @param name The factory name (case <U>insensitive</U>) - ignored if {@code null}/empty * @return The matching factory instance - {@code null} if no match found */ public static UserAuthFactory fromFactoryName(String name) { Factory<UserAuthFactory> factory = NamedResource.findByName(name, String.CASE_INSENSITIVE_ORDER, VALUES); if (factory == null) { return null; } return factory.create(); }
public static Object updateProperty(PropertyResolver resolver, String name, boolean value) { return updateProperty(resolver.getProperties(), name, value); }