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


Java UnsupportedCredentialItem类代码示例

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


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

示例1: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
    for (CredentialItem i : items) {
        if (i instanceof Identity) {
            ((Identity) i).setValue(identityFile);
            continue;
        }
        if (i instanceof KnownHosts) {
            ((KnownHosts) i).setValue(knownHostsFile);
            continue;
        }
        throw new UnsupportedCredentialItem(uri, i.getClass().getName()
                + ":" + i.getPromptText()); //$NON-NLS-1$
    }
    return true;
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:17,代码来源:PrivateKeyCredentialsProvider.java

示例2: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get(URIish urIish, CredentialItem... credentialItems) throws UnsupportedCredentialItem {
    if (userCredentials != null) {
        Iterator<String> userCredentialsIterator = userCredentials.iterator();
        for(CredentialItem item : credentialItems) {
            String nextValue = userCredentialsIterator.next();
            if (item instanceof CredentialItem.Username) {
                ((CredentialItem.Username)item).setValue(nextValue);
            } else if (item instanceof CredentialItem.Password) {
                ((CredentialItem.Password)item).setValue(nextValue.toCharArray());
            } else if (item instanceof CredentialItem.StringType) {
                ((CredentialItem.StringType)item).setValue(nextValue);
            } else {
                System.out.println(item);
                System.out.println(item.getPromptText());
                throw new UnsupportedCredentialItem(urIish, "Case not covered in ElegitCredentialsProvider");
            }
        }
    }
    return true;
}
 
开发者ID:dmusican,项目名称:Elegit,代码行数:22,代码来源:ElegitCredentialsProvider.java

示例3: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get(final URIish uri,
                   final CredentialItem... items) throws UnsupportedCredentialItem {
    try {
        return super.get(uri,
                         items);
    } catch (UnsupportedCredentialItem e) {
        for (CredentialItem i : items) {
            if (i instanceof CredentialItem.YesNoType) {
                ((CredentialItem.YesNoType) i).setValue(true);
                return true;
            } else {
                continue;
            }
        }
    }
    return false;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:UsernamePasswordCredentialsProvider.java

示例4: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items)
        throws UnsupportedCredentialItem {
    for (CredentialItem item : items) {
        if (item instanceof CredentialItem.Username) {
            ((CredentialItem.Username) item).setValue(username);
        } else if (item instanceof CredentialItem.Password) {
            ((CredentialItem.Password) item).setValue(password.toCharArray());
        } else if (item instanceof CredentialItem.StringType) {
            ((CredentialItem.StringType) item).setValue(password);
        } else if (item instanceof CredentialItem.InformationalMessage) {
            throw new UnsupportedCredentialItem(uri, "Not supported");
        } else if (item instanceof CredentialItem.YesNoType) {
            // TODO handle strict host key checking here
            throw new UnsupportedCredentialItem(uri, "Not supported");
        } else {
            throw new UnsupportedCredentialItem(uri, "Not supported");
        }
    }
    return true;
}
 
开发者ID:hdweiss,项目名称:mOrgAnd,代码行数:22,代码来源:JGitCredentialsProvider.java

示例5: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
	for(CredentialItem item : items){
		if(item instanceof CredentialItem.YesNoType){
			((CredentialItem.YesNoType) item).setValue(true);
			return true;
		}
	}
	return false;
}
 
开发者ID:coding-dream,项目名称:Notebook,代码行数:11,代码来源:AllowHostsCredentialsProvider.java

