通过https的Spring安全注销无法正常工作

时间:2012-12-10 19:04:02

标签: jboss spring-security

我有Spring Security的基本配置。注销按钮在HTTP上工作得非常好,但在处理HTTPS时会出现问题。我的安全配置如下所示:

<http use-expressions="true" auto-config="false" entry-point-ref="http403EntryPoint"
      access-denied-page="/accessDenied">
    <intercept-url pattern="/**" access="hasRole('AA_ACCESS')" requires-channel="any"/>
    <custom-filter position="PRE_AUTH_FILTER" ref="siteminderFilter"/>
    <session-management>
        <concurrency-control max-sessions="1" expired-url="/sessionExpired"/>
    </session-management>
    <logout invalidate-session="true" delete-cookies="JSESSIONID"/>
</http>

退出按钮:

<a href="<c:url value="${requestScope.pageContext.servletContext.contextPath}/j_spring_security_logout" />">Logout</a>

正如我所说,一切都可以通过HTTP正常工作,但不是HTTPS。

我收到错误404页面未找到。应用程序运行的端口是:11501用于JBoss AS,而HTTPS是Apache,带有ajp连接器到JBoss,apache是​​16000,ajp 8009。

2 个答案:

答案 0 :(得分:1)

卢克泰勒是对的。这不是Spring Secuiry问题。记住孩子,在你的同事之后检查一切。就我而言,Apache VirtualHost配置错误:

<VirtualHost *:11600>
    ServerName localhost
    DocumentRoot "/apache/htdocs/aa"
    SSLEngine on
    SSLCertificateFile "/apache/conf/server.crt"
    SSLCertificateKeyFile "/apache/conf/server.key"
    ProxyPass /admin ajp://localhost:8009/admin/ <--- HERE
    <Directory "/apache/htdocs/aa">
      DirectoryIndex index.html
      AllowOverride All
      Order allow,deny
      Allow from all
    </Directory>
    ErrorLog "logs/error_log"
    CustomLog "logs/access_log" common
    LogLevel debug
</VirtualHost>  

注意ProxyPass结束时的其他斜杠,这就是问题

答案 1 :(得分:0)

不知道为什么它适用于http所以我不知道这是否会有所帮助,但您可以尝试在注销配置上设置logout-success-url,以防404错误是由于您丢失的页面所致注销完成后重定向。

http://static.springsource.org/spring-security/site/docs/3.1.x/reference/springsecurity-single.html#nsa-logout