SshdServerConfiguration.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:sshd-shell-spring-boot 作者:
@Bean
PasswordAuthenticator passwordAuthenticator() {
    SshdShellProperties.Shell.Auth props = properties.getShell().getAuth();
    switch (props.getAuthType()) {
        case SIMPLE:
            return new SimpleSshdPasswordAuthenticator(properties);
        case AUTH_PROVIDER:
            try {
                AuthenticationProvider authProvider = Objects.isNull(props.getAuthProviderBeanName())
                        ? appContext.getBean(AuthenticationProvider.class)
                        : appContext.getBean(props.getAuthProviderBeanName(), AuthenticationProvider.class);
                return new AuthProviderSshdPasswordAuthenticator(authProvider);
            } catch (BeansException ex) {
                throw new IllegalArgumentException("Expected a default or valid AuthenticationProvider bean", ex);
            }
        default:
            throw new IllegalArgumentException("Invalid/Unsupported auth type");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号