@RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    @Bean
    @ConditionalOnMissingBean(name = "jdbcSurrogateAuthenticationService")
    public BeanSupplier<SurrogateAuthenticationService> jdbcSurrogateAuthenticationService(
        final ConfigurableApplicationContext applicationContext,
        @Qualifier(RegisteredServicePrincipalAccessStrategyEnforcer.BEAN_NAME)
        final RegisteredServicePrincipalAccessStrategyEnforcer principalAccessStrategyEnforcer,
        final CasConfigurationProperties casProperties,
        @Qualifier("surrogateAuthenticationJdbcDataSource")
        final DataSource surrogateAuthenticationJdbcDataSource,
        @Qualifier(ServicesManager.BEAN_NAME)
        final ServicesManager servicesManager) {
        val su = casProperties.getAuthn().getSurrogate();
        return BeanSupplier.of(SurrogateAuthenticationService.class)
            .when(() -> StringUtils.isNotBlank(su.getJdbc().getSurrogateSearchQuery()))
            .supply(Unchecked.supplier(() -> new SurrogateJdbcAuthenticationService(
                new JdbcTemplate(surrogateAuthenticationJdbcDataSource),
                servicesManager, casProperties, principalAccessStrategyEnforcer, applicationContext)))
            .otherwiseNull();
    }
This is {@link CasSurrogateJdbcAuthenticationAutoConfiguration}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-surrogate-authentication-jdbc/src/main/java/org/apereo/cas/config/CasSurrogateJdbcAuthenticationAutoConfiguration.java