Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid user access to .xhtml page in JSF?

Tags:

java

jsf

jsf-2

I am new to JSF and writing first simply jsf web app.

URL with .jsf are mapping to .xhtml files in WebContent but why I can open .xhtml in web browser with all jsf tags. How to protect this?

like image 535
e2k Avatar asked Apr 15 '11 10:04

e2k


1 Answers

You could add a security constraint to your web.xml blocking all requests to *.xhtml.

<security-constraint>
    <display-name>Restrict raw XHTML Documents</display-name>
    <web-resource-collection>
        <web-resource-name>XHTML</web-resource-name>
        <url-pattern>*.xhtml</url-pattern>
    </web-resource-collection>
    <auth-constraint />
</security-constraint>
like image 176
stacker Avatar answered Oct 20 '22 20:10

stacker