1 Reply Latest reply on Nov 4, 2004 9:32 PM by Scott Stark

    getUserPrincipal() retuns null after authentication

    sudarshan muramreddy Newbie

      Hi All,
      I am doing authentication using code below

      String authenticationType = getServletConfig().getInitParameter("authentication");
       SecurityAssociationHandler handler = new
       SecurityAssociationHandler();
       SimplePrincipal user = new SimplePrincipal(userName);
       handler.setSecurityInfo(user, password.toCharArray());
      
       LoginContext ctx = new LoginContext(authenticationType, handler);
      
       ctx.login();


      authentication is going fine and even i can retrieve the principles from subject.
      But when i am trying to get the UserPrinciple() from servelt it's returning null and even isUserInRole() returning null.

      Is i need to do some thing to attach my subject to servlet container..
      Any help is appreciated.

      Regards,
      Sudarshan