本文整理了Java中com.jcraft.jsch.JSch.getIdentityRepository()
方法的一些代码示例,展示了JSch.getIdentityRepository()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSch.getIdentityRepository()
方法的具体详情如下:
包路径:com.jcraft.jsch.JSch
类名称:JSch
方法名:getIdentityRepository
暂无
代码示例来源:origin: apache/incubator-gobblin
@Override
protected JSch createDefaultJSch(FS fs) throws JSchException {
if (GitMonitoringService.this.isJschLoggerEnabled) {
JSch.setLogger(new JschLogger());
}
JSch defaultJSch = super.createDefaultJSch(fs);
defaultJSch.getIdentityRepository().removeAll();
if (GitMonitoringService.this.privateKeyPath != null) {
defaultJSch.addIdentity(GitMonitoringService.this.privateKeyPath, GitMonitoringService.this.passphrase);
} else {
defaultJSch.addIdentity("gaas-git", GitMonitoringService.this.privateKey, null,
GitMonitoringService.this.passphrase.getBytes(Charset.forName("UTF-8")));
}
if (!Strings.isNullOrEmpty(GitMonitoringService.this.knownHosts)) {
defaultJSch.setKnownHosts(new ByteArrayInputStream(GitMonitoringService.this.knownHosts.getBytes(Charset.forName("UTF-8"))));
} else if (!Strings.isNullOrEmpty(GitMonitoringService.this.knownHostsFile)) {
defaultJSch.setKnownHosts(GitMonitoringService.this.knownHostsFile);
}
return defaultJSch;
}
};
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch
/**
* Gets the identityRepository.
* If this.identityRepository is <code>null</code>,
* JSch#getIdentityRepository() will be invoked.
*
* @see JSch#getIdentityRepository()
*/
IdentityRepository getIdentityRepository(){
if(identityRepository == null)
return jsch.getIdentityRepository();
return identityRepository;
}
代码示例来源:origin: org.mule.jsch/jsch
/**
* Gets the identityRepository.
* If this.identityRepository is <code>null</code>,
* JSch#getIdentityRepository() will be invoked.
*
* @see JSch#getIdentityRepository()
*/
IdentityRepository getIdentityRepository(){
if(identityRepository == null)
return jsch.getIdentityRepository();
return identityRepository;
}
代码示例来源:origin: ePaul/jsch-documentation
/**
* Gets the identityRepository.
* If this.identityRepository is <code>null</code>,
* JSch#getIdentityRepository() will be invoked.
*
* @see JSch#getIdentityRepository()
*/
IdentityRepository getIdentityRepository(){
if(identityRepository == null)
return jsch.getIdentityRepository();
return identityRepository;
}
代码示例来源:origin: org.xbib/jsch-core
/**
* Gets the identityRepository.
* If this.identityRepository is <code>null</code>,
* JSch#getIdentityRepository() will be invoked.
*
* @see JSch#getIdentityRepository()
*/
IdentityRepository getIdentityRepository() {
if (identityRepository == null) {
return jsch.getIdentityRepository();
}
return identityRepository;
}
代码示例来源:origin: com.nitorcreations/willow-sshagent-auth
public void addIdentity(String identityfile, String passphrase) throws JSchException {
JSch jsch = new JSch();
jsch.addIdentity(identityfile, passphrase);
identities.addAll(jsch.getIdentityRepository().getIdentities());
logger.info("Added " + identityfile);
}
@Override
代码示例来源:origin: stackoverflow.com
new Thread(new Runnable() {
@Override
public void run() {
Session session;
JSch jsch;
try {
jsch = new JSch();
jsch.addIdentity(privateKey, "yourprivatekey");
session = jsch.getSession("git", "github.com", 22);
session.setPassword("yourpass");
// Avoid asking for key confirmation
Properties prop = new Properties();
prop.put("StrictHostKeyChecking", "no");
session.setConfig(prop);
session.connect();
if(session.isConnected()){
System.out.println(this.getClass().getSimpleName() + " CONNECTED");
System.out.println(this.getClass().getSimpleName() + " YOO " + jsch.getIdentityRepository().getName()+" "+session.getClientVersion() + " " + session.isConnected());
}else{
System.out.println(this.getClass().getSimpleName() + " NOT CONNECTED");
}
}catch (Exception e){
e.printStackTrace();
}
}
}).start();
代码示例来源:origin: danielflower/app-runner
List<String> getPublicKeys() throws Exception {
JSch jSch = createDefaultJSch(FS.DETECTED);
List<String> keys = new ArrayList<>();
for (Object o : jSch.getIdentityRepository().getIdentities()) {
Identity i = (Identity) o;
KeyPair keyPair = KeyPair.load(jSch, i.getName(), null);
StringBuilder sb = new StringBuilder();
try (StringBuilderWriter sbw = new StringBuilderWriter(sb);
OutputStream os = new WriterOutputStream(sbw, "UTF-8")) {
keyPair.writePublicKey(os, keyPair.getPublicKeyComment());
} finally {
keyPair.dispose();
}
keys.add(sb.toString().trim());
}
return keys;
}
}.getPublicKeys();
代码示例来源:origin: fizzed/blaze
IdentityRepository ir = jsch.getIdentityRepository();
@SuppressWarnings("UseOfObsoleteCollectionType")
java.util.Vector<Object> identities = ir.getIdentities();
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch
new IdentityRepository.Wrapper(jsch.getIdentityRepository(), true);
for(int i = 0; i < values.length; i++){
String ifile = values[i];
代码示例来源:origin: ePaul/jsch-documentation
new IdentityRepository.Wrapper(jsch.getIdentityRepository(), true);
for(int i = 0; i < values.length; i++){
String ifile = values[i];
代码示例来源:origin: org.xbib/jsch-core
new IdentityRepository.Wrapper(jsch.getIdentityRepository(), true);
for (String value1 : values) {
String ifile = value1;
代码示例来源:origin: org.mule.jsch/jsch
new IdentityRepository.Wrapper(jsch.getIdentityRepository(), true);
for(int i = 0; i < values.length; i++){
String ifile = values[i];
内容来源于网络,如有侵权,请联系作者删除!