Class AuthAgent

All Implemented Interfaces:
SSHPacketHandler, AuthMethod

public class AuthAgent extends KeyedAuthMethod
The "publickey" authentication method backed by an SSH agent, for a single agent identity.

It behaves exactly like AuthPublickey - send the public key, and on SSH_MSG_USERAUTH_PK_OK send a signed request - except the signature is produced by the AgentProxy (which drives the hardware, PIN and touch) and used verbatim. This is how FIDO/U2F security keys (sk-*) authenticate: the agent returns a complete signature with the security-key flags and counter already appended.

Use fromIdentities(AgentProxy) to turn every identity the agent holds into a method:


   try (AgentProxy agent = AgentProxy.fromEnvironment()) {
       ssh.auth(username, AuthAgent.fromIdentities(agent));
   }