3 Replies Latest reply on Aug 21, 2007 6:38 PM by Pete Muir

    access to userPrincipal's role of the external context

    Adrien Loyat Newbie

      Hello

      I'm using jboss authentification in my seam application as described in Securing a Web Application in JBoss AS in the wiki.

      In a back bean, i'm trying to pupulate identity classe. I am able to get the user name like this :


      HttpServletRequest req = (HttpServletRequest) facesContext.getExternalContext().getRequest();
      System.out.println( "req login : " + req.getUserPrincipal().getName());
      identity.setUsername(req.getUserPrincipal().getName());
      identity.login();


      I want to get the role too. When debbuging, i can see that req.getUserPrincipal() is a JBossGenericPrincipal. So i should be able to use
      req.getUserPrincipal().getRoles(). Nevertheless JBossGenericPrincipal is not visible for me. So I can't cast req.getUserPrincipal() into JBossGenericPrincipal .

      Does anybody has I idea on how to access to the roles in the external contexts ?

      Thanks for your help.
      Adrien