2 Replies Latest reply: May 27, 2012 10:29 PM by suraj chhetry RSS

    JASS and custom login using Servlet 3.0 API

    suraj chhetry Newbie

      Hi,

        I am migrating one of my product  from Glassfish 3.1 to jboss 7.1.1. For Security I am using JASS.Everything is working fine expect custome login method. I am using JSF 2.I have my custom login bean through which Iam calling( invoking ) servlet login as below. which was working in Glassfish 3.1 but it is not working in Jboss 7.1.1 .Moreover, HttpServletRequest#login(String,String) is

      Servlet 3.0 API so I think it should work without any issue. Do i need to confige any thing ??

       

      @Named

      public class LoginBean{

       

          private String userId; //getter,setter

          private String password; //getter,setter

       

      public String doLogin() {

              SessionStore session = null;

              try {

                  HttpServletRequest request = getHttpServletRequest();

       

                  request.login(userId, password);//Validating through JASS

       

                  User user = this.userService.findUserByUserName(userId);

                  session = new SessionStore(user.getRole().getRoleType());

                  session.setUsername(userId);

       

                  if (request.isUserInRole(RoleType.Agent.getLabel())) {

                      Agent agent = this.agentService.findAgentByUserName(userId);

                      session.setAgentCode(agent.getAgentCode());

                      session.setAgentId(agent.getId());

                  }

       

                  return "pretty:home";

              } catch (Exception ex) {

                  ex.printStackTrace();

                  JsfUtil.addErrorMessage("Login failed");

                  return "pretty:login";

              }

       

          }

      }