-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simplify UI and exposed Data model #36
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,6 @@ | |
package com.cloudbees.jenkins.plugins.sshcredentials.impl; | ||
|
||
import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey; | ||
import com.cloudbees.plugins.credentials.CredentialsProvider; | ||
import com.cloudbees.plugins.credentials.CredentialsScope; | ||
import edu.umd.cs.findbugs.annotations.CheckForNull; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
|
@@ -33,7 +32,6 @@ | |
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
import hudson.model.Items; | ||
import hudson.remoting.Channel; | ||
import hudson.util.Secret; | ||
import java.io.File; | ||
import java.io.IOException; | ||
|
@@ -100,11 +98,21 @@ public class BasicSSHUserPrivateKey extends BaseSSHUser implements SSHUserPrivat | |
* | ||
* @param scope the credentials scope | ||
* @param username the username. | ||
* @param privateKeySource the private key. | ||
* @param privateKey the private key. | ||
* @param passphrase the password. | ||
* @param description the description. | ||
*/ | ||
@DataBoundConstructor | ||
public BasicSSHUserPrivateKey(CredentialsScope scope, String id, String username, Secret privateKey, | ||
String passphrase, | ||
String description) { | ||
super(scope, id, username, description); | ||
this.privateKeySource = new DirectEntryPrivateKeySource(privateKey); | ||
this.passphrase = fixEmpty(passphrase == null ? null : Secret.fromString(passphrase)); | ||
} | ||
|
||
|
||
@Deprecated | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should also deprecate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ack |
||
public BasicSSHUserPrivateKey(CredentialsScope scope, String id, String username, PrivateKeySource privateKeySource, | ||
String passphrase, | ||
String description) { | ||
|
@@ -296,6 +304,7 @@ public boolean isSnapshotSource() { | |
/** | ||
* Descriptor for a {@link PrivateKeySource} | ||
*/ | ||
@Deprecated | ||
public static abstract class PrivateKeySourceDescriptor extends Descriptor<PrivateKeySource> { | ||
} | ||
|
||
|
@@ -310,9 +319,12 @@ public static class DirectEntryPrivateKeySource extends PrivateKeySource impleme | |
|
||
private final Secret privateKey; | ||
|
||
@DataBoundConstructor | ||
public DirectEntryPrivateKeySource(Secret privateKey) { | ||
this.privateKey = privateKey; | ||
} | ||
|
||
public DirectEntryPrivateKeySource(String privateKey) { | ||
this.privateKey = Secret.fromString(privateKey); | ||
this(Secret.fromString(privateKey)); | ||
} | ||
|
||
public DirectEntryPrivateKeySource(List<String> privateKeys) { | ||
|
@@ -348,21 +360,6 @@ public String getPrivateKey() { | |
public boolean isSnapshotSource() { | ||
return true; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Extension | ||
public static class DescriptorImpl extends PrivateKeySourceDescriptor { | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public String getDisplayName() { | ||
return Messages.BasicSSHUserPrivateKey_DirectEntryPrivateKeySourceDisplayName(); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
|
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be of type
Secret
, and should be moved into a@DataBoundSetter
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, didn't want to make more changes that strictly required, but I'm fine to get one step further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use a DataBoundSetter ? Does it make any sense to create a SSHUserPrivateKey without a private key ?