0 Replies Latest reply on Mar 23, 2005 8:28 AM by Rene Felder

    Get Realm from context

    Rene Felder Newbie


      how do I use the logout using the realm-name from the web.xml.

      I wrote a custom LoginModul and registered this in the login-config.xml within JBOSS/server/default/conf.

      Then I added an entry in the web.xml to configure my webapplication for JAAS Security. I also added a jboss-web.xml file with the necessary entry.

      The login as well as the EJB Security works fine!!! The problem arises if I want to log the user out. My first solution was to add a method logout() to the principal which is accessible in the whole web application. The logout method does the following:

      public void logout() throws LoginException {
      LoginContext loginContext =
      new LoginContext("XYModul",
      new UsernameCallbackHandler(getName(), password));

      The problem is, that I do not want to hardcode the String for the login module. It should be derived from the web.xml of the current web application.

      I didn't found out how I could retrieve the realm-name from the web.xml.

      Can anyone help me?