neharob / prettyfaces

Automatically exported from code.google.com/p/prettyfaces
0 stars 0 forks source link

Restriction for patterns, user-agent, and http-headers #109

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be very useful in my opinion to restrict the direct access to 
resources by a pattern.
If a user requests /admin/admin.xhtml it can only be restricted to show him the 
site if the file is within the WEB-INF dir or by a filter. This could be done 
with:

1. Url-Condition

<url-condition>
  <pattern value=".*\.xhtml"/>
  <alternative-view-id>/pageNotFound.xhtml</alternative-view-id>
</url-condition>

or with an own tag, e.g. <url-restriction> or so.
Maybe there is already a solution for direct access of files, but i don't know 
it.

Original issue reported on code.google.com by christia...@gmail.com on 20 May 2011 at 9:22

GoogleCodeExporter commented 9 years ago
I think you could achieve something like this very easily with rewrite rules. 
Check this part of the documentation:

http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/inbound_rewriting.html 

Original comment by chkalt on 21 May 2011 at 8:27

GoogleCodeExporter commented 9 years ago
the problem is that i cannot define a target to which the request should be 
forwarded to, just redirection is possible, or have i missunderstood the docs?

Original comment by christia...@gmail.com on 21 May 2011 at 10:50

GoogleCodeExporter commented 9 years ago
You could use redirect="chain" for this. See:

http://ocpsoft.com/docs/prettyfaces/3.2.0/en-US/html/inbound_rewriting.html#inbo
und_rewriting.options

Original comment by chkalt on 21 May 2011 at 3:27

GoogleCodeExporter commented 9 years ago
Servlet Filter is still the only known working solution for me. Is there any 
chance that you will provide a feature that will take care of such things?

Original comment by christia...@gmail.com on 28 May 2011 at 7:32

GoogleCodeExporter commented 9 years ago
What about if we allow rewrite rules to send 404 or other HTTP codes?

<rewrite match="/(.*)\.xhtml" redirect="404"/>

Would that help?

Original comment by chkalt on 29 May 2011 at 8:28

GoogleCodeExporter commented 9 years ago
Probably this would do the trick. You would need more of these fancy features 
in PF, i would really like to see the user agent stuff and things like this.

Original comment by christia...@gmail.com on 7 Jun 2011 at 7:48

GoogleCodeExporter commented 9 years ago

Original comment by lincolnb...@gmail.com on 24 Jun 2011 at 1:43

GoogleCodeExporter commented 9 years ago
Solved in PF4 by using Rewrite

Original comment by lincolnb...@gmail.com on 2 Oct 2011 at 6:49