0 Replies Latest reply on Nov 9, 2016 1:37 AM by Bhagya Jayakanthi

    Wildfly programmatic login

    Bhagya Jayakanthi Newbie

      I want to programatically authenticate a user via a wildfly login module and redirect the user to a page after a successful authentication.

      I have successfully configured a wildfly login module and authenticated the user. But after the authentication, the redirection to a new page doesn't work. When redirecting to the page, it popups the authentication popup which is not expected. Can anyone help on this?

      Below is my code.

       

      @Override
      protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

           String orgNo = "5555555555";
           String reprNo = "1";

          LoginContext loginContext = new LoginContext("pps", new PPSEndUserCallbackHandler(reprNo, orgNo));

          //this calls the wildfly login module and authenticates the user successfully

          loginContext.login(); 

       

          //This redirection doesn't work. After executing this line it shows the authentication popup to enter user credentials which I don't want to show to the user.

          resp.sendRedirect("p/index.jsf");

         //req.getRequestDispatcher("p/index.jsf").forward(req,resp);

       

      }

       

      Thanks