@Bean
    @RefreshScope(proxyMode = ScopedProxyMode.DEFAULT)
    public RestHttpRequestCredentialFactoryConfigurer restHttpRequestCredentialFactoryConfigurer(
        @Qualifier(SurrogateAuthenticationService.BEAN_NAME)
        final SurrogateAuthenticationService surrogateAuthenticationService, final CasConfigurationProperties casProperties) {
        return factory -> factory.registerCredentialFactory(
            new SurrogateAuthenticationRestHttpRequestCredentialFactory(surrogateAuthenticationService, casProperties.getAuthn().getSurrogate()));
    }
Override the core bean definition
that handles username+password to
avoid duplicate authentication attempts.

@param surrogateAuthenticationService the surrogate authentication service
@param casProperties                  the cas properties
@return configurer instance
support/cas-server-support-surrogate-authentication/src/main/java/org/apereo/cas/config/SurrogateAuthenticationRestConfiguration.java