@@ -1255,7 +1255,7 @@ public <C extends Credentials> List<C> getCredentials(@NonNull Class<C> type,
12551255 @ NonNull Item item ,
12561256 @ Nullable org .acegisecurity .Authentication authentication ) {
12571257 Objects .requireNonNull (item );
1258- return getCredentialsInItemGroup (type , item . getParent () , authentication == null ? null : authentication .toSpring (), List .of ());
1258+ return getCredentialsInItemFallback (type , item , authentication == null ? null : authentication .toSpring (), List .of ());
12591259 }
12601260
12611261 /**
@@ -1267,7 +1267,7 @@ public <C extends Credentials> List<C> getCredentials(@NonNull Class<C> type,
12671267 @ NonNull Item item ,
12681268 @ Nullable org .acegisecurity .Authentication authentication ,
12691269 @ NonNull List <DomainRequirement > domainRequirements ) {
1270- return getCredentialsInItem (type , item , authentication == null ? null : authentication .toSpring (), domainRequirements );
1270+ return getCredentialsInItemFallback (type , item , authentication == null ? null : authentication .toSpring (), domainRequirements );
12711271 }
12721272
12731273 /**
@@ -1287,6 +1287,17 @@ public <C extends Credentials> List<C> getCredentialsInItem(@NonNull Class<C> ty
12871287 @ NonNull Item item ,
12881288 @ Nullable Authentication authentication ,
12891289 @ NonNull List <DomainRequirement > domainRequirements ) {
1290+ if (Util .isOverridden (CredentialsProvider .class , getClass (), "getCredentials" , Class .class , Item .class , org .acegisecurity .Authentication .class , List .class )) {
1291+ return getCredentials (type , item , authentication == null ? null : org .acegisecurity .Authentication .fromSpring (authentication ), domainRequirements );
1292+ }
1293+ if (Util .isOverridden (CredentialsProvider .class , getClass (), "getCredentials" , Class .class , Item .class , org .acegisecurity .Authentication .class )) {
1294+ return getCredentials (type , item , authentication == null ? null : org .acegisecurity .Authentication .fromSpring (authentication ));
1295+ }
1296+ return getCredentialsInItemFallback (type , item , authentication , domainRequirements );
1297+ }
1298+
1299+ @ NonNull
1300+ private <C extends Credentials > List <C > getCredentialsInItemFallback (@ NonNull Class <C > type , @ NonNull Item item , @ Nullable Authentication authentication , @ NonNull List <DomainRequirement > domainRequirements ) {
12901301 return getCredentialsInItemGroup (type , item instanceof ItemGroup ? (ItemGroup ) item : item .getParent (),
12911302 authentication , domainRequirements );
12921303 }
0 commit comments