Search code examples
javasecurityjakarta-eeaccess-controluser-management

user access management in j2ee web application


I am working with jsp/servlet project and I have to complete the module of access management to my jsps since I have more than one user with different profile.

I defined a table in my database which resume the profil and the url permitted like that:

id_profil :1 
url : http://localhost/...xyz.jsp
id page 1

Now I am trying to let the menu modified appropriately to the id_profil of the logged user.

So there are pages allowed in one profile but must be hidden to others. I have no idea since now how to realize this.


Solution

  • It's kinda a vague exaplanation but you could use an if in your jsp to hide the menu options based on id_profil, something like this:

    <c:if test="${currentUser.id_profil == 1}">
       <button label="Only id_profil 1"/>
    </c:if>