Package org.apache.commons.vfs.auth

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


    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

            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

          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

    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

TOP

Related Classes of org.apache.commons.vfs.auth.StaticUserAuthenticator

Copyright © 2018 www.massapicom. 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.