Migration path to spring security with credentials plugin UI

22 views
Skip to first unread message

Tim Van Holder

unread,
Sep 27, 2021, 7:21:21 PM9/27/21
to jenkin...@googlegroups.com
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?

Gavin Mogan

unread,
Sep 27, 2021, 9:34:24 PM9/27/21
to Jenkins Developers

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAKMi--BpJWaeY-4Ghf4coF6RuTMJjpnLJXSWcCkSxh1wf%2BygaA%40mail.gmail.com.

Tim Jacomb

unread,
Sep 28, 2021, 2:21:28 AM9/28/21
to jenkin...@googlegroups.com
2) correct credentials api needs updating there’s no way to work with it currently that avoids deprecation warnings as far as I know

Reply all
Reply to author
Forward
0 new messages