Package com.google.gerrit.sshd
Class SshUtil
- java.lang.Object
-
- com.google.gerrit.sshd.SshUtil
-
public class SshUtil extends Object
Utilities to support SSH operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SshUtil.SessionConsumer
-
Constructor Summary
Constructors Constructor Description SshUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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.
-
-
-
Method Detail
-
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
public static String toOpenSshPublicKey(String keyStr)
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
-
-