Examples of StaticUserAuthenticator


Examples of org.apache.commons.vfs.auth.StaticUserAuthenticator

        // if you set the sftp path (e.g. /tmp) and also setUserDirIsRoot(opts, true)
        // then exceptions are thrown by the sftp impl (bug)!
        //SftpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(defaultOpts, true); // null by default.
        //Boolean byDef = SftpFileSystemConfigBuilder.getInstance().getUserDirIsRoot(defaultOpts);

        StaticUserAuthenticator auth = new StaticUserAuthenticator(null, this.sftpUsername, this.sftpPassword); //domain, user, pass
        DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(defaultOpts, auth);
        FileObject relativeToFO_ = fsManager.resolveFile(sftpUri, defaultOpts);
        // cant getAttributes with sftp FS, thus are unable to get home dir !

        return relativeToFO_;
View Full Code Here

Examples of org.apache.commons.vfs.auth.StaticUserAuthenticator

    WebSolutionFileProvider.setConnectionTimeout(getTimeout(loginData) * 1000);
    final String normalizedUrl = normalizeURL(loginData.getUrl());
    final FileSystemOptions fileSystemOptions = new FileSystemOptions();
    final DefaultFileSystemConfigBuilder configBuilder = new DefaultFileSystemConfigBuilder();
    configBuilder.setUserAuthenticator(fileSystemOptions, new StaticUserAuthenticator(normalizedUrl,
        loginData.getUsername(), loginData.getPassword()));
    return fileSystemManager.resolveFile(normalizedUrl, fileSystemOptions);
  }
View Full Code Here

Examples of org.apache.commons.vfs.auth.StaticUserAuthenticator

            if (manager == null) {
              manager = VFS.getManager();
            }
              // Build a new file system options object
              this.fileSystemOptions = new FileSystemOptions();
              StaticUserAuthenticator auth = new StaticUserAuthenticator(null, connectionProperties.getUsername(), connectionProperties.getPassword());
              DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(fileSystemOptions, auth);
              if(connectionProperties.getType().equals("ftp")) {               
          //FtpFileSystemConfigBuilder.getInstance().setPassiveMode(fileSystemOptions, connectionProperties.getPassive());
          FtpFileSystemConfigBuilder.getInstance().setDataTimeout(fileSystemOptions, connectionProperties.getTimeoutSeconds() * 10);
          FtpFileSystemConfigBuilder.getInstance().setSoTimeout(fileSystemOptions, connectionProperties.getTimeoutSeconds() * 1000);
 
View Full Code Here

Examples of org.apache.commons.vfs.auth.StaticUserAuthenticator

          catch (Exception e) {
            e.printStackTrace();
          }
        }
      }
        StaticUserAuthenticator auth = new StaticUserAuthenticator(connectionId, getUsername(), getPassword());
        try {
          DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(fileSystemOptions, auth);
        } catch (FileSystemException e2) {
          // TODO Auto-generated catch block
          e2.printStackTrace();
View Full Code Here

Examples of org.apache.commons.vfs.auth.StaticUserAuthenticator

    public S3Shell () throws FileNotFoundException, IOException {
        Properties config = new Properties();
        config.load(new FileInputStream("config.properties"));

        StaticUserAuthenticator auth = new StaticUserAuthenticator(null, config.getProperty("aws.key-id"), config.getProperty("aws.key"));
        FileSystemOptions opts = S3FileProvider.getDefaultFileSystemOptions();
        DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);

        fsManager = VFS.getManager();
View Full Code Here

Examples of org.apache.commons.vfs2.auth.StaticUserAuthenticator

public class FTPFileSystem implements FileSystem {

  @Override
  public final void authSetup(final ConnectionDescription description, final FileSystemOptions options) throws FileSystemException {
    StaticUserAuthenticator auth = new StaticUserAuthenticator(null, description.getParameter(ConnectionDescription.PARAMETER_USERNAME), description.getSecretParameter(ConnectionDescription.PARAMETER_PASSWORD));
    FtpFileSystemConfigBuilder.getInstance().setPassiveMode(options, true);
    DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, auth);
  }
View Full Code Here

Examples of org.apache.commons.vfs2.auth.StaticUserAuthenticator

    }
  }

  @Override
  public final void authSetup(final ConnectionDescription description, final FileSystemOptions options) throws org.apache.commons.vfs2.FileSystemException {
    StaticUserAuthenticator auth = new StaticUserAuthenticator(null, description.getParameter(ConnectionDescription.PARAMETER_USERNAME), description.getSecretParameter(ConnectionDescription.PARAMETER_PASSWORD));
    DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, auth);
    SftpFileSystemConfigBuilder cfg = SftpFileSystemConfigBuilder.getInstance();
    if (null != sshDirName) {
      cfg.setKnownHosts(options, new File(sshDirName, "known_hosts"));
    }
View Full Code Here

Examples of org.apache.commons.vfs2.auth.StaticUserAuthenticator

    return new CommonsVfsConnection(description, this);
  }

  @Override
  public final void authSetup(final ConnectionDescription description, final FileSystemOptions options) throws org.apache.commons.vfs2.FileSystemException {
    StaticUserAuthenticator auth = new StaticUserAuthenticator(null, description.getParameter(ConnectionDescription.PARAMETER_USERNAME), description.getSecretParameter(ConnectionDescription.PARAMETER_PASSWORD));
    DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, auth);
  }
View Full Code Here

Examples of org.apache.commons.vfs2.auth.StaticUserAuthenticator

        assertFalse(isEmpty(config.getProperty(ACCESS_KEY)), NO_CREDENTIALS_MESSAGE);
        assertFalse(isEmpty(config.getProperty(SECRET_KEY)), NO_CREDENTIALS_MESSAGE);

        // Configure VFS
        StaticUserAuthenticator auth = new StaticUserAuthenticator(null, config.getProperty(ACCESS_KEY), config.getProperty(SECRET_KEY));
        FileSystemOptions opts = S3FileProvider.getDefaultFileSystemOptions();
        DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
    }
View Full Code Here

Examples of org.apache.commons.vfs2.auth.StaticUserAuthenticator

    if (propertyResource == null) {
      throw new IOException(propertyFileLocation + " not found");
    }
    userConfig.load(propertyResource);
    // create authenticator
    final StaticUserAuthenticator userAuthenticator = new StaticUserAuthenticator(null, userConfig.getProperty("aws.key-id", ""),
        userConfig.getProperty("aws.key", ""));
    final FileSystemOptions options = S3FileProvider.getDefaultFileSystemOptions();
    DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, userAuthenticator);
    log.info("s3 provider initialized");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.