Skip to content
Permalink
Browse files

[FIXED JENKINS-25031] don't leak ServerCredentialMapping

  • Loading branch information...
imod committed Jul 23, 2015
1 parent 21f6a85 commit ca3c5a44bd45d0e850485fb9292be87b789281b0
@@ -1,11 +1,5 @@
package org.jenkinsci.plugins.configfiles.maven.security;

import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.AbstractProject;
import hudson.model.Descriptor;
import hudson.util.ListBoxModel;

import java.util.List;

import org.kohsuke.stapler.AncestorInPath;
@@ -15,6 +9,13 @@
import com.cloudbees.plugins.credentials.common.StandardUsernameCredentials;
import com.cloudbees.plugins.credentials.common.StandardUsernameListBoxModel;

import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.AbstractProject;
import hudson.model.Descriptor;
import hudson.model.Item;
import hudson.util.ListBoxModel;

public class ServerCredentialMapping extends AbstractDescribableImpl<ServerCredentialMapping> {

private final String serverId;
@@ -44,6 +45,9 @@ public String getCredentialsId() {
public static class DescriptorImpl extends Descriptor<ServerCredentialMapping> {

public ListBoxModel doFillCredentialsIdItems(@AncestorInPath AbstractProject<?, ?> context, @QueryParameter String serverId) {
if (context == null || !context.hasPermission(Item.CONFIGURE)) {
return new ListBoxModel();
}
final List<StandardUsernameCredentials> validCredentials = CredentialsHelper.findValidCredentials(serverId);
return new StandardUsernameListBoxModel().withEmptySelection().withAll(validCredentials);
}

0 comments on commit ca3c5a4

Please sign in to comment.
You can’t perform that action at this time.