Re: [cas-user] Overloading Bean Configuration does not work in 5.0.4
Not really. The @Conditional needs to be present in CAS’ bean. Feel free to open up an GH issue. From: Robert Oschwald <robertoschw...@gmail.com> Reply: cas-user@apereo.org <cas-user@apereo.org> Date: May 4, 2017 at 3:17:38 PM To: cas-user@apereo.org <cas-user@apereo.org> Subject: Re: [cas-user] Overloading Bean Configuration does not work in 5.0.4 :-( This means I need to overlay the whole CasValidationConfiguration bean. Am 04.05.2017 um 17:46 schrieb Dmitriy Kopylenko <dkopyle...@unicon.net>: The reason is that currently serviceValidateController bean in CAS is not @ConditionalOnMissingBean D. From: robertoschwald <robertoschw...@gmail.com> Reply: cas-user@apereo.org <cas-user@apereo.org> Date: May 4, 2017 at 11:40:26 AM To: CAS Community <cas-user@apereo.org> Subject: [cas-user] Overloading Bean Configuration does not work in 5.0.4 I need to overload the ServiceValidateController Bean by my own configuration bean, but it seems Spring Boot is first using my bean, then again the original one and I don't know why. My bean is called CasOverlayedValidationConfiguration: @Configuration("casOverlayedValidationConfiguration") @EnableConfigurationProperties(CasConfigurationProperties.class) @Order(value = 5) public class CasOverlayedValidationConfiguration { @Autowired private CasConfigurationProperties casProperties; @Autowired @Qualifier("casAttributeEncoder") private CasAttributeEncoder casAttributeEncoder; @Autowired @Qualifier("cas3SuccessView") private View cas3SuccessView; @Autowired @Qualifier("authenticationContextValidator") private AuthenticationContextValidator authenticationContextValidator; @Autowired @Qualifier("defaultAuthenticationSystemSupport") private AuthenticationSystemSupport authenticationSystemSupport; @Autowired @Qualifier("cas20WithoutProxyProtocolValidationSpecification") private ValidationSpecification cas20WithoutProxyProtocolValidationSpecification; @Autowired @Qualifier("cas2ServiceFailureView") private View cas2ServiceFailureView; @Autowired @Qualifier("proxy20Handler") private ProxyHandler proxy20Handler; @Autowired @Qualifier("servicesManager") private ServicesManager servicesManager; @Autowired @Qualifier("centralAuthenticationService") private CentralAuthenticationService centralAuthenticationService; @Autowired @Qualifier("defaultArgumentExtractor") private ArgumentExtractor argumentExtractor; @Autowired @Qualifier("defaultMultifactorTriggerSelectionStrategy") private MultifactorTriggerSelectionStrategy multifactorTriggerSelectionStrategy; @Autowired private View cas3ServiceSuccessView; @Autowired private View cas3ServiceJsonView; /* Use cas3ServiceSuccessView to be able to release attributes in CAS 2.0 serviceValidate until all CAS Clients are migrated */ @Bean public ServiceValidateController serviceValidateController() { final ServiceValidateController c = new ServiceValidateController(); c.setValidationSpecification(this.cas20WithoutProxyProtocolValidationSpecification); c.setSuccessView(cas3ServiceSuccessView); c.setFailureView(cas2ServiceFailureView); c.setProxyHandler(proxy20Handler); c.setAuthenticationSystemSupport(authenticationSystemSupport); c.setServicesManager(servicesManager); c.setCentralAuthenticationService(centralAuthenticationService); c.setArgumentExtractor(argumentExtractor); c.setMultifactorTriggerSelectionStrategy(multifactorTriggerSelectionStrategy); c.setAuthenticationContextValidator(authenticationContextValidator); c.setJsonView(cas3ServiceJsonView); c.setAuthnContextAttribute(casProperties.getAuthn().getMfa().getAuthenticationContextAttribute()); return c; } } The logs show this: 1. First, my bean definition overwrites the one from 2017-05-04 15:53:22,312 INFO [org.apereo.cas.web.CasWebApplication] - 2017-05-04 15:53:22,341 INFO [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] - 2017-05-04 15:53:23,372 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - This would be fine. BUT a second later, it again overwrites my bean with the one from "CasValidationConfiguration.class", but as Classpath resource: 2017-05-04 15:53:23,380 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - My overlay is based on the gradle overlay template. It doesn't matter if I start the application as a standalone war application using "java -jar cas.war", or in Intellij using a local Tomcat 8 Server. Any ideas? Thanks Robert -- - CAS gitter chatroom: https://gitter.im/apereo/cas - CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html - CAS documentation website: https://apereo.github.io/cas - CAS project website: https://github.com/apereo/cas --- You received this message because you ar
Re: [cas-user] Overloading Bean Configuration does not work in 5.0.4
The reason is that currently serviceValidateController bean in CAS is not @ConditionalOnMissingBean D. From: robertoschwaldReply: cas-user@apereo.org Date: May 4, 2017 at 11:40:26 AM To: CAS Community Subject: [cas-user] Overloading Bean Configuration does not work in 5.0.4 I need to overload the ServiceValidateController Bean by my own configuration bean, but it seems Spring Boot is first using my bean, then again the original one and I don't know why. My bean is called CasOverlayedValidationConfiguration: @Configuration("casOverlayedValidationConfiguration") @EnableConfigurationProperties(CasConfigurationProperties.class) @Order(value = 5) public class CasOverlayedValidationConfiguration { @Autowired private CasConfigurationProperties casProperties; @Autowired @Qualifier("casAttributeEncoder") private CasAttributeEncoder casAttributeEncoder; @Autowired @Qualifier("cas3SuccessView") private View cas3SuccessView; @Autowired @Qualifier("authenticationContextValidator") private AuthenticationContextValidator authenticationContextValidator; @Autowired @Qualifier("defaultAuthenticationSystemSupport") private AuthenticationSystemSupport authenticationSystemSupport; @Autowired @Qualifier("cas20WithoutProxyProtocolValidationSpecification") private ValidationSpecification cas20WithoutProxyProtocolValidationSpecification; @Autowired @Qualifier("cas2ServiceFailureView") private View cas2ServiceFailureView; @Autowired @Qualifier("proxy20Handler") private ProxyHandler proxy20Handler; @Autowired @Qualifier("servicesManager") private ServicesManager servicesManager; @Autowired @Qualifier("centralAuthenticationService") private CentralAuthenticationService centralAuthenticationService; @Autowired @Qualifier("defaultArgumentExtractor") private ArgumentExtractor argumentExtractor; @Autowired @Qualifier("defaultMultifactorTriggerSelectionStrategy") private MultifactorTriggerSelectionStrategy multifactorTriggerSelectionStrategy; @Autowired private View cas3ServiceSuccessView; @Autowired private View cas3ServiceJsonView; /* Use cas3ServiceSuccessView to be able to release attributes in CAS 2.0 serviceValidate until all CAS Clients are migrated */ @Bean public ServiceValidateController serviceValidateController() { final ServiceValidateController c = new ServiceValidateController(); c.setValidationSpecification(this.cas20WithoutProxyProtocolValidationSpecification); c.setSuccessView(cas3ServiceSuccessView); c.setFailureView(cas2ServiceFailureView); c.setProxyHandler(proxy20Handler); c.setAuthenticationSystemSupport(authenticationSystemSupport); c.setServicesManager(servicesManager); c.setCentralAuthenticationService(centralAuthenticationService); c.setArgumentExtractor(argumentExtractor); c.setMultifactorTriggerSelectionStrategy(multifactorTriggerSelectionStrategy); c.setAuthenticationContextValidator(authenticationContextValidator); c.setJsonView(cas3ServiceJsonView); c.setAuthnContextAttribute(casProperties.getAuthn().getMfa().getAuthenticationContextAttribute()); return c; } } The logs show this: 1. First, my bean definition overwrites the one from 2017-05-04 15:53:22,312 INFO [org.apereo.cas.web.CasWebApplication] - 2017-05-04 15:53:22,341 INFO [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] - 2017-05-04 15:53:23,372 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - This would be fine. BUT a second later, it again overwrites my bean with the one from "CasValidationConfiguration.class", but as Classpath resource: 2017-05-04 15:53:23,380 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - My overlay is based on the gradle overlay template. It doesn't matter if I start the application as a standalone war application using "java -jar cas.war", or in Intellij using a local Tomcat 8 Server. Any ideas? Thanks Robert -- - CAS gitter chatroom: https://gitter.im/apereo/cas - CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html - CAS documentation website: https://apereo.github.io/cas - CAS project website: https://github.com/apereo/cas --- 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 cas-user+unsubscr...@apereo.org. To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/a06acd49-1dd1-4089-8d68-410e0396a6b8%40apereo.org. -- - CAS gitter chatroom: https://gitter.im/apereo/cas - CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html - CAS documentation website: https://apereo.github.io/cas - CAS project website: https://github.com/apereo/cas --- You received this message because you are subscribed to the Google Groups "CAS Community" group. To unsubscribe from