Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

web.xml login page with parameters?

Tags:

java

security

I have a jsf web application and in my web.xml I have this configuration:

<login-config>
  <auth-method>FORM</auth-method>
  <form-login-config>
   <form-login-page>/mainLoginPage.jsp</form-login-page>
   <form-error-page>/mainLoginPage.jsp?error=true</form-error-page>
  </form-login-config>
</login-config>

Well, all works good for url like:

http://localhost:8080/mainLoginPage.jsp

But I would like to also have the possibility to append url parameter for this mainLoginPage, for instance:

http://localhost:8080/mainLoginPage.jsp?co=google

so, based on the company user, mainLoginPage will do the redict to DIFFERENT login pages, for different companies.

If I try the above parameterized url it will not work because it "thinks" that I request another page and being not logged in it redirects me to the default login.jsp.

The question: Is there a way to specify in web.xml that it should let me to add params for this mainLoginPage instead of hardcoding them in web xml like I did for the error page?

Thanks.

like image 226
Cristian Boariu Avatar asked Nov 14 '22 00:11

Cristian Boariu


1 Answers

I am not sure about parameters in web.xml error page definitions. But you could create a minimalistic JSP page which forwards you to the one with the parameter, something like this:

<!-- in, say, errorLoginPage.jsp -->
<jsp:forward page="/mainLoginPage.jsp?error=true" /></jsp:forward>
like image 104
Axel Knauf Avatar answered Dec 26 '22 10:12

Axel Knauf