0

I have URL like http://localhost:8080/default/j_spring_security_check?redirect=1

I want to know how to configure the URL pattern for the above URL

I have tried already the below

<url-pattern>/*</url-pattern>
<url-pattern>/j_spring_security_check/<url-pattern>
<url-pattern>/j_spring_security_check/*<url-pattern>
<url-pattern>/<url-pattern>
<url-pattern>/default/*<url-pattern>

could you please anyone suggest me the correct url pattern to handle the above url. If its not possible is there any other way to filter the url...

Thanks in advance Nithyn K

Nithyn. K
  • 101
  • 1
  • 2
  • 8
  • What do you want to achieve with this filtering ? – Gaël J Dec 21 '15 at 10:01
  • this is related to security issue. the above url i mentioned can be easily hacked by other user with client side script... thats why gonna restrict this url in security wrapper filter – Nithyn. K Dec 21 '15 at 11:38

1 Answers1

0

You cannot filter an URL based on its parameters in the web.xml file. You can only filter on the URL without parameters.

You'll have to do it in the Java code, in a ServletFilter for example or even directly in a Servlet.


Assuming default is the root of your webapp, you can define the url-pattern to /j_spring_security_check/ and match it to a specific Servlet that will check parameters looking into the HttpServletRequest object.

OR

You can write a ServletFilter that will intercept the request before going to a Servlet and check its parameters as well.


EDIT : I didn't notice at first by it looks like you are using Spring and this URL should already be managed by the framework itself.

Gaël J
  • 11,274
  • 4
  • 17
  • 32
  • Thanks Gael.. Can you share sample code ? if possible.. Thanks in advance – Nithyn. K Dec 21 '15 at 10:01
  • I guess that you are using Spring if you have this URL, so first what are you trying to achieve with this filtering ? Because `j_spring_security_check` should already be handled by some Spring code or configuration... – Gaël J Dec 21 '15 at 10:04
  • this is related to security issue. the above url i mentioned can be easily hacked by other user with client side script... thats why gonna restrict this url in security wrapper filter – Nithyn. K Dec 21 '15 at 10:23