4 Replies Latest reply on Dec 30, 2005 1:50 PM by krishh

    Exception handling Custom Login module

    krishh

      We have developed a new Custom Login Module which does the role mapping by getting the mapping roles from the database.
      We are running into a problem when there is an exception in the login module we are not able to display the error on the browser.
      We are throwing a LoginException to the JBoss and JBoss is throwing a 401 authentication error but I do not know how to get the error message from it.
      Is there a way we can get the error message, so that we can display it on the web page.

        • 1. Re: Exception handling Custom Login module
          krishh

          This part of code in my Custom Login Module throws LoginException

          protected Group[] getRoleSets() throws LoginException {
          Group[] newRoleSets = null;
          HttpSession session=null;
          try {
          Group[] roleSets = super.getRoleSets();
          newRoleSets = addRoleAssignment(roleSets);

          } catch (Exception e) {
          logger.error("Exception raised " + e);
          //handling the exception for the jsp page.

          throw new LoginException("Exception raised in getRoleSets(): \n"+e.toString());

          }
          // return super.getRoleSets();
          return newRoleSets;
          }


          When a LoginException raises the authentication error is passed to the browser and customerror page is displayed as configured in the web.xml
          <error-page>
          <error-code>401</error-code>
          /unrestricted_pages/loginError.jsp
          </error-page>

          along with this I wanted to display the error message causing the LoginException raised. Can anyone tell if there is a way to do that.

          • 2. Re: Exception handling Custom Login module
            jason.greene

            how is this related to web services?

            -Jason

            • 3. Re: Exception handling Custom Login module
              krishh

              This issue is not related to the web services. The issue is related to the role mapping in the JAAS security. We have our role mapping in WAS defined in the ibm-application-bnd.xmi bindings. There is no way to implement this in JBOSS. For this reason I had to implement the Custom Login Module to do the role mappings.
              The CLM worked fine but was not throwing exceptions onto the browser and we had to go to server logs to see if there is an error.
              But the solution to this issue is:
              http://wiki.jboss.org/wiki/Wiki.jsp?page=ExtendedFormAuthenticator

              Thanks for all who looked into this thread.

              • 4. Re: Exception handling Custom Login module
                krishh

                I am seeing that I am in JBoss.com -> JBoss User -> Security & JAAS/JBoss
                I think this is the one where I should be posting my questions.