Hi,
I'm looking at bumping my plugin from Jenkins 249.1 to 289.1 (plus plugin-parent from 4.19 to 4.27 and the BOM from 2.249.x/887.vae9c8ac09ff7 to 2.289.x/950.v396cb834de1).
This all works fine, except I get a warning about deprecated code.
I have a helper method to populate a list box (a <c:select/>) with string credentials (NuGet API keys).
These will be used on configuration for build steps (both via the classic job UI, and via the snippet generator for use in pipelines).
@NonNull
static ListBoxModel getStringCredentialsList(@CheckForNull Jenkins context, boolean allowEmpty) {
AbstractIdCredentialsListBoxModel<StandardListBoxModel, StandardCredentials> model = new StandardListBoxModel();
if (allowEmpty) {
model = model.includeEmptyValue();
}
if (context == null || !context.hasPermission(CredentialsProvider.VIEW)) {
return model;
}
model = model.includeMatchingAs(ACL.SYSTEM, context, StringCredentials.class, Collections.emptyList(), CredentialsMatchers.always());
return model;
}
While ACL.SYSTEM says to use ACL.SYSTEM2 instead, that is of a different type, and there are no overloads on the list box model that accept it.
So I have two questions:
1) Was this the correct way of doing this to begin with, or should I have been getting a user-specific credential list?
2) What is the new way of doing this, using the Spring Security types? I don't see any use of the spring security packages, so I guess the credentials plugin just hasn't been updated yet?