2121import java .util .Collections ;
2222import java .util .List ;
2323import jenkins .model .Jenkins ;
24- import org .acegisecurity .Authentication ;
2524import org .apache .commons .lang .StringUtils ;
2625import org .kohsuke .stapler .DataBoundConstructor ;
2726import org .kohsuke .stapler .Stapler ;
27+ import org .springframework .security .core .Authentication ;
2828
2929/**
3030 * A {@link ParameterValue} produced from a {@link CredentialsParameterDefinition}.
@@ -89,24 +89,24 @@ public <C extends IdCredentials> C lookupCredentials(@NonNull Class<C> type, @No
8989
9090 public <C extends IdCredentials > C lookupCredentials (@ NonNull Class <C > type , @ NonNull Run run ,
9191 List <DomainRequirement > domainRequirements ) {
92- Authentication authentication = Jenkins .getAuthentication ();
92+ Authentication authentication = Jenkins .getAuthentication2 ();
9393 final Executor executor = run .getExecutor ();
9494 if (executor != null ) {
9595 final WorkUnit workUnit = executor .getCurrentWorkUnit ();
9696 if (workUnit != null ) {
97- authentication = workUnit .context .item .authenticate ();
97+ authentication = workUnit .context .item .authenticate2 ();
9898 }
9999 }
100100 List <C > candidates = new ArrayList <>();
101- final boolean isSystem = ACL .SYSTEM .equals (authentication );
101+ final boolean isSystem = ACL .SYSTEM2 .equals (authentication );
102102 if (!isSystem && run .getParent ().hasPermission (CredentialsProvider .USE_OWN )) {
103103 candidates .addAll (CredentialsProvider
104104 .lookupCredentials (type , run .getParent (), authentication , domainRequirements ));
105105 }
106106 if (run .getParent ().hasPermission (CredentialsProvider .USE_ITEM ) || isSystem
107107 || isDefaultValue ) {
108108 candidates .addAll (
109- CredentialsProvider .lookupCredentials (type , run .getParent (), ACL .SYSTEM , domainRequirements ));
109+ CredentialsProvider .lookupCredentials (type , run .getParent (), ACL .SYSTEM2 , domainRequirements ));
110110 }
111111 return CredentialsMatchers .firstOrNull (candidates , CredentialsMatchers .withId (value ));
112112 }
@@ -120,14 +120,14 @@ public String describe() {
120120 throw new IllegalStateException ("Should only be called from value.jelly" );
121121 }
122122 StandardCredentials c = CredentialsMatchers .firstOrNull (
123- CredentialsProvider .lookupCredentials (StandardCredentials .class , run .getParent (), ACL .SYSTEM ,
123+ CredentialsProvider .lookupCredentials (StandardCredentials .class , run .getParent (), ACL .SYSTEM2 ,
124124 Collections .emptyList ()), CredentialsMatchers .withId (value ));
125125 if (c != null ) {
126126 return CredentialsNameProvider .name (c );
127127 }
128128 c = CredentialsMatchers .firstOrNull (
129129 CredentialsProvider .lookupCredentials (StandardCredentials .class , run .getParent (),
130- Jenkins .getAuthentication (),
130+ Jenkins .getAuthentication2 (),
131131 Collections .emptyList ()), CredentialsMatchers .withId (value ));
132132 if (c != null ) {
133133 return CredentialsNameProvider .name (c );
@@ -144,14 +144,14 @@ public String iconClassName() {
144144 throw new IllegalStateException ("Should only be called from value.jelly" );
145145 }
146146 StandardCredentials c = CredentialsMatchers .firstOrNull (
147- CredentialsProvider .lookupCredentials (StandardCredentials .class , run .getParent (), ACL .SYSTEM ,
147+ CredentialsProvider .lookupCredentials (StandardCredentials .class , run .getParent (), ACL .SYSTEM2 ,
148148 Collections .emptyList ()), CredentialsMatchers .withId (value ));
149149 if (c != null ) {
150150 return c .getDescriptor ().getIconClassName ();
151151 }
152152 c = CredentialsMatchers .firstOrNull (
153153 CredentialsProvider .lookupCredentials (StandardCredentials .class , run .getParent (),
154- Jenkins .getAuthentication (),
154+ Jenkins .getAuthentication2 (),
155155 Collections .emptyList ()), CredentialsMatchers .withId (value ));
156156 if (c != null ) {
157157 return c .getDescriptor ().getIconClassName ();
@@ -167,7 +167,7 @@ public String url() {
167167 if (run == null ) {
168168 throw new IllegalStateException ("Should only be called from value.jelly" );
169169 }
170- try (ACLContext ctx = ACL .as (ACL .SYSTEM )) {
170+ try (ACLContext ignored = ACL .as2 (ACL .SYSTEM2 )) {
171171 for (CredentialsStore store : CredentialsProvider .lookupStores (run .getParent ())) {
172172 String url = url (store );
173173 if (url != null ) {
0 commit comments