grails / grails-spring-security-cas

Apache License 2.0
19 stars 29 forks source link

Grails 4 compatibility? #29

Open kastork opened 4 years ago

kastork commented 4 years ago

Is an update for Grails 4 in the roadmap for this plugin?

virtualdogbert commented 3 years ago

Might be related but when I tried to upgrade to Grails 4 with the CAS plugin I get the following error.

2021-04-07 17:51:40,000 [restartedMain] ERROR o.s.boot.SpringApplication - Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:99)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:485)
    at grails.boot.GrailsApp.run(GrailsApp.groovy:472)
    at grails.boot.GrailsApp$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:135)
    at sonic.backend.Application.main(Application.groovy:15)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:124)
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:86)
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:416)
    at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:180)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153)
    ... 18 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'singleSignOutFilterRegistrationBean': Cannot resolve reference to bean 'singleSignOutFilter' while setting bean property 'filter'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'singleSignOutFilter': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'casServerUrlPrefix' of bean class [org.jasig.cas.client.session.SingleSignOutFilter]: Bean property 'casServerUrlPrefix' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:314)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1672)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1424)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
    at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:211)
    at org.springframework.boot.web.servlet.ServletContextInitializerBeans.getOrderedBeansOfType(ServletContextInitializerBeans.java:202)
    at org.springframework.boot.web.servlet.ServletContextInitializerBeans.addServletContextInitializerBeans(ServletContextInitializerBeans.java:96)
    at org.springframework.boot.web.servlet.ServletContextInitializerBeans.<init>(ServletContextInitializerBeans.java:85)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getServletContextInitializerBeans(ServletWebServerApplicationContext.java:253)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:227)
    at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:843)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:105)
    ... 23 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'singleSignOutFilter': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'casServerUrlPrefix' of bean class [org.jasig.cas.client.session.SingleSignOutFilter]: Bean property 'casServerUrlPrefix' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1709)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1424)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:591)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:514)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:321)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:319)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:303)
    ... 63 common frames omitted
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'casServerUrlPrefix' of bean class [org.jasig.cas.client.session.SingleSignOutFilter]: Bean property 'casServerUrlPrefix' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    at org.springframework.beans.BeanWrapperImpl.createNotWritablePropertyException(BeanWrapperImpl.java:243)
    at org.springframework.beans.AbstractNestablePropertyAccessor.processLocalProperty(AbstractNestablePropertyAccessor.java:430)
    at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:278)
    at org.springframework.beans.AbstractNestablePropertyAccessor.setPropertyValue(AbstractNestablePropertyAccessor.java:266)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104)
    at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:79)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1705)
    ... 71 common frames omitted
puneetbehl commented 3 years ago

@kastork Did you try the current version of plugin with Grails 4. I think it should not require any major changes but just make sure you are also using the latest version of Grails Spring Security Core plugin.

@virtualdogbert I think the might be unrelated to Grails 4. Could you please share a sample application?

Regarding the current priorities, we are working on updating the Grails Plugin Portal, Migration of plugin from Bintray to Maven Central (including update to the build stuff to publish to Maven instead of Bintray), and the next item would be Grails 5 as that is already delayed a lot.

If you are willing to send a PR to update this plugin, I will be happy to publish a new release or provide any help regarding updation.

virtualdogbert commented 3 years ago

@puneetbehl I think you're right and it seems to work on Grails 4, and the error I'm having is related to: grails.plugin.springsecurity.cas.useSingleSignout = trrue

If I set it to false than it seems to work. This is a new legacy app for me at my new job, just trying to upgrade it, not sure if we actually need that setting. I don't know enough about cas at this point to fix it, and I probably wont have time to create a sample app for a while, as I'm off on my delayed honeymoon tomorrow.

Good luck with the maven update and I'm looking forward to Grails 5 when it comes out. I would definitely put those as higher priority than this at the moment.

virtualdogbert commented 3 years ago

Just to follow up with this the issue that I ran into was related to a conflict introduce by org.grails.plugins:spring-security-rest:3.0.1 having a newer version of org.jasig.cas.client.cas-client-core than what the cas plugin was using, 3.6.x vs 3.4.x. So from my point of view the plugin should work fine in Grails 4.

kmpsharma commented 2 years ago

Our application runs on Grails 2.3.x and we use this CAS plugin, now we are upgrading our app from Grails 2.3.x to Grails 4.0.x, but current version (3.1.0) of this plugin is not compatible with Grails 4, last update published around 4 years ago. It is not giving error, once we enable plugin but it servers even public pages blank. Is any new publish of this plugin for grails 4? Thanks

puneetbehl commented 2 years ago

No, it appears like there hasn't been any update on this plugin. I have been busy with other items. But, if someone would be willing to send a pull-request to support Grails 5. I can take care of publishing the same.

Thanks!

kgeis commented 2 years ago

@puneetbehl I have sent a pull request, #31 to support Grails 5. Unfortunately, I can't figure out what the Gradle scripts should look like around publishing the plugin. Please take a look.

BTW, related to this issue and compatibility with Grails 4, I have used version 3.1.0 with Grails 4.0.x since April 2020.

dylankolson commented 6 months ago

@kgeis are you able to provide an example build.gradle file im having issues getting my plugin to work on Grails 4 or 5.

mainly seeing errors around these beans not being able to be created

            proxyRetriever = ref('casProxyRetriever')
            proxyGrantingTicketStorage = ref('casProxyGrantingTicketStorage')

in

      casTicketValidator(Cas20ProxyTicketValidator, conf.cas.serverUrlPrefix) {
                      acceptAnyProxy = true
                      proxyRetriever = ref('casProxyRetriever')
                      proxyGrantingTicketStorage = ref('casProxyGrantingTicketStorage')
                      proxyCallbackUrl = conf.cas.proxyCallbackUrl
                      renew = conf.cas.sendRenew // false
                  }
kgeis commented 6 months ago

@dylankolson Sorry, I stopped using this plugin.

dylankolson commented 5 months ago

@kgeis thanks - did you replace it with something else?

kgeis commented 5 months ago

@dylankolson I took what I needed from SpringSecurityCasGrailsPlugin.groovy and inlined it into my resources.groovy.

puneetbehl commented 4 months ago

FYI, There is a recent release release which should be compatible with Grails 5 and 6.