示例6: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get (URIish uriish, CredentialItem... items) throws UnsupportedCredentialItem {
    String user = uriish.getUser();
    if (user == null) {
        user = "";
    }
    String password = uriish.getPass();
    if (password == null) {
        password = "";
    }
    for (CredentialItem i : items) {
        if (i instanceof CredentialItem.Username) {
            ((CredentialItem.Username) i).setValue(user);
            continue;
        }
        if (i instanceof CredentialItem.Password) {
            ((CredentialItem.Password) i).setValue(password.toCharArray());
            continue;
        }
        if (i instanceof CredentialItem.StringType) {
            if (i.getPromptText().equals("Password: ")) { //NOI18N
                ((CredentialItem.StringType) i).setValue(password);
                continue;
            }
        }
        throw new UnsupportedCredentialItem(uriish, i.getClass().getName()
                + ":" + i.getPromptText()); //NOI18N
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:TransportCommand.java

示例7: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
  String username = uri.getUser();
  if (username == null) {
    username = cfgUser;
  }
  if (username == null) {
    return false;
  }

  String password = uri.getPass();
  if (password == null) {
    password = cfgPass;
  }
  if (password == null) {
    return false;
  }

  for (CredentialItem i : items) {
    if (i instanceof CredentialItem.Username) {
      ((CredentialItem.Username) i).setValue(username);
    } else if (i instanceof CredentialItem.Password) {
      ((CredentialItem.Password) i).setValue(password.toCharArray());
    } else {
      throw new UnsupportedCredentialItem(uri, i.getPromptText());
    }
  }
  return true;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:30,代码来源:SecureCredentialsProvider.java

示例8: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
	System.out.println("Credentials are required to clone " + uri.toString());
	for (CredentialItem item : items) {
		if (!handle(item)) {
			return false;
		}
	}
	return true;
}
 
开发者ID:nyrkovalex,项目名称:get.me,代码行数:11,代码来源:GitCredentialsProvider.java

示例9: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
    for (CredentialItem ci : items) {
        if (ci instanceof CredentialItem.YesNoType) {
            handle((CredentialItem.YesNoType) ci);
        } else if (ci instanceof CredentialItem.StringType) {
            handle(uri, (CredentialItem.StringType) ci);
        } else if (ci instanceof CredentialItem.CharArrayType) {
            handle(uri, (CredentialItem.CharArrayType) ci);
        } else {
            return false;
        }
    }
    return true;
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:16,代码来源:GUICredentialsProvider.java

示例10: testUriWithCurlyBracesReturnsTrue

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Test
public void testUriWithCurlyBracesReturnsTrue() throws UnsupportedCredentialItem, URISyntaxException {
	GitCredentialsProviderFactory factory = new GitCredentialsProviderFactory();
	provider = (AwsCodeCommitCredentialProvider) 
	factory.createFor(CURLY_BRACES_REPO, USER, PASSWORD, null);
	CredentialItem[] credentialItems = makeCredentialItems();
	assertTrue(provider.get(new URIish(CURLY_BRACES_REPO), credentialItems));
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-config,代码行数:9,代码来源:AwsCodeCommitCredentialsProviderTests.java

示例11: testThrowsUnsupportedCredentialException

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Test
public void testThrowsUnsupportedCredentialException() throws URISyntaxException {
	CredentialItem[] goodCredentialItems = makeCredentialItems();
	CredentialItem[] badCredentialItems = new CredentialItem[] {
			goodCredentialItems[0],
			goodCredentialItems[1],
			new CredentialItem.YesNoType("OK?")
	};
	try {
		provider.get(new URIish(AWS_REPO), badCredentialItems);
		fail("Expected UnsupportedCredentialItem exception");
	} catch (UnsupportedCredentialItem e) {
		assertNotNull(e.getMessage());
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-config,代码行数:16,代码来源:AwsCodeCommitCredentialsProviderTests.java

示例12: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public synchronized boolean get(URIish uri, CredentialItem... credentialItems) throws UnsupportedCredentialItem {
    StandardCredentials c = specificCredentials.get(uri == null ? null : uri.toString());
    if (c == null) {
        c = defaultCredentials;
    }
    if (c == null) {
        return false;
    }
    for (CredentialItem i : credentialItems) {
        if (i instanceof StandardUsernameCredentialsCredentialItem && c instanceof StandardUsernameCredentials) {
            ((StandardUsernameCredentialsCredentialItem) i).setValue((StandardUsernameCredentials) c);
            continue;
        }
        if (i instanceof CredentialItem.Username && c instanceof UsernameCredentials) {
            ((CredentialItem.Username) i).setValue(((UsernameCredentials)c).getUsername());
            continue;
        }
        if (i instanceof CredentialItem.Password && c instanceof PasswordCredentials) {
            ((CredentialItem.Password) i).setValue(
                    ((PasswordCredentials) c).getPassword().getPlainText().toCharArray());
            continue;
        }
        if (i instanceof CredentialItem.StringType) {
            if (i.getPromptText().equals("Password: ") && c instanceof PasswordCredentials) {
                ((CredentialItem.StringType) i).setValue(((PasswordCredentials) c).getPassword().getPlainText());
                continue;
            }
        }
        throw new UnsupportedCredentialItem(uri, i.getClass().getName()
                + ":" + i.getPromptText());
    }
    return true;
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:36,代码来源:SmartCredentialsProvider.java

示例13: get

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * If username/password is given, use it for HTTP auth.
 */
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
    if (!(cred instanceof StandardUsernamePasswordCredentials))
        return false;
    StandardUsernamePasswordCredentials _cred = (StandardUsernamePasswordCredentials) cred;

    for (CredentialItem i : items) {
        if (i instanceof CredentialItem.Username) {
            ((CredentialItem.Username) i).setValue(_cred.getUsername());
            continue;
        }
        if (i instanceof CredentialItem.Password) {
            ((CredentialItem.Password) i).setValue(
                    _cred.getPassword().getPlainText().toCharArray());
            continue;
        }
        if (i instanceof CredentialItem.StringType) {
            if (i.getPromptText().equals("Password: ")) {
                ((CredentialItem.StringType) i).setValue(
                        _cred.getPassword().getPlainText());
                continue;
            }
        }
        throw new UnsupportedCredentialItem(uri, i.getClass().getName()
                + ":" + i.getPromptText());
    }
    return true;
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:34,代码来源:CredentialsProviderImpl.java

示例14: getSession

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的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

示例15: testGetThrowsException

import org.eclipse.jgit.errors.UnsupportedCredentialItem; //导入依赖的package包/类
@Test
public void testGetThrowsException() {
    String expectedUsername = "expected-add-credentials-username";
    Secret secret = Secret.fromString("password-secret");
    StandardUsernamePasswordCredentials credentials = new StandardUsernamePasswordCredentialsImpl(expectedUsername, secret);
    provider.addCredentials(gitURI.toString(), credentials);

    exception.expect(UnsupportedCredentialItem.class);
    assertTrue(provider.get(gitURI, username, password, maskedUsername, unmaskedUsername, maskedStringType));
}
 
开发者ID:jenkinsci,项目名称:git-client-plugin,代码行数:11,代码来源:SmartCredentialsProviderTest.java


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