public UserAuthPublicKeyIterator(ClientSession session, SignatureFactoriesManager signatureFactories) throws Exception { super(session); Collection<Stream<? extends PublicKeyIdentity>> identities = new LinkedList<>(); FactoryManager manager = Objects.requireNonNull(session.getFactoryManager(), "No session factory manager"); SshAgentFactory factory = manager.getAgentFactory(); if (factory != null) { try { agent = Objects.requireNonNull(factory.createClient(manager), "No agent created"); identities.add(agent.getIdentities() .stream() .map(kp -> new KeyAgentIdentity(agent, kp.getKey(), kp.getValue()))); } catch (Exception e) { try { closeAgent(); } catch (Exception err) { e.addSuppressed(err); } throw e; } } identities.add(Stream.of(ClientSession.providerOf(session)) .map(KeyIdentityProvider::loadKeys) .flatMap(GenericUtils::stream) .map(kp -> new KeyPairIdentity(signatureFactories, session, kp))); current = identities.stream().flatMap(r -> r).iterator(); }
protected SshAgentServer createSshAgentServer(ConnectionService service, Session session) throws Throwable { FactoryManager manager = Objects.requireNonNull(session.getFactoryManager(), "No session factory manager"); SshAgentFactory factory = Objects.requireNonNull(manager.getAgentFactory(), "No agent factory"); return factory.createServer(service); }
List<NamedFactory<Channel>> forwarders = ValidateUtils.checkNotNullAndNotEmpty( agentFactory.getChannelForwardingFactories(this), "No agent channel forwarding factories for %s", agentFactory); List<NamedFactory<Channel>> factories = getChannelFactories(); if (GenericUtils.isEmpty(factories)) {
List<NamedFactory<Channel>> forwarders = ValidateUtils.checkNotNullAndNotEmpty( agentFactory.getChannelForwardingFactories(this), "No agent channel forwarding factories for %s", agentFactory); List<NamedFactory<Channel>> factories = getChannelFactories(); if (GenericUtils.isEmpty(factories)) {
agent = Objects.requireNonNull(factory.createClient(manager), "No agent created"); return new Iterable<KeyAgentIdentity>() { @SuppressWarnings("synthetic-access")
protected SshAgentServer createSshAgentServer(ConnectionService service, Session session) throws Throwable { FactoryManager manager = Objects.requireNonNull(session.getFactoryManager(), "No session factory manager"); SshAgentFactory factory = Objects.requireNonNull(manager.getAgentFactory(), "No agent factory"); return factory.createServer(service); }
@Override protected OpenFuture doInit(Buffer buffer) { OpenFuture f = new DefaultOpenFuture(this, this); String changeEvent = "auth-agent"; try { out = new ChannelOutputStream(this, getRemoteWindow(), log, SshConstants.SSH_MSG_CHANNEL_DATA, true); Session session = getSession(); FactoryManager manager = Objects.requireNonNull(session.getFactoryManager(), "No factory manager"); SshAgentFactory factory = Objects.requireNonNull(manager.getAgentFactory(), "No agent factory"); agent = factory.createClient(manager); client = new AgentClient(); signalChannelOpenSuccess(); f.setOpened(); } catch (Throwable t) { Throwable e = GenericUtils.peelException(t); changeEvent = e.getClass().getSimpleName(); signalChannelOpenFailure(e); f.setException(e); } finally { notifyStateChanged(changeEvent); } return f; }
@Override protected OpenFuture doInit(Buffer buffer) { OpenFuture f = new DefaultOpenFuture(this, this); String changeEvent = "auth-agent"; try { out = new ChannelOutputStream(this, getRemoteWindow(), log, SshConstants.SSH_MSG_CHANNEL_DATA, true); Session session = getSession(); FactoryManager manager = Objects.requireNonNull(session.getFactoryManager(), "No factory manager"); SshAgentFactory factory = Objects.requireNonNull(manager.getAgentFactory(), "No agent factory"); agent = factory.createClient(manager); client = new AgentClient(); signalChannelOpenSuccess(); f.setOpened(); } catch (Throwable t) { Throwable e = GenericUtils.peelException(t); changeEvent = e.getClass().getSimpleName(); signalChannelOpenFailure(e); f.setException(e); } finally { notifyStateChanged(changeEvent); } return f; }
if (factory != null) { try { agent = factory.createClient(manager); keys.add(new AgentIdentityIterator(agent)); } catch (IOException e) {
public UserAuthAgent(ClientSessionImpl session, String service) throws IOException { super(session, service); if (session.getFactoryManager().getAgentFactory() == null) { throw new IllegalStateException("No ssh agent factory has been configured"); } this.agent = session.getFactoryManager().getAgentFactory().createClient(session.getFactoryManager()); this.keys = agent.getIdentities().iterator(); }
public UserAuthAgent(ClientSessionImpl session, String service) throws IOException { super(session, service); if (session.getFactoryManager().getAgentFactory() == null) { throw new IllegalStateException("No ssh agent factory has been configured"); } this.agent = session.getFactoryManager().getAgentFactory().createClient(session.getFactoryManager()); this.keys = agent.getIdentities().iterator(); }
public UserAuthAgent(ClientSessionImpl session, String service) throws IOException { super(session, service); if (session.getFactoryManager().getAgentFactory() == null) { throw new IllegalStateException("No ssh agent factory has been configured"); } this.agent = session.getFactoryManager().getAgentFactory().createClient(session.getFactoryManager()); this.keys = agent.getIdentities().iterator(); }