【问题标题】:https in default-target-url spring securityhttps in default-target-url spring security
【发布时间】:2010-02-09 07:03:52
【问题描述】:

我们在我们的系统中使用 Spring Security,我们的服务器使用 https 方案。

但是应用程序在 http 而不是 https 上运行,所以服务器是 apache, 是 https 处理程序。而应用程序在防火墙后面的 http 上运行。

工作代码:

<form-login login-page="/Login.html"    
authentication-failure-url="https://www.ourapp.com/FailureLogin.jsp"  
always-use-default-target="false"  
default-target-url="https://www.ourapp.com/SuccessLogin.jsp"/>  
<form-login login-page="/Login.html" 
authentication-failure-url="https://www.ourapp.com/FailureLogin.jsp"
always-use-default-target="false"
default-target-url="https://www.ourapp.com/SuccessLogin.jsp"/>

不工作的代码:

<form-login login-page="/Login.html"    
authentication-failure-url="/FailureLogin.jsp"  
always-use-default-target="false"  
default-target-url="/SuccessLogin.jsp"/>  
<form-login login-page="/Login.html" 
authentication-failure-url="/FailureLogin.jsp"
always-use-default-target="false"
default-target-url="/SuccessLogin.jsp"/> 

有什么办法可以提及: 重定向到以 /SuccessLogin.jsp 结尾但使用 https 协议的 URL?

供参考,问题交叉发布@Code ranch PS:TargetUrlResolver 可以帮我配置吗?

【问题讨论】:

    标签: java https spring-security


    【解决方案1】:

    使用requires-channel="https"

    <http>
      <intercept-url pattern="/**" requires-channel="https" />
    </http>
    

    如果使用的非标准端口提供port-mappings

    <http>
      <intercept-url pattern="/**" requires-channel="https" />
      <port-mappings>
        <port-mapping http="80" https="443" />
        <port-mapping http="9080" https="9443" />
      <port-mappings>
    </http>
    

    【讨论】:

    • 不确定这有什么帮助。如果 apache 正在终止 SSL,那么应用程序将始终接收 http 上的请求,而不是 https。不会添加requires-channel="https" 导致重定向循环?
    猜你喜欢
    • 2012-08-09
    • 2013-07-12
    • 2015-11-21
    • 2020-05-13
    • 2013-04-24
    • 2012-08-03
    • 1970-01-01
    • 1970-01-01
    • 2012-03-29
    相关资源
    最近更新 更多