Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-11981] hiding password
  • Loading branch information
deluan committed Dec 5, 2011
1 parent 11f4043 commit a6a42f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/main/java/com/deluan/jenkins/plugins/rtc/JazzSCM.java
Expand Up @@ -11,6 +11,7 @@
import hudson.scm.*;
import hudson.util.FormValidation;
import hudson.util.LogTaskListener;
import hudson.util.Secret;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
Expand All @@ -22,6 +23,8 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import static hudson.Util.fixEmpty;

/**
* @author deluan
*/
Expand All @@ -34,7 +37,7 @@ public class JazzSCM extends SCM {
private String workspaceName;
private String streamName;
private String username;
private String password;
private Secret password;

private JazzRepositoryBrowser repositoryBrowser;

Expand All @@ -46,7 +49,7 @@ public JazzSCM(String repositoryLocation, String workspaceName, String streamNam
this.workspaceName = workspaceName;
this.streamName = streamName;
this.username = username;
this.password = password;
this.password = fixEmpty(password)!=null ? Secret.fromString(password) : null;
}

public String getRepositoryLocation() {
Expand All @@ -66,12 +69,12 @@ public String getUsername() {
}

public String getPassword() {
return password;
return Secret.toString(password);
}

private JazzClient getClientInstance(Launcher launcher, TaskListener listener, FilePath jobWorkspace) {
return new JazzClient(launcher, listener, jobWorkspace, getDescriptor().getJazzExecutable(),
username, password, repositoryLocation, streamName, workspaceName);
username, getPassword(), repositoryLocation, streamName, workspaceName);
}

@Override
Expand Down
Expand Up @@ -13,7 +13,7 @@
<f:textbox/>
</f:entry>
<f:entry title="${%Build user's password}" field="password">
<f:textbox/>
<f:password/>
</f:entry>

<t:listScmBrowsers name="rtc.browser"/>
Expand Down

0 comments on commit a6a42f1

Please sign in to comment.