3 Replies Latest reply on Oct 28, 2004 2:49 PM by Scott Stark

    UnsupportedCallbackException using TextInputCallback

    grmpf Newbie

      Hi,

      for the login I need more than a username and password. I tried to get the additional information by using the TextInputCallback. My Problem is that I get a UnknownCallbackException in my custom LoginModule with the TextInputCallback, only NameCallback and PasswordCallback succeed. The array passed to callbackHandler.handle() has 3 callbacks, but the client gets an array with only 2. Here's the (server) code:

      NameCallback nc = new NameCallback("username");
      PasswordCallback pc = new PasswordCallback("password", false);
      TextInputCallback orgNameCB = new TextInputCallback("organizationName");

      username = null;
      password = null;
      organizationName = null;

      Callback[] callbacks = {nc, pc, orgNameCB};

      try
      {
      callbackHandler.handle(callbacks);
      username = nc.getName();
      password = new String(pc.getPassword());
      organizationName = orgNameCB.getText();
      ...

      Is anyone using TextInputCallback and how did you get it to work?

      Thanks for your help,

      nick..

        • 1. Re: UnsupportedCallbackException using TextInputCallback
          Scott Stark Master

          You would have to specify your hown CallbackHandler implementation that knew how to provide the text information as there is no way for the default JBoss handler to know how to deal with TextInputCallbacks. You would need to specify your CallbackHandler implementation to the JaasSecurityManagerService setup found in the conf/jboss-service.xml descriptor:


           <!-- JAAS security manager and realm mapping -->
           <mbean code="org.jboss.security.plugins.JaasSecurityManagerService"
           name="jboss.security:service=JaasSecurityManager">
           <attribute name="SecurityManagerClassName">
           org.jboss.security.plugins.JaasSecurityManager
           </attribute>
           <attribute name="CallbackHandlerClassName">
           x.y.z.MyCallbackHandler
           </attribute>
           </mbean>
          


          The x.y.z.MyCallbackHandler should subclass the default org.jboss.security.auth.callback.SecurityAssociationHandler implementation and delegate the Callbacks not handled by MyCallbackHandler to the SecurityAssociationHandler implementation.


          • 2. Re: UnsupportedCallbackException using TextInputCallback
            Lea Thurman Newbie

            I know this thread is very old but I am trying to implement something very similar, I too need to capture the users organisation.

            However all I did was amend my customer and the ClientLoginModule to supply a TextInputCallback. Both my JAAS login and the filter which uses the Client-login module populate this callback with the organisation.

            Why should I need to amend the jboss-service.xml?

            Regards
            Lea.

            • 3. Re: UnsupportedCallbackException using TextInputCallback
              Scott Stark Master

              You don't need to if you have witten a custom version of the ClientLoginModule.