本文整理汇总了Java中net.schmizz.sshj.userauth.UserAuthException类的典型用法代码示例。如果您正苦于以下问题:Java UserAuthException类的具体用法?Java UserAuthException怎么用?Java UserAuthException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserAuthException类属于net.schmizz.sshj.userauth包,在下文中一共展示了UserAuthException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: sshAuth
import net.schmizz.sshj.userauth.UserAuthException; //导入依赖的package包/类
private void sshAuth() throws IOException, UserAuthException, TransportException, CryptographyException {
if (server != null) {
ssh.connect(server.getHost(), server.getPort());
switch (server.getAuthentication().getAuthenticationTypeEnum()) {
case NO_AUTHENTICATION:
NoAuthentication noAuthentication = (NoAuthentication) server.getAuthentication();
ssh.auth(noAuthentication.getLogin());
break;
case SSH_AUTHENTICATION_PASSWORD:
SSHAuthenticationPassword sshAuthenticationPassword = (SSHAuthenticationPassword) server.getAuthentication();
String password = sshAuthenticationPassword.getDecryptPassword(myAuthentication.getKey());
PasswordFinder createOneOff = PasswordUtils.createOneOff(password.toCharArray());
ssh.auth(sshAuthenticationPassword.getLogin(), new AuthPassword(createOneOff));
break;
default:
throw new RuntimeException("authentication type is not supported");
}
} else {
throw new IllegalStateException("server is required");
}
}
开发者ID:joakim-ribier,项目名称:JOneTouch,代码行数:22,代码来源:CommandExecutor.java
示例2: resolveStateFromThrowable
import net.schmizz.sshj.userauth.UserAuthException; //导入依赖的package包/类
protected ApplicationState resolveStateFromThrowable(final Throwable throwable) {
final ApplicationState state;
if (throwable == null) {
state = ApplicationState.UNKNOWN;
}
else if (throwable instanceof UnknownHostException) {
state = ApplicationState.INVALID;
}
else if (throwable instanceof UserAuthException) {
state = ApplicationState.NO_AUTH;
}
else if (throwable instanceof TransportException) {
state = ApplicationState.UNREACHABLE;
}
else if (throwable instanceof TimeoutException) {
state = ApplicationState.UNREACHABLE;
}
else if (throwable instanceof InterruptedException) {
state = ApplicationState.UNKNOWN;
}
else {
final Throwable cause = throwable.getCause();
state = cause == null ? ApplicationState.UNREACHABLE : resolveStateFromThrowable(cause);
}
return state;
}
开发者ID:stacs-srg,项目名称:shabdiz,代码行数:28,代码来源:AbstractApplicationManager.java
示例3: connect_auth_failure
import net.schmizz.sshj.userauth.UserAuthException; //导入依赖的package包/类
@Test(expected = RaspiQueryException.class)
public void connect_auth_failure() throws RaspiQueryException,
UserAuthException, TransportException {
Mockito.doThrow(UserAuthException.class).when(sshClient)
.authPassword(Mockito.anyString(), Mockito.anyString());
raspiQuery.connect("wrong_pw");
}
开发者ID:eidottermihi,项目名称:rpicheck,代码行数:8,代码来源:ConnectAndAuthTest.java
示例4: loginAs
import net.schmizz.sshj.userauth.UserAuthException; //导入依赖的package包/类
public SftpClientBuilder loginAs(String user, String password) throws UserAuthException, TransportException {
this.user = user;
this.password = password;
return this;
}
开发者ID:signed,项目名称:in-memory-infrastructure,代码行数:6,代码来源:SftpClientBuilder.java
注:本文中的net.schmizz.sshj.userauth.UserAuthException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论