Skip to content

Commit

Permalink
[JENKINS-26099] Permit BasicSSHUserPrivateKey.id to be configured.
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Jan 14, 2015
1 parent 631a29c commit ab92458
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 28 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -96,7 +96,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>1.16.1</version>
<version>1.21-20150114.010642-1</version>
</dependency>
<!-- jenkins dependencies -->
<!-- test dependencies -->
Expand Down
Expand Up @@ -24,7 +24,6 @@
package com.cloudbees.jenkins.plugins.sshcredentials.impl;

import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey;
import com.cloudbees.plugins.credentials.CredentialsDescriptor;
import com.cloudbees.plugins.credentials.CredentialsProvider;
import com.cloudbees.plugins.credentials.CredentialsScope;
import com.cloudbees.plugins.credentials.CredentialsSnapshotTaker;
Expand Down Expand Up @@ -166,7 +165,7 @@ public Secret getPassphrase() {
* {@inheritDoc}
*/
@Extension
public static class DescriptorImpl extends CredentialsDescriptor {
public static class DescriptorImpl extends BaseStandardCredentialsDescriptor {

/**
* {@inheritDoc}
Expand All @@ -180,12 +179,6 @@ public DescriptorExtensionList<PrivateKeySource, Descriptor<PrivateKeySource>> g
return Hudson.getInstance().getDescriptorList(PrivateKeySource.class);
}

public BasicSSHUserPrivateKey fixInstance(BasicSSHUserPrivateKey instance) {
return instance == null ? new BasicSSHUserPrivateKey(CredentialsScope.GLOBAL, null, "",
new DirectEntryPrivateKeySource(""), "",

"") : instance;
}
}

/**
Expand Down
Expand Up @@ -24,24 +24,15 @@
-->

<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form" xmlns:st="jelly:stapler">
<f:invisibleEntry>
<f:textbox style="display:none" field="id"/>
</f:invisibleEntry>
<j:if test="${instance==null}">
<j:set var="instance" value="${descriptor.fixInstance(instance)}"/>
</j:if>
<f:entry title="${%Username}" field="username">
<f:textbox/>
</f:entry>
<f:entry title="${%Description}" field="description">
<f:textbox/>
</f:entry>
<f:entry title="${%Private Key}" field="privateKeySource">
<!-- TODO switch back to hetero-radio when the initial expansion bug is fixed -->
<j:scope>
<table style="width:100%">
<j:set var="currentInstance" value="${instance.privateKeySource}" />
<j:set var="currentDescriptor" value="${currentInstance.descriptor}" />
<j:set var="currentInstance" value="${instance != null ? instance.privateKeySource : null}"/>
<j:set var="currentDescriptor" value="${currentInstance != null ? currentInstance.descriptor : null}"/>
<j:set var="currentName" value="${h.generateId()}.privateKeySource" />
<j:forEach var="d" items="${descriptor.privateKeySources}" varStatus="loop">
<f:radioBlock name="${currentName}" help="${d.helpFile}" value="${loop.index}"
Expand All @@ -57,9 +48,8 @@
</table>
</j:scope>
</f:entry>
<f:advanced>
<f:entry title="${%Passphrase}" field="passphrase">
<f:password/>
</f:entry>
</f:advanced>
<f:entry title="${%Passphrase}" field="passphrase">
<f:password/>
</f:entry>
<st:include page="id-and-description" class="${descriptor.clazz}"/>
</j:jelly>
Expand Up @@ -22,6 +22,5 @@
# THE SOFTWARE.

Username=Benutzername
Private\ Key=Privater Schl\u00FCssel
Private\ Key=Privater Schl\u00fcssel
Passphrase=Passwort/Passphrase
Description=Beschreibung
Expand Up @@ -23,4 +23,3 @@
Username=\u30e6\u30fc\u30b6\u30fc\u540d
Private\ Key=\u79d8\u5bc6\u9375
Passphrase=\u30d1\u30b9\u30d5\u30ec\u30fc\u30ba
Description=\u8aac\u660e

0 comments on commit ab92458

Please sign in to comment.