本文整理汇总了Java中org.apache.sshd.server.auth.password.PasswordChangeRequiredException类的典型用法代码示例。如果您正苦于以下问题:Java PasswordChangeRequiredException类的具体用法?Java PasswordChangeRequiredException怎么用?Java PasswordChangeRequiredException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PasswordChangeRequiredException类属于org.apache.sshd.server.auth.password包,在下文中一共展示了PasswordChangeRequiredException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: authenticate
import org.apache.sshd.server.auth.password.PasswordChangeRequiredException; //导入依赖的package包/类
@Override
public boolean authenticate(String username, String password, ServerSession session) throws
PasswordChangeRequiredException {
try {
Authentication auth = authProvider.authenticate(
new UsernamePasswordAuthenticationToken(username, password));
session.getIoSession().setAttribute(Constants.USER, username);
session.getIoSession().setAttribute(Constants.USER_ROLES, auth.getAuthorities().stream()
.map(ga -> ga.getAuthority()).collect(Collectors.toSet()));
return true;
} catch (AuthenticationException ex) {
log.warn(ex.getMessage());
return false;
}
}
开发者ID:anand1st,项目名称:sshd-shell-spring-boot,代码行数:16,代码来源:AuthProviderSshdPasswordAuthenticator.java
示例2: authenticate
import org.apache.sshd.server.auth.password.PasswordChangeRequiredException; //导入依赖的package包/类
@Override
public boolean authenticate(String username, String password, ServerSession session) throws
PasswordChangeRequiredException {
session.getIoSession().setAttribute(Constants.USER_ROLES, Collections.<String>singleton("*"));
session.getIoSession().setAttribute(Constants.USER, username);
return username.equals(props.getUsername()) && password.equals(props.getPassword());
}
开发者ID:anand1st,项目名称:sshd-shell-spring-boot,代码行数:8,代码来源:SimpleSshdPasswordAuthenticator.java
示例3: create
import org.apache.sshd.server.auth.password.PasswordChangeRequiredException; //导入依赖的package包/类
public static SshServer create() {
SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPort(SpashConfig.getInstance().spashListenPort());
AbstractGeneratorHostKeyProvider keyProvider = new SimpleGeneratorHostKeyProvider(new File(SpashConfig.getInstance().spashKeyFileName()));
keyProvider.setAlgorithm(SpashConfig.getInstance().spashKeyAlgorithm());
keyProvider.setKeySize(SpashConfig.getInstance().spashKeyLength());
sshd.setKeyPairProvider(keyProvider);
List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<NamedFactory<UserAuth>>();
userAuthFactories.add(new UserAuthPasswordFactory());
sshd.setUserAuthFactories(userAuthFactories);
sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
@Override
public boolean authenticate(String username, String password, ServerSession serverSession) throws PasswordChangeRequiredException {
return username!=null && username.length()>0 && username.equals(password);
}
});
sshd.setShellFactory(new SpashShellFactory());
List<NamedFactory<Command>> namedFactoryList = new ArrayList<>();
namedFactoryList.add(new SftpSubsystemFactory());
sshd.setSubsystemFactories(namedFactoryList);
sshd.setCommandFactory(new ScpCommandFactory());
sshd.setFileSystemFactory(new FileSystemFactory() {
@Override
public FileSystem createFileSystem(Session session) throws IOException {
return SpashFileSystem.get().getFileSystem();
}
});
return sshd;
}
开发者ID:nerdammer,项目名称:spash,代码行数:40,代码来源:SshServerFactory.java
示例4: setup
import org.apache.sshd.server.auth.password.PasswordChangeRequiredException; //导入依赖的package包/类
@BeforeClass
public static void setup() throws Exception {
sshdServer.setPort(PORT);
sshdServer.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
sshdServer.setPasswordAuthenticator(new PasswordAuthenticator() {
public boolean authenticate(String user, String password, ServerSession serverSession) throws PasswordChangeRequiredException {
return user.equals(USERNAME) && password.equals(USERPWD);
}
});
sshdServer.start();
}
开发者ID:ziccardi,项目名称:jnrpe,代码行数:14,代码来源:CheckSSHTest.java
示例5: authenticate
import org.apache.sshd.server.auth.password.PasswordChangeRequiredException; //导入依赖的package包/类
@Override
public boolean authenticate(String username, String password, ServerSession session)
throws PasswordChangeRequiredException
{
return Objects.equals(username, "admin") && Objects.equals(password, "admin");
}
开发者ID:jeeshell,项目名称:je2sh,代码行数:7,代码来源:SshPlugin.java
示例6: authenticate
import org.apache.sshd.server.auth.password.PasswordChangeRequiredException; //导入依赖的package包/类
@Override
public boolean authenticate(String username, String password, ServerSession serverSession) throws PasswordChangeRequiredException {
return password.equals(users.get(username));
}
开发者ID:intropro,项目名称:prairie,代码行数:5,代码来源:CollectionPasswordAuthenticator.java
示例7: authenticate
import org.apache.sshd.server.auth.password.PasswordChangeRequiredException; //导入依赖的package包/类
@Override
public boolean authenticate(String username, String password, ServerSession session)
throws PasswordChangeRequiredException {
return username.equals("testuser") && password.equals("pass");
}
开发者ID:streamsets,项目名称:datacollector,代码行数:6,代码来源:TestRemoteDownloadSource.java
注:本文中的org.apache.sshd.server.auth.password.PasswordChangeRequiredException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论