From 51d0a8b57d4cef208a25343db2f41c0237762de9 Mon Sep 17 00:00:00 2001 From: Daniel Garnier-Moiroux Date: Tue, 10 Sep 2024 12:13:36 +0200 Subject: [PATCH] Fix getBeansWithName in global authentication configurers --- .../InitializeAuthenticationProviderBeanManagerConfigurer.java | 2 +- .../InitializeUserDetailsBeanManagerConfigurer.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeAuthenticationProviderBeanManagerConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeAuthenticationProviderBeanManagerConfigurer.java index bcf1189902..82bd70469f 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeAuthenticationProviderBeanManagerConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeAuthenticationProviderBeanManagerConfigurer.java @@ -94,7 +94,7 @@ class InitializeAuthenticationProviderBeanManagerConfigurer extends GlobalAuthen String[] beanNames = InitializeAuthenticationProviderBeanManagerConfigurer.this.context .getBeanNamesForType(type); for (String beanName : beanNames) { - T bean = InitializeAuthenticationProviderBeanManagerConfigurer.this.context.getBean(beanNames[0], type); + T bean = InitializeAuthenticationProviderBeanManagerConfigurer.this.context.getBean(beanName, type); beanWithNames.add(new BeanWithName(bean, beanName)); } return beanWithNames; diff --git a/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeUserDetailsBeanManagerConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeUserDetailsBeanManagerConfigurer.java index 7af1f4b0c5..3383a5f20f 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeUserDetailsBeanManagerConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/authentication/configuration/InitializeUserDetailsBeanManagerConfigurer.java @@ -135,7 +135,7 @@ class InitializeUserDetailsBeanManagerConfigurer extends GlobalAuthenticationCon List> beanWithNames = new ArrayList<>(); String[] beanNames = InitializeUserDetailsBeanManagerConfigurer.this.context.getBeanNamesForType(type); for (String beanName : beanNames) { - T bean = InitializeUserDetailsBeanManagerConfigurer.this.context.getBean(beanNames[0], type); + T bean = InitializeUserDetailsBeanManagerConfigurer.this.context.getBean(beanName, type); beanWithNames.add(new BeanWithName(bean, beanName)); } return beanWithNames;