One other way to accomplish this is to disable CAS filer by setting `cas.http-web-request.header` property to false, and then to enable your version of this bean in your own configuration class by making sure it’s recognized by Spring by advertising it in META-INF/spring.factories file in your overlay.
D. On Mon, Oct 17, 2022 at 12:23 Yan Zhou <[email protected]> wrote: > That is what I have been doing, this means a duplication of the entire > class with only change to one-line. When we upgrade to next CAS release, > we would have to find such customization and duplicating it. > > I thought there maybe a better way. OK! > > Yan > > On Monday, October 17, 2022 at 11:53:40 AM UTC-4 Ray Bon wrote: > >> Yan, >> >> Copy RegisteredServiceResponseHeadersEnforcementFilter into your project >> and modify it. The build will replace the cas version with yours. >> You may need to add some compile dependencies to build.gradle. >> >> Ray >> >> On Mon, 2022-10-17 at 07:19 -0700, Yan Zhou wrote: >> >> Notice: This message was sent from outside the University of Victoria >> email system. Please be cautious with links and sensitive information. >> >> >> Hi there, >> >> I am using CAS 6.4.x. >> >> CasFiltersConfiguration defines filters, I wish to provide my own >> RegisteredServiceResponseHeadersEnforcementFilter (using a different name). >> >> How would I do that without copying the entire CasFiltersConfiguration >> or RegisteredServiceResponseHeadersEnforcementFilter and just change a >> couple lines? >> >> I understand this is a Sprint boot question, but I think some may have a >> quick answer for me. Thanks a lot! >> >> Yan >> >> >> @ConditionalOnProperty(prefix = "cas.http-web-request.header", name = >> "enabled", havingValue = "true", matchIfMissing = true) >> @RefreshScope >> @Bean >> public FilterRegistrationBean responseHeadersSecurityFilter() { >> val header = casProperties.getHttpWebRequest().getHeader(); >> val initParams = new HashMap<String, String>(); >> >> ............... >> >> val bean = new >> FilterRegistrationBean<RegisteredServiceResponseHeadersEnforcementFilter>(); >> bean.setFilter(new >> RegisteredServiceResponseHeadersEnforcementFilter(servicesManager.getObject(), >> argumentExtractor.getObject(), >> authenticationRequestServiceSelectionStrategies.getObject(), >> registeredServiceAccessStrategyEnforcer.getObject())); >> >> ............... >> >> return bean; >> } >> >> >> -- > - 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/15600683-1f15-4302-991e-ce00b258d470n%40apereo.org > <https://groups.google.com/a/apereo.org/d/msgid/cas-user/15600683-1f15-4302-991e-ce00b258d470n%40apereo.org?utm_medium=email&utm_source=footer> > . > -- - 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/CAMpiYKhzNM6YPpQmPBLYHUGvmHcyqFhhz-0eK%2B6kp7H8f9zktg%40mail.gmail.com.
