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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey
    Gets the existing generated SSH key for the user or creates one and returns it in the user's credential store
    static UserKey
    getPublicKey(User user, com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey key)
    Gets a readable SSH-compatible public key a user could paste somewhere
    static void
    reset(User user)
    Resets the user's generated key by deleting it and creating a new one

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UserSSHKeyManager

      public UserSSHKeyManager()
  • Method Details

    • 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 description
      key - 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