title: How to access JAAS user in EL
body: <p>I'm using JAAS for authentication and autorization and I don't know how to access the information of the current user..When I use Filter I do something like this : <code>&lt;h:outputText value="#{sessionScope['user'].nom}"&gt;&lt;/h:outputText&gt;</code> but with JAAS authentification I cant do the same :\ I want to get user session information to use them in EJB to insert some value into my database.(excuse me for my bad english :\ )
  You can find here my login method :</p>
  
  <pre><code> public String loginn() throws Exception{
  
            String message = "";
            String navto = "" ;
            HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
            try
            { //Login via the Servlet Context
            request.login(username, password);
            //Retrieve the Principal
            Principal principal = request.getUserPrincipal();
            if(principal == null){
                  throw new Exception("Invalid user/password");
              }
  
            //Display a message based on the User role
  
            if
            (request.isUserInRole("Administrator" )){
           message = "Username : " + principal.getName() + " You are an Administrator, you can really many things up now";
           navto = "admin";
           }
            else
            if
            (request.isUserInRole("Manager")){
           message = "Username : " + principal.getName() + " You are only a Manager, Don't you have a Spreadsheet to be working on??" ;
            navto = "manager" ;
            }
            else
            if
            (request.isUserInRole("Guest")){
           message = "Username : " + principal.getName() +  " You're wasting my resources..."  ;
            navto ="guest";
            }
           //Add the welcome message to the faces context
           FacesContext.getCurrentInstance().addMessage( null , new  FacesMessage(FacesMessage.SEVERITY_INFO, message, null ));
           return navto;
           }
            catch
            (ServletException e) {
           FacesContext.getCurrentInstance().addMessage( null ,new  FacesMessage(FacesMessage.SEVERITY_ERROR,"An Error Occured: Login failed" , null ));
           e.printStackTrace();
           }
           return "failure" ;
  </code></pre>
  
  <p>Thank you for help :) </p>