This config property only sets the template name, but still the Cas20ResponseView bean is used which does not release attributes. Therefore, I still need to redefine the serviceValidateController bean to use the Cas30ResponseView.
Robert > Am 05.05.2017 um 09:39 schrieb Robert Ledermüller > <[email protected]>: > > Hi, > > If I understand you correctly you just want to provide the CAS 3.0 protocol > successView during CAS 2.0 protocol? > If so you might try this configuration [1]. > > cas.view.cas2.success=protocol/3.0/casServiceValidationSuccess > > I think I have tried this and it worked but I might mix this up with > something different. > > Best > -- Robert > > [1] > https://apereo.github.io/cas/5.0.x/installation/Configuration-Properties.html#views > > > On Thursday, May 4, 2017 at 5:40:23 PM UTC+2, robertoschwald wrote: > 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 = 50000) > 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] - <The > following profiles are active: native> > 2017-05-04 15:53:22,341 INFO > [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] > - <Refreshing > org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5e25a92e: > startup date [Thu May 04 15:53:22 CEST 2017]; parent: > org.springframework.context.annotation.AnnotationConfigApplicationContext@387c703b> > 2017-05-04 15:53:23,372 INFO > [org.springframework.beans.factory.support.DefaultListableBeanFactory] - > <Overriding bean definition for bean 'serviceValidateController' with a > different definition: > replacing > [Generic bean: class [org.apereo.cas.web.ServiceValidateController]; > scope=singleton; abstract=false; lazyInit=false; autowireMode=0; > dependencyCheck=0; autowireCandidate=true; primary=false; > factoryBeanName=null; factoryMethodName=null; initMethodName=null; > destroyMethodName=null; > defined in URL > [jar:file:/projects/cas5/cas/build/libs/cas.war!/WEB-INF/lib/cas-server-support-validation-5.0.4.jar!/org/apereo/cas/web/ServiceValidateController.class]] > with > [Root bean: class [null]; scope=; abstract=false; lazyInit=false; > autowireMode=3; > dependencyCheck=0; autowireCandidate=true; primary=false; > factoryBeanName=casOverlayedValidationConfiguration; > factoryMethodName=serviceValidateController; initMethodName=null; > destroyMethodName=(inferred); > defined in class path resource > [org/apereo/cas/web/config/CasOverlayedValidationConfiguration.class]]> > > > 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] - > <Overriding bean definition for bean 'serviceValidateController' with a > different definition: > replacing [Root bean: class [null]; > scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; > autowireCandidate=true; primary=false; > factoryBeanName=CasOverlayedValidationConfiguration; > factoryMethodName=serviceValidateController; > initMethodName=null; destroyMethodName=(inferred); > defined in > class path resource > [org/apereo/cas/web/config/CasOverlayedValidationConfiguration.class]] > with > [Root bean: class [null]; scope=; abstract=false; lazyInit=false; > autowireMode=3; > dependencyCheck=0; autowireCandidate=true; primary=false; > factoryBeanName=casValidationConfiguration; > factoryMethodName=serviceValidateController; initMethodName=null; > destroyMethodName=(inferred); > defined in class path resource > [org/apereo/cas/web/config/CasValidationConfiguration.class]]> > > > 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 > <https://gitter.im/apereo/cas> > - CAS mailing list guidelines: > https://apereo.github.io/cas/Mailing-Lists.html > <https://apereo.github.io/cas/Mailing-Lists.html> > - CAS documentation website: https://apereo.github.io/cas > <https://apereo.github.io/cas> > - CAS project website: https://github.com/apereo/cas > <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 [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/a/apereo.org/d/msgid/cas-user/1ba7f1c1-5251-4a90-849d-4781996667a5%40apereo.org > > <https://groups.google.com/a/apereo.org/d/msgid/cas-user/1ba7f1c1-5251-4a90-849d-4781996667a5%40apereo.org?utm_medium=email&utm_source=footer>. -- - 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 [email protected]. To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/6F679AAD-1755-4874-9D6E-D6D86527BE1D%40gmail.com.
