From b4af138211459f4ca2118215ebfd1a0758ed0971 Mon Sep 17 00:00:00 2001 From: Vincent Latombe Date: Thu, 26 Oct 2023 08:54:54 +0200 Subject: [PATCH 1/2] jep-227 downstream usage --- pom.xml | 5 +++++ src/main/java/hudson/plugins/sshslaves/SSHConnector.java | 2 +- src/main/java/hudson/plugins/sshslaves/SSHLauncher.java | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 5fc8ba6a..cc2b7ac8 100644 --- a/pom.xml +++ b/pom.xml @@ -106,6 +106,11 @@ pom import + + org.jenkins-ci.plugins + credentials + 1305.v5886374f499b_ + diff --git a/src/main/java/hudson/plugins/sshslaves/SSHConnector.java b/src/main/java/hudson/plugins/sshslaves/SSHConnector.java index d7c5b4b6..a41b3801 100644 --- a/src/main/java/hudson/plugins/sshslaves/SSHConnector.java +++ b/src/main/java/hudson/plugins/sshslaves/SSHConnector.java @@ -316,7 +316,7 @@ public FormValidation doCheckCredentialsId(@AncestorInPath ItemGroup context, if (_context == null || !_context.hasPermission(Computer.CONFIGURE)) { return FormValidation.ok(); // no need to alarm a user that cannot configure } - for (ListBoxModel.Option o : CredentialsProvider.listCredentials(StandardUsernameCredentials.class, context, ACL.SYSTEM, + for (ListBoxModel.Option o : CredentialsProvider.listCredentialsInItemGroup(StandardUsernameCredentials.class, context, ACL.SYSTEM2, Collections.singletonList(SSHLauncher.SSH_SCHEME), SSHAuthenticator.matcher(Connection.class))) { if (StringUtils.equals(value, o.value)) { diff --git a/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java b/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java index 03aaf230..88a0ea44 100644 --- a/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java +++ b/src/main/java/hudson/plugins/sshslaves/SSHLauncher.java @@ -294,8 +294,8 @@ public SSHLauncher(@NonNull String host, int port, String credentialsId) { public static StandardUsernameCredentials lookupSystemCredentials(String credentialsId) { return CredentialsMatchers.firstOrNull( CredentialsProvider - .lookupCredentials(StandardUsernameCredentials.class, Jenkins.get(), ACL.SYSTEM, - SSH_SCHEME), + .lookupCredentialsInItemGroup(StandardUsernameCredentials.class, Jenkins.get(), ACL.SYSTEM2, + List.of(SSH_SCHEME)), CredentialsMatchers.withId(credentialsId) ); } @@ -1276,7 +1276,7 @@ public FormValidation doCheckCredentialsId(@AncestorInPath ItemGroup context, try { int portValue = Integer.parseInt(port); for (ListBoxModel.Option o : CredentialsProvider - .listCredentials(StandardUsernameCredentials.class, context, ACL.SYSTEM, + .listCredentialsInItemGroup(StandardUsernameCredentials.class, context, ACL.SYSTEM2, Collections.singletonList( new HostnamePortRequirement(host, portValue) ), From 3f884beea16f456ba917f520dced4a35e211ada3 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Wed, 1 Nov 2023 17:25:20 -0400 Subject: [PATCH 2/2] Pick up release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cc2b7ac8..f1d08c63 100644 --- a/pom.xml +++ b/pom.xml @@ -109,7 +109,7 @@ org.jenkins-ci.plugins credentials - 1305.v5886374f499b_ + 1307.v3757c78f17c3