Package net.schmizz.sshj.userauth

Examples of net.schmizz.sshj.userauth.UserAuthException


   }

   public void testOnlyRetryAuthWhenSet() {
      SshjSshClient ssh1 = createClient();
      assert !ssh1.shouldRetry(new AuthorizationException("problem", null));
      assert !ssh1.shouldRetry(new UserAuthException("problem", null));
      ssh1.retryAuth = true;
      assert ssh1.shouldRetry(new AuthorizationException("problem", null));
      assert ssh1.shouldRetry(new UserAuthException("problem", null));
   }
View Full Code Here


   public void testOnlyRetryAuthWhenSetViaProperties() {
      Properties props = new Properties();
      props.setProperty("jclouds.ssh.retry-auth", "true");
      SshjSshClient ssh1 = createClient(props);
      assert ssh1.shouldRetry(new AuthorizationException("problem", null));
      assert ssh1.shouldRetry(new UserAuthException("problem", null));
   }
View Full Code Here

            throws UserAuthException {
        PublicKey key;
        try {
            key = kProv.getPublic();
        } catch (IOException ioe) {
            throw new UserAuthException("Problem getting public key from " + kProv, ioe);
        }

        // public key as 2 strings: [ key type | key blob ]
        reqBuf.putString(KeyType.fromKey(key).toString())
              .putString(new Buffer.PlainBuffer().putPublicKey(key).getCompactData());
View Full Code Here

            throws UserAuthException {
        PrivateKey key;
        try {
            key = kProv.getPrivate();
        } catch (IOException ioe) {
            throw new UserAuthException("Problem getting private key from " + kProv, ioe);
        }

        final String kt = KeyType.fromKey(key).toString();
        Signature sigger = Factory.Named.Util.create(params.getTransport().getConfig().getSignatureFactories(), kt);
        if (sigger == null)
            throw new UserAuthException("Could not create signature instance for " + kt + " key");

        sigger.init(null, key);
        sigger.update(new Buffer.PlainBuffer()
                              .putString(params.getTransport().getSessionID())
                              .putBuffer(reqBuf) // & rest of the data for sig
View Full Code Here

                    final boolean echo = buf.readBoolean();
                    log.debug("Requesting response for challenge `{}`; echo={}", prompt, echo);
                    userReplies[i] = new CharArrWrap(provider.getResponse(prompt, echo));
                }
            } catch (Buffer.BufferException be) {
                throw new UserAuthException(be);
            }
            respond(userReplies);
        }
    }
View Full Code Here

    }

    @Override
    public void handle(Message msg, SSHPacket buf)
            throws UserAuthException, TransportException {
        throw new UserAuthException("Unknown packet received during " + getName() + " auth: " + msg);
    }
View Full Code Here

    @Override
    public void handle(Message cmd, SSHPacket buf)
            throws UserAuthException, TransportException {
        if (cmd == Message.USERAUTH_60)
            throw new UserAuthException("Password change request received; unsupported operation");
        else
            super.handle(cmd, buf);
    }
View Full Code Here

      return new SshjSshClientModule();
   }

   @Test(expectedExceptions = AuthorizationException.class)
   public void testPropateConvertsAuthException() {
      ssh.propagate(new UserAuthException(""), "");
   }
View Full Code Here

   }

   public void testOnlyRetryAuthWhenSet() {
      SshjSshClient ssh1 = createClient();
      assert !ssh1.shouldRetry(new AuthorizationException("problem", null));
      assert !ssh1.shouldRetry(new UserAuthException("problem", null));
      ssh1.retryAuth = true;
      assert ssh1.shouldRetry(new AuthorizationException("problem", null));
      assert ssh1.shouldRetry(new UserAuthException("problem", null));
   }
View Full Code Here

   public void testOnlyRetryAuthWhenSetViaProperties() {
      Properties props = new Properties();
      props.setProperty("jclouds.ssh.retry-auth", "true");
      SshjSshClient ssh1 = createClient(props);
      assert ssh1.shouldRetry(new AuthorizationException("problem", null));
      assert ssh1.shouldRetry(new UserAuthException("problem", null));
   }
View Full Code Here

TOP

Related Classes of net.schmizz.sshj.userauth.UserAuthException

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.