Results 1 to 4 of 4

Thread: Spring Security in a Web Bundle?

  1. #1
    Join Date
    Oct 2008
    Posts
    7

    Default 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. #2
    Join Date
    Nov 2008
    Posts
    8

    Default

    Looks like the context file isn't being picked up. Where, relative to the root of the WAR, is your configuration located?
    Rob van Oostrum, RvO Consulting

  3. #3
    Join Date
    Oct 2008
    Posts
    7

    Default

    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]

  4. #4
    Join Date
    Oct 2008
    Posts
    7

    Default 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:="/*"

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •