@@ -1471,18 +1473,28 @@ public class SSHLauncher extends ComputerLauncher {
public ListBoxModel doFillCredentialsIdItems(@AncestorInPath ItemGroup context,
@QueryParameter String host,
- @QueryParameter String port) {
+ @QueryParameter String port,
+ @QueryParameter String value) {
AccessControlled _context = (context instanceof AccessControlled ? (AccessControlled) context : Jenkins.getInstance());
if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) {
- return new ListBoxModel();
+ return new StandardUsernameListBoxModel()
+ .includeCurrentValue(value);
}
try {
int portValue = Integer.parseInt(port);
- return new StandardUsernameListBoxModel().withMatching(SSHAuthenticator.matcher(Connection.class),
- CredentialsProvider.lookupCredentials(StandardUsernameCredentials.class, context,
- ACL.SYSTEM, SSHLauncher.SSH_SCHEME, new HostnamePortRequirement(host, portValue)));
+ return new StandardUsernameListBoxModel()
+ .includeMatchingAs(
+ ACL.SYSTEM,
+ Jenkins.getActiveInstance(),
+ StandardUsernameCredentials.class,
+ Collections.<DomainRequirement>singletonList(
+ new HostnamePortRequirement(host, portValue)
+ ),
+ SSHAuthenticator.matcher(Connection.class))
+ .includeCurrentValue(value); } catch (NumberFormatException ex) {
- return new ListBoxModel();
+ return new StandardUsernameListBoxModel()
+ .includeCurrentValue(value);
}
}
}
https://github.com/jenkinsci/ssh-slaves-plugin/pull/34