当前位置: 首页>>代码示例>>Java>>正文


Java SSHAuthenticator类代码示例

本文整理汇总了Java中com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator的典型用法代码示例。如果您正苦于以下问题:Java SSHAuthenticator类的具体用法?Java SSHAuthenticator怎么用?Java SSHAuthenticator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SSHAuthenticator类属于com.cloudbees.jenkins.plugins.sshcredentials包,在下文中一共展示了SSHAuthenticator类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doFillCredentialsIdItems

import com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator; //导入依赖的package包/类
public static ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {

            AccessControlled ac = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
            if (!ac.hasPermission(Jenkins.ADMINISTER)) {
                return new ListBoxModel();
            }

            return new SSHUserListBoxModel().withMatching(
                    SSHAuthenticator.matcher(Connection.class),
                    CredentialsProvider.lookupCredentials(
                            StandardUsernameCredentials.class,
                            context,
                            ACL.SYSTEM,
                            SSHLauncher.SSH_SCHEME)
            );
        }
 
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:17,代码来源:DockerTemplateBase.java

示例2: doFillCredentialsIdItems

import com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator; //导入依赖的package包/类
public static ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {
    return new SSHUserListBoxModel().withMatching(
            SSHAuthenticator.matcher(Connection.class),
            CredentialsProvider.lookupCredentials(
                    StandardUsernameCredentials.class,
                    context,
                    ACL.SYSTEM,
                    SSHLauncher.SSH_SCHEME)
    );
}
 
开发者ID:KostyaSha,项目名称:yet-another-docker-plugin,代码行数:11,代码来源:DockerCreateContainer.java

示例3: doFillCredentialsIdItems

import com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator; //导入依赖的package包/类
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context) {

            AccessControlled ac = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
            if (!ac.hasPermission(Jenkins.ADMINISTER)) {
                return new ListBoxModel();
            }

            return new SSHUserListBoxModel().withMatching(SSHAuthenticator.matcher(Connection.class),
                    CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, context,
                            ACL.SYSTEM, SSHLauncher.SSH_SCHEME));
        }
 
开发者ID:jenkinsci,项目名称:docker-plugin,代码行数:12,代码来源:DockerBuilderNewTemplate.java

示例4: getSession

import com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public RemoteSession getSession(URIish uri, CredentialsProvider credentialsProvider, FS fs, int tms) throws TransportException {
    try {
        int p = uri.getPort();
        if (p<0)    p = 22;
        Connection con = new Connection(uri.getHost(), p);
        con.setTCPNoDelay(true);
        con.connect();  // TODO: host key check

        boolean authenticated;
        if (credentialsProvider instanceof SmartCredentialsProvider) {
            final SmartCredentialsProvider smart = (SmartCredentialsProvider) credentialsProvider;
            StandardUsernameCredentialsCredentialItem
                    item = new StandardUsernameCredentialsCredentialItem("Credentials for " + uri, false);
            authenticated = smart.supports(item)
                    && smart.get(uri, item)
                    && SSHAuthenticator.newInstance(con, item.getValue(), uri.getUser())
                    .authenticate(smart.listener);
        } else if (credentialsProvider instanceof CredentialsProviderImpl) {
            CredentialsProviderImpl sshcp = (CredentialsProviderImpl) credentialsProvider;

            authenticated = SSHAuthenticator.newInstance(con, sshcp.cred).authenticate(sshcp.listener);
        } else {
            authenticated = false;
        }
        if (!authenticated && con.isAuthenticationComplete())
            throw new TransportException("Authentication failure");

        return wrap(con);
    } catch (UnsupportedCredentialItem | IOException | InterruptedException e) {
        throw new TransportException(uri,"Failed to connect",e);
    }
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:35,代码来源:TrileadSessionFactory.java


注:本文中的com.cloudbees.jenkins.plugins.sshcredentials.SSHAuthenticator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。