Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 重新登录Flex导致Channel.Connect.Failed错误NetConnection.Call.Failed:HTTP:Status 500:url_Java_Apache Flex_Authentication_Login_Blazeds - Fatal编程技术网

Java 重新登录Flex导致Channel.Connect.Failed错误NetConnection.Call.Failed:HTTP:Status 500:url

Java 重新登录Flex导致Channel.Connect.Failed错误NetConnection.Call.Failed:HTTP:Status 500:url,java,apache-flex,authentication,login,blazeds,Java,Apache Flex,Authentication,Login,Blazeds,我们在使用Flex 4、BlazeDS和WebLogic 10.3.5重新登录Flex应用程序时遇到问题 导致问题的用例如下所示: 在浏览器中启动应用程序 重定向到具有j_安全检查操作的登录表单页面 登录并使用应用程序 点击浏览器中的“后退”按钮 再次进入登录表单页面 再次登录 在BlazeDS中获取异常并在Flex/ActionScript中捕获错误 登录WLS时捕获的异常: [BlazeDS]Unexpected error encountered in Message Broker ser

我们在使用Flex 4、BlazeDS和WebLogic 10.3.5重新登录Flex应用程序时遇到问题

导致问题的用例如下所示:

  • 在浏览器中启动应用程序
  • 重定向到具有j_安全检查操作的登录表单页面
  • 登录并使用应用程序
  • 点击浏览器中的“后退”按钮
  • 再次进入登录表单页面
  • 再次登录
  • 在BlazeDS中获取异常并在Flex/ActionScript中捕获错误
  • 登录WLS时捕获的异常:

    [BlazeDS]Unexpected error encountered in Message Broker servlet
    flex.messaging.LocalizedException: The FlexSession is invalid.
            at flex.messaging.FlexSession.checkValid(FlexSession.java:943)
            at flex.messaging.FlexSession.getUserPrincipal(FlexSession.java:254)
            at flex.messaging.HttpFlexSession.getUserPrincipal(HttpFlexSession.java:286)
            at flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java:296)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
            at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
            at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3717)
            at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
            at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
            at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
            at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
            at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
            at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
            at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
            at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    
    Flex/ActionScript中捕获的错误:

    faultCode: Client.Error.MessageSend
    faultString: Send failed
    faultDetail: Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 500: url: 'http://server:port/web-project/messagebroker/amf'
    
    BlazeDS似乎在第一个会话仍然有效且处于活动状态时获得第二个会话

    有谁知道,这正是导致这个问题的原因,以及如何优雅地解决它们?我有一些建议,但不知道它们是否足够合适:

    • 捕获Flex/ActionScript中的错误,重定向到注销页面以使会话无效,然后重定向到登录页面并创建新会话
    • 通过JavaScript禁用浏览器中的“后退”按钮

    如有任何建议、解释和建议,我将不胜感激。谢谢。

    问题在于会话固定

    发生了什么:

    • 您登录
    • 你有一个会议
    • 获得FlexSession(设置为会话属性)
    • 你点击后退按钮
    • 您登录(传递旧的jsessionid)
    Spring的会话固定保护策略:

    • 检测jsessionid的会话是否有效
    • 提取旧会话的属性
    • 使会话无效(将其销毁)
    • 创建新会话
    • 将旧会话的属性转移到新会话
    旧会话被销毁时,FlexSession将变为“无效”

    创建会话时会再次创建FlexSessions, 由于策略传递的引用与失效的引用相同 (浓重的俄语口音)“我们有问题”

    通过将策略
    bmigratedattributes
    设置为false,可以轻松解决此问题:

    <security:session-management session-authentication-strategy-ref="sas" />
      <bean id="sas class="org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy"   p:migrateSessionAttributes="false"/>
    
    
    
    问题是会话固定

    发生了什么:

    • 您登录
    • 你有一个会议
    • 获得FlexSession(设置为会话属性)
    • 你点击后退按钮
    • 您登录(传递旧的jsessionid)
    Spring的会话固定保护策略:

    • 检测jsessionid的会话是否有效
    • 提取旧会话的属性
    • 使会话无效(将其销毁)
    • 创建新会话
    • 将旧会话的属性转移到新会话
    旧会话被销毁时,FlexSession将变为“无效”

    创建会话时会再次创建FlexSessions, 由于策略传递的引用与失效的引用相同 (浓重的俄语口音)“我们有问题”

    通过将策略
    bmigratedattributes
    设置为false,可以轻松解决此问题:

    <security:session-management session-authentication-strategy-ref="sas" />
      <bean id="sas class="org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy"   p:migrateSessionAttributes="false"/>
    
    
    
    我也有同样的问题,但我希望保留所有会话属性,而不仅仅是Spring属性,因此我没有将migrateSessionAttributes设置为false,以便在会话中保留非Spring属性

    我最终覆盖了SessionFixationProtectionStrategy,因此我仍然可以利用会话固定的好处来迁移所有属性

    onSessionChange方法中,我专门删除了“uu flexSession”属性

    package xxxxx;
    
    import javax.servlet.http.HttpSession;
    
    import org.springframework.security.core.Authentication;
    import org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy;
    import org.springframework.stereotype.Component;
    
    
    @Component
    public class MySessionFixationProtectionStrategy extends SessionFixationProtectionStrategy {
        private static String FLEX_SESSION_ATTRIBUTE = "__flexSession";
    
        @Override
        protected void onSessionChange(String originalSessionId, HttpSession newSession, Authentication authentication) {
            // We remove the flex session attribute to avoid "The FlexSession is invalid." exception
            newSession.removeAttribute(FLEX_SESSION_ATTRIBUTE);
    
            super.onSessionChange(originalSessionId, newSession, authentication);
        }
    }
    

    我也有同样的问题,但我希望保留所有会话属性,而不仅仅是Spring属性,因此我没有将migrateSessionAttributes设置为false,以便在会话中保留非Spring属性

    我最终覆盖了SessionFixationProtectionStrategy,因此我仍然可以利用会话固定的好处来迁移所有属性

    onSessionChange方法中,我专门删除了“uu flexSession”属性

    package xxxxx;
    
    import javax.servlet.http.HttpSession;
    
    import org.springframework.security.core.Authentication;
    import org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy;
    import org.springframework.stereotype.Component;
    
    
    @Component
    public class MySessionFixationProtectionStrategy extends SessionFixationProtectionStrategy {
        private static String FLEX_SESSION_ATTRIBUTE = "__flexSession";
    
        @Override
        protected void onSessionChange(String originalSessionId, HttpSession newSession, Authentication authentication) {
            // We remove the flex session attribute to avoid "The FlexSession is invalid." exception
            newSession.removeAttribute(FLEX_SESSION_ATTRIBUTE);
    
            super.onSessionChange(originalSessionId, newSession, authentication);
        }
    }
    

    谢谢你的提示。我现在不在那个项目上工作,但我回来后会检查它,并让你们都知道结果。谢谢你们的提示。我现在不在那个项目上工作,但我回来后会检查它,并让你们都知道结果。