Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

https in default-target-url spring security

we are using spring security into our systems and our server is using the https scheme.

However the application is running on http not https, so the server, being apache, is the https handler. whereas the application is running on http behind a firewall.

Working code:

<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"/>

Not working code:

<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"/> 

is there any way to mention : Redirect to Url ending with /SuccessLogin.jsp but using https protocol ?

For reference, question is cross posted @ Code ranch PS: I can TargetUrlResolver help me in configurations ?

like image 371
Salvin Francis Avatar asked Feb 09 '10 07:02

Salvin Francis


1 Answers

use requires-channel="https"

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

If non standard ports in use provide 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>
like image 51
Prashant Bhate Avatar answered Nov 09 '22 13:11

Prashant Bhate