當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。