2 Replies Latest reply on Jan 29, 2010 5:03 PM by sebastianmohan

    Receiving session object in loginModule

      Hi, All!

       

      I've implemented my own login module which extends org.jboss.security.auth.spi.UsernamePasswordLoginModule. It works fine doing all check and login stuff.

       

      But is there any way to notify my web part which is using the Form based authentication about type of error which has occured in login module?

       

      And can I get access to HttpRequest, HttpResponse objects or even directly to HttpSession from my login module?

        • 1. Re: Receiving session object in loginModule
          atijms

          I was wondering about the same thing.

           

          Maybe you could simply use FacesContext.getCurrentInstance()... if the login was to take place within a Faces context?

           

          Otherwise you might try some of the classes in the org.jboss.web package, e.g. SecurityAssociationValve.activeRequest.get(); for the request and request.getSessionInternal(false); on the result of that to get the session.

          • 2. Re: Receiving session object in loginModule
            sebastianmohan

            I am not sure if this is the clean way of obtaining the HTTPServletRequest from the custom LoginModule. This should work

             

            HttpServletRequest request = (HttpServletRequest) javax.security.jacc.PolicyContext.getContext("javax.servlet.http.HttpServletRequest");