doubts to block page transition via URL

0

I'm wondering how do I block any kind of page transitions via URL regardless of whether the user is logged in or not, for example if I'm on the home.xhtml page, I can only go to another page if I click on the referrer button to it, because currently I am in home.xhtml and in the URL I put for example general.xhtml it goes to general page and I would like to prevent it, if anyone can help I am grateful.

    
asked by anonymous 07.10.2016 / 19:17

1 answer

0

I think the good thing would be to use JAAS to handle both authentication and access authorization or Spring Security or Apache Shiro and configure ROLES and user groups.

But if the control is simple you could create a JSF PhaseListener where you can intercept the life cycle phases, an example is the restore phase of the view (PhaseId.RESTORE_VIEW), could create a logic so that when the resource that is accessed is being performed by a user who is not logged on to the system or who does not have access permission to the page could redirect it to the login page (if it is not authenticated) or if it is already browsing but not should have access to the feature could display a friendly message. Below I added a link has an example of a very simple control, which from it I believe I can adapt to your model, improve and use it if you do not opt for a more strict control with the technologies I mentioned above.

Login PhaseListener

    
07.10.2016 / 19:38