Package com.google.gerrit.sshd
Class SshUtil
java.lang.Object
com.google.gerrit.sshd.SshUtil
Utilities to support SSH operations.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IdentifiedUser
createUser
(SshSession sd, IdentifiedUser.GenericFactory userFactory, Account.Id account) static void
forEachSshSession
(SshDaemon sshDaemon, SshUtil.SessionConsumer consumer) static PublicKey
parse
(AccountSshKey key) Parse a public key into its Java type.static boolean
success
(String username, org.apache.sshd.server.session.ServerSession session, SshScope sshScope, com.google.gerrit.sshd.SshLog sshLog, SshSession sd, CurrentUser user) static String
toOpenSshPublicKey
(String keyStr) Convert an RFC 4716 style key to an OpenSSH style key.
-
Constructor Details
-
SshUtil
public SshUtil()
-
-
Method Details
-
parse
public static PublicKey parse(AccountSshKey key) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException Parse a public key into its Java type.- Parameters:
key
- the account key to parse.- Returns:
- the valid public key object.
- Throws:
InvalidKeySpecException
- the key supplied is not a valid SSH key.NoSuchAlgorithmException
- the JVM is missing the key algorithm.NoSuchProviderException
- the JVM is missing the provider.
-
toOpenSshPublicKey
Convert an RFC 4716 style key to an OpenSSH style key.- Parameters:
keyStr
- the key string to convert.- Returns:
keyStr
if conversion failed; otherwise the converted key, in OpenSSH key format.
-
success
public static boolean success(String username, org.apache.sshd.server.session.ServerSession session, SshScope sshScope, com.google.gerrit.sshd.SshLog sshLog, SshSession sd, CurrentUser user) -
createUser
public static IdentifiedUser createUser(SshSession sd, IdentifiedUser.GenericFactory userFactory, Account.Id account) -
forEachSshSession
public static void forEachSshSession(SshDaemon sshDaemon, SshUtil.SessionConsumer consumer) throws BaseCommand.Failure - Throws:
BaseCommand.Failure
-