Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: Grails-Spring-Security-Core 0.3.1
    • Labels:
      None

      Description

      There seems to be a reloading issue in the Grails security core plugin. Every time I change a domain class, or something else to trigger a reload, the reloading works fine, but one my next request (I only tested with unprotected as well as with protected controllers), the validation fails:

      2010-06-21 18:28:27,161 [http-8080-1] ERROR [/allseas-ui].[default]  - Servlet.service() for servlet default threw exception
      java.lang.NullPointerException
      	at org.codehaus.groovy.grails.plugins.springsecurity.AnnotationFilterInvocationDefinition.determineUrl(AnnotationFilterInvocationDefinition.java:77)
      	at org.codehaus.groovy.grails.plugins.springsecurity.AbstractFilterInvocationDefinition.getAttributes(AbstractFilterInvocationDefinition.java:76)
      	at org.springframework.security.access.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:171)
      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:106)
      	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
      	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
      	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
      	at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
      	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
      	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
      	at org.codehaus.groovy.grails.plugins.springsecurity.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:40)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
      	at org.codehaus.groovy.grails.plugins.springsecurity.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:79)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
      	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
      	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
      	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
      	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
      	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.codehaus.groovy.grails.web.servlet.filter.GrailsReloadServletFilter.doFilterInternal(GrailsReloadServletFilter.java:104)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:67)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:63)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
      	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
      	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
      	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
      	at java.lang.Thread.run(Thread.java:637)
      2010-06-21 18:28:28,086 [Thread-447] INFO  plugins.DefaultGrailsPlug
      

      So my guess is that the UrlMapping is not loaded correctly, but I am far from an expert on the Grails internals. If you want more info, or want me to test something, please let me know!

      Some relevant sections from my Config:

      // Added by the Spring Security Core plugin:
      grails.plugins.springsecurity.userLookup.userDomainClassName = 'com.nidera.risk.allseas.User'
      grails.plugins.springsecurity.userLookup.authorityJoinClassName = 'com.nidera.risk.allseas.UserRole'
      grails.plugins.springsecurity.authority.className = 'com.nidera.risk.allseas.Role'
      
      // Only use crowd when in online mode
      if(allseas.authorization.crowd) {
         grails.plugins.springsecurity.providerNames = ['crowdAuthenticationProvider']
      }
      
      grails.plugins.springsecurity.voterNames = [
        'roleVoter', 'authenticatedVoter'
      ]
      

      And my resources.xml

         if (CH.config.allseas.authorization.crowd) {
      
             crowdAuthenticationProvider(RemoteCrowdAuthenticationProvider, ref('crowdAuthenticationManager'), ref('httpAuthenticator'), ref('userDetailsService'))
      
             userDetailsService(CrowdUserDetailsServiceImpl) {
                 authenticationManager = ref("crowdAuthenticationManager")
                 groupMembershipManager = ref("crowdGroupMembershipManager")
                 userManager = ref("crowdUserManager")
             }
         }
      
         roleVoter(RoleVoter) { rolePrefix = "" }
      
         authenticatedVoter(AuthenticatedVoter)
      

      I'm running Grails 1.3.2 on a Mac 10.6.4. If you need anything to help to reproduce, let me know!

        Activity

        Hide
        Arshia Khan added a comment -

        I have the same problem - I'm using version 0.4 of this plugin, but I'm still on Grails 1.3.1 on a Mac 10.5.8. I have only overridden the userDetailsService and added my own AuthenticationProvider.

        Let me know if I can also offer up some more details, thanks!

        Show
        Arshia Khan added a comment - I have the same problem - I'm using version 0.4 of this plugin, but I'm still on Grails 1.3.1 on a Mac 10.5.8. I have only overridden the userDetailsService and added my own AuthenticationProvider. Let me know if I can also offer up some more details, thanks!
        Hide
        Burt Beckwith added a comment -

        I've found the core cause, but it's not completely fixed on my end. Try changing the three instances of

        if (conf.securityConfigType == SecurityConfigType.Annotation) {
        

        with

        if (conf.securityConfigType.name() == 'Annotation') {
        

        in SpringSecurityCoreGrailsPlugin.groovy and see if that fixes it for you. I'm getting 404s after reloading with this fix but it may be unrelated.

        Show
        Burt Beckwith added a comment - I've found the core cause, but it's not completely fixed on my end. Try changing the three instances of if (conf.securityConfigType == SecurityConfigType.Annotation) { with if (conf.securityConfigType.name() == 'Annotation') { in SpringSecurityCoreGrailsPlugin.groovy and see if that fixes it for you. I'm getting 404s after reloading with this fix but it may be unrelated.
        Show
        Burt Beckwith added a comment - http://github.com/grails-plugins/grails-spring-security-core/commit/60882b898b02209a85a8f6853bcb0f5664fafc91
        Hide
        Willem Dekker added a comment - - edited

        Changed the SpringSecurityCoreGrailsPlugin.groovy as mentioned above. And now I get the 404 with no additional information in the console.

        Could it have something to do with session invalidation after reloading?

        Show
        Willem Dekker added a comment - - edited Changed the SpringSecurityCoreGrailsPlugin.groovy as mentioned above. And now I get the 404 with no additional information in the console. Could it have something to do with session invalidation after reloading?

          People

          • Assignee:
            Burt Beckwith
            Reporter:
            Erik Pragt
          • Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: