We use access manager in our company, access manager authenticate user and send to us information about user in http header. In my JSF application, I need username when to session begin, and with this username I determine the user role from my database and hidden some component on the page. When I must the username info and which with mechanism. SessionListener, PhaseListener?
So far;
I created a sessionScoped managedbean UserData, and i try to set this managed bean phaseListener afterPhase
@Override
public void beforePhase(PhaseEvent event) {
}
@Override
public void afterPhase(PhaseEvent event) {
HttpServletRequest request = (HttpServletRequest) FacesContext
.getCurrentInstance().getExternalContext().getRequest();
accessManagerUser.setUserName((String) request
.getHeader("LOGINNAME"));*/
}
But in this scenario when a request done to page, this function run, ı want a function runs once and before the everything and set the Username of SessionScopeManaged Bean.
I try to achieve this.
- Read from header when the request come and get the userName.
- Ask database with this username and get role of the user.
- Store this roles in SessionScoped ManagedBean.
- Use this role until session end.
*/
but no opening/*
. – Cœur