i am using data realm for login authentication. it works fine. i am also using primefaces 3.2 components in my app, they also work fine BUT the problem occurs on homepage before login. The primefaces components are not rendered properly(for eg. the tab menu is displayed as simple links one below other, buttons are displayed as simple jsf buttons,etc.) and the login works fine , when i clear the browsing history from my browser, the primefaces are rendered correctly but now the realm fails to work, i am redirected to the error page, why does this happen? how do i solve it? the homepage of my app is ruined due to this.

有帮助吗?

解决方案

It seems that your Primefaces resources are in the restricted folders. Exclude the resources folder from your security constraints definitions.

This is an example configuration from one of my projects. First I restrict access to the whole project (allowing only specific roles to access):

<security-constraint>
        <display-name>Secured project</display-name>
        <web-resource-collection>
            <web-resource-name>Secured project</web-resource-name>
            <description/>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>user</role-name>
            <role-name>admin</role-name>
        </auth-constraint>
    </security-constraint>

Then I add exceptions for folders that can be accessed by any user:

<security-constraint>
    <display-name>Exceptions</display-name>
    <web-resource-collection>
        <web-resource-name>Exceptions</web-resource-name>
        <description/>
        <url-pattern>/resources/*</url-pattern>
        <url-pattern>/faces/resources/*</url-pattern>
        <url-pattern>/faces/javax.faces.resource/*</url-pattern>
    </web-resource-collection>
</security-constraint>

You need to adapt this to your security policy and folder structure.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top