Package net.schmizz.sshj.userauth.password

Examples of net.schmizz.sshj.userauth.password.PasswordFinder


     * @throws TransportException if there was a transport-layer error
     */
    public void authPassword(final String username, final char[] password)
            throws UserAuthException, TransportException {
        try {
            authPassword(username, new PasswordFinder() {

                @Override
                public char[] reqPassword(Resource<?> resource) {
                    return password.clone();
                }
View Full Code Here


        SSHClient ssh = new SSHClient();
        // ssh.useCompression(); // Can lead to significant speedup (needs JZlib in classpath)
        ssh.loadKnownHosts();
        ssh.connect("dev4");
        try {
          PasswordFinder password = PasswordUtils.createOneOff("Reishee1".toCharArray());
          final String base = System.getProperty("user.home") + File.separator + ".ssh" + File.separator;
          final KeyProvider keyProvider = ssh.loadKeys(base + "id_dsa", password);
         
          final String user = System.getProperty("user.name");
          ssh.authPublickey(user, keyProvider);
View Full Code Here

                } catch (IOException e) {
                    throw new RuntimeIOException("Cannot read key from private key file " + privateKeyFile, e);
                }
                client.authPublickey(username, keys);
            } else if (password != null) {
                PasswordFinder passwordFinder = getPasswordFinder();
                client.auth(username, new AuthPassword(passwordFinder),
                        new AuthKeyboardInteractive(new RegularExpressionPasswordResponseProvider(passwordFinder, interactiveKeyboardAuthPromptRegex)));
            }
            sshClient = client;
            connected();
View Full Code Here

            throw new RuntimeIOException("Cannot connect to " + this, e);
        }
    }

    private PasswordFinder getPasswordFinder() {
        return new PasswordFinder() {

            @Override
            public char[] reqPassword(Resource<?> resource) {
                return password.toCharArray();
            }
View Full Code Here

    private static final char[] SECRET_PASSWORD = "secret".toCharArray();
    private RegularExpressionPasswordResponseProvider provider;

    @BeforeMethod
    public void setup() {
        provider = new RegularExpressionPasswordResponseProvider(new PasswordFinder() {
            @Override
            public char[] reqPassword(Resource<?> resource) {
                return SECRET_PASSWORD;
            }
View Full Code Here

     * @throws TransportException if there was a transport-layer error
     */
    public void authPassword(final String username, final char[] password)
            throws UserAuthException, TransportException {
        try {
            authPassword(username, new PasswordFinder() {

                @Override
                public char[] reqPassword(Resource<?> resource) {
                    return password.clone();
                }
View Full Code Here

TOP

Related Classes of net.schmizz.sshj.userauth.password.PasswordFinder

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.