Package io.jenkins.blueocean.ssh
Class UserSSHKeyManager
- java.lang.Object
-
- io.jenkins.blueocean.ssh.UserSSHKeyManager
-
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class UserSSHKeyManager extends Object
Helper to deal with managing a Jenkins-created per-user SSH key- Author:
- kzantow
-
-
Constructor Summary
Constructors Constructor Description UserSSHKeyManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey
getOrCreate(User user)
Gets the existing generated SSH key for the user or creates one and returns it in the user's credential storestatic UserKey
getPublicKey(User user, com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey key)
Gets a readable SSH-compatible public key a user could paste somewherestatic void
reset(User user)
Resets the user's generated key by deleting it and creating a new one
-
-
-
Method Detail
-
getOrCreate
@NonNull public static com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey getOrCreate(@NonNull User user)
Gets the existing generated SSH key for the user or creates one and returns it in the user's credential store- Parameters:
user
- owner of the key- Returns:
- the user's personal private key
-
getPublicKey
@NonNull public static UserKey getPublicKey(@NonNull User user, @NonNull com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey key)
Gets a readable SSH-compatible public key a user could paste somewhere- Parameters:
user
- the user which will be used to build a useful descriptionkey
- the private key to use- Returns:
- a public ssh key
-
reset
public static void reset(@NonNull User user)
Resets the user's generated key by deleting it and creating a new one- Parameters:
user
- user to reset a key for
-
-