Announcement Announcement Module
Collapse

Spring Dynamic Modules forum decommissioned in favor of Eclipse Gemini Blueprint

With the official first release of Eclipse Gemini Blueprint shipped, the migration of the Spring Dynamic Modules code base to the Eclipse Foundation, as part of the Gemini project, has been completed.

As such, this forum has been decommissioned in favour of the Eclipse Gemini forums.
See more
See less
Spring Security in a Web Bundle? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Security in a Web Bundle?

    I would like to add basic authentication to a web bundle and I am using the Spring DM server.

    My problem is that the application cannot find a filterChainProxy. The same configuration works on a standalone example application.


    bundle-context.xml
    Code:
     <security:global-method-security secured-annotations="enabled" />
        <security:authentication-provider>
            <security:password-encoder hash="plaintext"/>
            <security:user-service>
                <security:user name="james" password="secret" authorities="ROLE_USER" />            
            </security:user-service>
        </security:authentication-provider>
         
        <security:http auto-config="true">
            <security:intercept-*** pattern="/**" access="ROLE_USER" />
            <security:http-basic/>            
        </security:http>
    web.xml:

    Code:
      <listener>
            <listener-class>
                org.springframework.web.context.ContextLoaderListener
            </listener-class>
        </listener>
    
    
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>
                /*.xml
            </param-value>
        </context-param>
    
    
       <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>
                org.springframework.web.filter.DelegatingFilterProxy
            </filter-class>
        </filter>
    
        <filter>
            <filter-name>encoding-filter</filter-name>
            <filter-class>
                org.springframework.web.filter.CharacterEncodingFilter
            </filter-class>
            <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
            </init-param>
        </filter>
    
        <filter-mapping>
            <filter-name>encoding-filter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    
        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    trace.log:

    Code:
         org.springframework.web.context.ContextLoader.unknown I Root WebApplicationContext: initialization completed in 2 ms
    [2008-11-07 15:16:05.992] async-delivery-thread-1  e.[springsource.server.catalina].[localhost].[/webadmin].unknown E Exception starting filter springSecurityFilterChain
    org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSecurityFilterChain' is defined
    
    
    
    I would be happy to have a very basic example that works.
    Thanks.

  • #2
    Looks like the context file isn't being picked up. Where, relative to the root of the WAR, is your configuration located?

    Comment


    • #3
      Location: META-INF/spring/bundle-context.xml

      It seems like it finds the context file, see log entry:
      Code:
      [2008-11-07 15:16:05.407] server-dm-0              pringframework.beans.factory.xml.XmlBeanDefinitionReader.unknown I Loading XML bean definitions from URL [bundleentry://105/META-INF/spring/bundle-context.xml]

      Comment


      • #4
        Solution

        I found the solutions:

        1. Took away filter chain configuration from web.xml

        2. Added the following to the manifest of my web bundle
        Code:
        Web-FilterMappings: springSecurityFilterChain;url-patterns:="/*"

        Comment

        Working...
        X