tags:

views:

81

answers:

2

Hello, I configure my web application to use SSL using my own self signed certificate. Everything is working fine but here my whole site is https now as i used :-

<transport-guarantee>CONFIDENTIAL</transport-guarantee>

However, i only want my login page to use SSL and not complete site. What changes do i need to make in my application?

Thanks in advance :)

+1  A: 
  • let all links be regular
  • let the link to the login page be https://...
  • on the login page make sure all links are http://

For example:

<a href="https://&lt;%= request.getServerName() %>/login.jsp">

(you many need to also include request.getServletContext().getContextPath() as well)

Bozho
Hi Bozho! You mean i should hardcode everything like http://localhost/common/abc.jsf? rather than /common/abc.jsf?
Ankit Rathod
not hardcode. Use it dynamically, via `request` - it holds all the data - the server, the url, the context
Bozho
see my updated answer
Bozho
Hi Bozho, the solution you posted is not working. When i change from https to http the login fails and i get this exception as i am using jdbcRealm :- INFO: JACC Policy Provider: Failed Permission Check, context(Blogger/Blogger)- permission((javax.security.jacc.WebUserDataPermission /Login/index.jsf GET))
Ankit Rathod
probably the sessionid is changing that's why this problem is coming
Ankit Rathod
I've implemented https login in exactly the same way. So perhaps there is something other than this.
Bozho
Hi Bozho, see this link, i have done it this way :-http://stackoverflow.com/questions/2914751/why-does-this-redirect-not-work-java-ssl
Ankit Rathod
the first time i do login i get the above exception and the 2nd time i do login :p i go inside members area but with https instead of http. Please help me :(
Ankit Rathod
Shall i post my whole web.xml here?
Ankit Rathod
Hi Bozho, i would to add that if i keep simple <a> on my login page and click there then http works fine. But when i am programmatically redirecting using http it doesn't work.
Ankit Rathod