Spring security and Atmosphere ... tried it all ... but no luck

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Spring security and Atmosphere ... tried it all ... but no luck

Claudiu Muresan
This post has NOT been accepted by the mailing list yet.
Hi, I'm trying to integrate Atmosphere (playing with version 1.0.0.beta5) in a Spring MVC (3.1.0 release) application. The problem I ran into is related to Spring's security filter chain. Actually, the filter chain is not applied although it is declared in web.xml. Googling around I found several hacks for doing it, but none of them worked. Could you please give me some guidelines to overcome this issue? Some facts that might help: >> I'm not using any atmosphere.xml >> I'm not using any context.xml under webapp's META-INF >> webapp deployed on JBoss AS 7.1.0.Final >> web.xml content: contextConfigLocation classpath:service-common-context.xml classpath:persistent-context.xml classpath:service-context.xml /WEB-INF/applicationContext-security.xml log4jConfigLocation file:${kmp.conf.dir}/log4j.properties log4jRefreshInterval 2000 org.springframework.web.util.Log4jConfigListener org.springframework.security.web.session.HttpSessionEventPublisher org.springframework.web.context.ContextLoaderListener springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* appServlet org.atmosphere.cpr.MeteorServlet org.atmosphere.servlet org.springframework.web.servlet.DispatcherServlet org.atmosphere.cpr.broadcasterClass org.atmosphere.cpr.DefaultBroadcaster org.atmosphere.resumeOnBroadcast true org.atmosphere.useStream true org.atmosphere.useNative true contextConfigLocation /WEB-INF/dispatcher-servlet.xml 1 true appServlet / 1440 login.jsp >> stacktrace: org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for /j_spring_security_check org.atmosphere.cpr.AsynchronousProcessor.map(AsynchronousProcessor.java:362) org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:206) org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:166) org.atmosphere.container.JBossWebCometSupport.service(JBossWebCometSupport.java:97) org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1266) org.atmosphere.cpr.AtmosphereServlet.event(AtmosphereServlet.java:378) org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2510) org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33) org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:801) org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45) org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:842) java.lang.Thread.run(Thread.java:662) org.jboss.threads.JBossThread.run(JBossThread.java:122) Thanks. Claudiu
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Spring security and Atmosphere ... tried it all ... but no luck

Claudiu Muresan
This post has NOT been accepted by the mailing list yet.
Because of formatting issues, please find the web.xml content below:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
                                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

  <context-param>
        <param-name>contextConfigLocation</param-name>
    <param-value>
                        classpath:service-common-context.xml
                        classpath:persistent-context.xml
                        classpath:service-context.xml
                        /WEB-INF/applicationContext-security.xml
                </param-value>
    </context-param>
 
  <context-param>
                <param-name>log4jConfigLocation</param-name>
                <param-value>file:${kmp.conf.dir}/log4j.properties</param-value>
        </context-param>
       
        <context-param>
                <param-name>log4jRefreshInterval</param-name>
                <param-value>2000</param-value>
        </context-param>
       
        <listener>
                <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
        </listener>
       
        <listener>
                <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
        </listener>

        <listener>
                <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
       
        <filter>
                <filter-name>springSecurityFilterChain</filter-name>
                <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>

        <filter-mapping>
                <filter-name>springSecurityFilterChain</filter-name>
                <url-pattern>/*</url-pattern>
        </filter-mapping>
       
    <servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
       
        <init-param>
          <param-name>org.atmosphere.servlet</param-name>
          <param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
        </init-param>
       
        <init-param>
          <param-name>org.atmosphere.cpr.broadcasterClass</param-name>
          <param-value>org.atmosphere.cpr.DefaultBroadcaster</param-value>
        </init-param>
       
        <init-param>
            <param-name>org.atmosphere.resumeOnBroadcast</param-name>
            <param-value>true</param-value>
        </init-param>
       
        <init-param>
          <param-name>org.atmosphere.useStream</param-name>
          <param-value>true</param-value>
        </init-param>
       
        <init-param>
          <param-name>org.atmosphere.useNative</param-name>
          <param-value>true</param-value>
        </init-param>
       
        <init-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>/WEB-INF/dispatcher-servlet.xml</param-value>
        </init-param>
       
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>

  <servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>

    <session-config>
               
                <session-timeout>1440</session-timeout>
        </session-config>

        <welcome-file-list>
                <welcome-file>login.jsp</welcome-file>
        </welcome-file-list>

</web-app>

Stacktrace:
org.atmosphere.cpr.AtmosphereMappingException: No AtmosphereHandler maps request for /j_spring_security_check
        org.atmosphere.cpr.AsynchronousProcessor.map(AsynchronousProcessor.java:362)
        org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:206)
        org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:166)
        org.atmosphere.container.JBossWebCometSupport.service(JBossWebCometSupport.java:97)
        org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:1266)
        org.atmosphere.cpr.AtmosphereServlet.event(AtmosphereServlet.java:378)
        org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
        org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
        org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
        org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626)
        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2510)
        org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
        org.jboss.threads.QueueExecutor.runTask(QueueExecutor.java:801)
        org.jboss.threads.QueueExecutor.access$100(QueueExecutor.java:45)
        org.jboss.threads.QueueExecutor$Worker.run(QueueExecutor.java:842)
        java.lang.Thread.run(Thread.java:662)
        org.jboss.threads.JBossThread.run(JBossThread.java:122)
Loading...