Example usage for org.apache.commons.vfs2.provider.sftp SftpFileProvider AUTHENTICATOR_TYPES

List of usage examples for org.apache.commons.vfs2.provider.sftp SftpFileProvider AUTHENTICATOR_TYPES

Introduction

In this page you can find the example usage for org.apache.commons.vfs2.provider.sftp SftpFileProvider AUTHENTICATOR_TYPES.

Prototype

UserAuthenticationData.Type[] AUTHENTICATOR_TYPES

To view the source code for org.apache.commons.vfs2.provider.sftp SftpFileProvider AUTHENTICATOR_TYPES.

Click Source Link

Document

Authentication types.

Usage

From source file:org.pentaho.di.core.vfs.SftpFileSystemWindows.java

/**
 * {@link  org.apache.commons.vfs2.provider.sftp.SftpFileSystem#getChannel() }
 *
 *//*  ww w .ja  v  a 2  s.  c om*/
private void ensureSession() throws FileSystemException {
    if (this.session == null || !this.session.isConnected()) {
        this.doCloseCommunicationLink();
        UserAuthenticationData authData = null;

        Session session;
        try {
            GenericFileName e = (GenericFileName) this.getRootName();
            authData = UserAuthenticatorUtils.authenticate(this.getFileSystemOptions(),
                    SftpFileProvider.AUTHENTICATOR_TYPES);
            session = SftpClientFactory.createConnection(e.getHostName(), e.getPort(),
                    UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME,
                            UserAuthenticatorUtils.toChar(e.getUserName())),
                    UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD,
                            UserAuthenticatorUtils.toChar(e.getPassword())),
                    this.getFileSystemOptions());
        } catch (Exception var7) {
            throw new FileSystemException("vfs.provider.sftp/connect.error", this.getRootName(), var7);
        } finally {
            UserAuthenticatorUtils.cleanup(authData);
        }

        this.session = session;
    }

}