Hi,

CAS 7.1.0 overlay, I need to override password change implementation, using 
my own PasswordManagementService.

I basically want to provide my own impl. of 
JdbcPasswordManagementConfiguration. 
See below QuestCasConfiguration, 

also defined in META-INF/spring/...AutoImports
org.apereo.cas.config.CasOverlayOverrideConfiguration
org.apereo.cas.config.QuestCasConfiguration


@EnableTransactionManagement(proxyTargetClass = false)
@EnableConfigurationProperties(CasConfigurationProperties.class)
@Configuration(value = "QuestCasConfiguration", proxyBeanMethods = false)
public class QuestCasConfiguration {

@Bean(name = "jdbcPasswordChangeService")
public PasswordManagementService passwordChangeService(
.......................
final PasswordHistoryService passwordHistoryService) {
return new 
QuestJdbcPasswordManagementService(passwordManagementCipherExecutor,
casProperties.getServer().getPrefix(), casProperties.getAuthn().getPm(), 
jdbcPasswordManagementDataSource,
jdbcPasswordManagementTransactionTemplate, passwordHistoryService, encoder); 
<=== this is Not called 
}

@Bean(name = "jdbcPasswordManagementDataSource")
public DataSource jdbcPasswordManagementDataSource(final 
CasConfigurationProperties 
casProperties) {
return JpaBeans.newDataSource
(casProperties.getAuthn().getJdbc().getQuery().get(0)); <=== this is called
}
}

the problem is that the two bean methods, one (
jdbcPasswordManagementDataSource) is called but the other(
passwordChangeService) is not, not sure why. I set a breakpoint in my class 
to see how the code is invoked.

This means passwordChangeService is already created somewhere else, but I 
cannot figure that out, either. 

I set a breakpoint in CAS source code: JdbcPasswordManagementConfiguration, 
I do not see any method stopped during debug when CAS starts up.

what did I miss? here are related logs

2024-05-06 10:49:55,104 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 
<Overriding bean definition for bean 'localeResolver' with a different 
definition: replacing [Root bean: class [null]; scope=; abstract=false; 
lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; 
primary=false; 
factoryBeanName=org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration;
 
factoryMethodName=localeResolver; initMethodNames=null; 
destroyMethodNames=[(inferred)]; defined in class path resource 
[org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]]
 
with [Root bean: class [null]; scope=refresh; abstract=false; 
lazyInit=null; autowireMode=3; dependencyCheck=0; autowireCandidate=true; 
primary=false; factoryBeanName=CasWebAppConfiguration; 
factoryMethodName=localeResolver; initMethodNames=null; 
destroyMethodNames=[(inferred)]; defined in class path resource 
[org/apereo/cas/config/CasWebAppConfiguration.class]]>
2024-05-06 10:49:55,107 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 
<Overriding bean definition for bean 'jdbcPasswordManagementDataSource' 
with a different definition: replacing [Root bean: class [null]; 
scope=refresh; abstract=false; lazyInit=null; autowireMode=3; 
dependencyCheck=0; autowireCandidate=true; primary=false; 
factoryBeanName=JdbcPasswordManagementDataConfiguration; 
factoryMethodName=jdbcPasswordManagementDataSource; initMethodNames=null; 
destroyMethodNames=[(inferred)]; defined in class path resource 
[org/apereo/cas/config/JdbcPasswordManagementConfiguration$JdbcPasswordManagementDataConfiguration.class]]
 
with [Root bean: class [null]; scope=; abstract=false; lazyInit=null; 
autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; 
factoryBeanName=QuestCasConfiguration; 
factoryMethodName=jdbcPasswordManagementDataSource; initMethodNames=null; 
destroyMethodNames=[(inferred)]; defined in class path resource 
[org/apereo/cas/config/QuestCasConfiguration.class]]>
2024-05-06 10:49:55,257 DEBUG [restartedMain] 
[org.springframework.beans.factory.support.DefaultListableBeanFactory] - 
<Creating shared instance of singleton bean 
'org.springframework.boot.autoconfigure.AutoConfigurationPackages'>
....


   JdbcPasswordHistoryManagementConfiguration matched:
      - Requested features [PasswordManagementHistory] are enabled 
(CasFeatureEnabledCondition)

   JdbcPasswordManagementConfiguration matched:
      - Requested features [PasswordManagement] are enabled 
(CasFeatureEnabledCondition)

  
 
JdbcPasswordManagementConfiguration.JdbcPasswordManagementDataConfiguration#jdbcPasswordManagementDataSource
 
matched:
      - @ConditionalOnMissingBean (names: jdbcPasswordManagementDataSource; 
SearchStrategy: all) did not find any beans (OnBeanCondition)

  
 
JdbcPasswordManagementConfiguration.JdbcPasswordManagementServiceConfiguration#passwordChangeService
 
matched:
      - @ConditionalOnMissingBean (names: jdbcPasswordChangeService; 
SearchStrategy: all) did not find any beans (OnBeanCondition)

  
 
JdbcPasswordManagementConfiguration.JdbcPasswordManagementTransactionConfiguration#jdbcPasswordManagementTransactionTemplate
 
matched:
      - @ConditionalOnMissingBean (names: 
jdbcPasswordManagementTransactionTemplate; SearchStrategy: all) did not 
find any beans (OnBeanCondition)

thanks!
Yan

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/d9523583-4942-4c50-a755-fafb8434b2aan%40apereo.org.

Reply via email to