/** * Returns an instance of {@link SSHAuthenticator} for the supplied connection and user, or {@code null} if * the factory does not support the connection and user combination. * * @param connection the connection. * @param user the user. * @param username the username or {@code null} to fall back to the username in the user parameter. * @param <C> the type of connection. * @param <U> the type of user. * @return {@code null} if the connection or user is not supported by this factory, or a {@link SSHAuthenticator} * instance bound to the supplied connection and user. * @since 1.4 */ @Nullable protected <C, U extends StandardUsernameCredentials> SSHAuthenticator<C, U> newInstance( @NonNull C connection, @NonNull U user, @CheckForNull String username) { return newInstance(connection, user); }
SSHAuthenticator<C, U> result = factory.newInstance(connection, user, username); if (result != null && result.canAuthenticate()) { return result;