3 Replies Latest reply on Sep 19, 2005 10:00 AM by Paolo Spadafora

    Remote Swing client not working

    Paolo Spadafora Newbie

      I did successifully run the "JAAS how to" examples, I also changed the login-config.xml to authenticate and authorizate users against my application datasource.
      The problem i have is when i run the same code from a remote Swing application, following is the code i use:


      <application-policy name="myapp">
       <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
       <module-option name="dsJndiName">java:/sqlserver</module-option>
       <module-option name="principalsQuery">select Password from USERS where USERNAME=?</module-option>
       <module-option name="rolesQuery">select Role, RoleGroup from USER_ROLES where USERNAME=?</module-option>

      Swing code:
      env.put(Context.INITIAL_CONTEXT_FACTORY, resources.getProperty("context.factory","") );
      env.put(Context.PROVIDER_URL, resources.getProperty("provider.url","") );
      env.put(Context.SECURITY_PRINCIPAL, username );
      env.put(Context.SECURITY_CREDENTIALS, password );
      initial = new InitialContext(env);
      Object objref = initial.lookup(USER_SETTING);
      authSuccess = true;


      when I run my application without JAAS it works fine, as i need to gain or deny access to specific business methods I have to plug JAAS, when i do it I get on the server side principal=null...

      why does that happens?
      I tested on other App Server and it works.
      Please help.

      thank you.