Either the password is incorrect, which does not appear to be the case, or the
users.properties is not found on the server side.

See the updated (again today) javaworld article available from sourceforge which is here:
http://prdownloads.sourceforge.net/jboss/jaashowto-32x.zip?download


It demonstrates what you are trying to do.


-- xxxxxxxxxxxxxxxxxxxxxxxx Scott Stark Chief Technology Officer JBoss Group, LLC xxxxxxxxxxxxxxxxxxxxxxxx

Christofer Dutz wrote:

Hi,

I am still vaving big problems with loging in to a remote jboss-server from my client. After debuging as far as I could. I could see the correct username and password was transmitted to jboss.
I am using the org.jboss.security.auth.spi.UsersRolesLoginModule on jboss-side (I set <security-domain>java:/jaas/helloworld</security-domain>) and my login-config.xml contains this part:
<application-policy name="helloworld">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
<module-option name="unauthenticatedIdentity">guest</module-option>
</login-module>
</authentication>
</application-policy>


I also created roles.properties:
testUser=everyone,Administrator
guest=everyone

And user.properties:
testUser=testPassword

This is the Client-Side Code I am using:

package de.test.client;

import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.security.auth.login.LoginContext;
import org.jboss.security.auth.callback.UsernamePasswordHandler;
import java.net.MalformedURLException;
import java.net.URL;

import de.test.security.ejb.userManagerSes.UserManagerSesHome;
import de.test.security.ejb.userManagerSes.UserManagerSesRemote;

public class TestClient {
   private static String authConfig = "jaas.conf";

   public static void setAuthConfig(String authConfURL)
       throws MalformedURLException {
       // Set the JAAS login config file if not already set
       ClassLoader loader = Thread.currentThread().getContextClassLoader();
       URL loginConfig = loader.getResource(authConfURL);
       if (loginConfig != null) {
           System.setProperty(
               "java.security.auth.login.config",
               loginConfig.toExternalForm());
       } else {
       }
   }

public static void main(String[] args) {
try {
Context ctx = null;
Properties p = new Properties();
setAuthConfig(authConfig);
System.out.println("Auth-Config set ...");
p.put(Context.PROVIDER_URL, "localhost:1099");
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.security.jndi.LoginInitialContextFactory");


p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
p.put(Context.SECURITY_PROTOCOL, "remoteClientLogin");
p.put(Context.SECURITY_PRINCIPAL, "testUser");
p.put(Context.SECURITY_CREDENTIALS, "testPassword");
ctx = new InitialContext(p);
System.out.println("InitialContext created ...");


UsernamePasswordHandler handler = new UsernamePasswordHandler("testUser", "testPassword".toCharArray());
LoginContext lc = new LoginContext("remoteClientLogin", handler);
lc.login();
System.out.println("Logged in to JBoss server ...");
Object objRef = ctx.lookup("ejb/security/UserManagerSes");
UserManagerSesHome managerHome = (UserManagerSesHome) javax.rmi.PortableRemoteObject.narrow(objRef, UserManagerSesHome.class);
System.out.println("Retrieved UserManagerSesRemote ...");
UserManagerSesRemote manager = managerHome.create();
System.out.println("New user created ...");


           lc.logout();
       } catch (Exception e) {
           e.printStackTrace();
       }
   }
}

Everything goes fine until the create-method is called ... I don't have any more ideas fo what to check.
Yes, I did read the article from JavaWorld, but it is some kind of out of date on some parts.Especialy the ones of how
everything is configured on jboss side.


Here is the Exception I got:

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.ServerException: EJBException:; nested exception is:
javax.ejb.EJBException: checkSecurityAssociation; CausedByException is:
Authentication exception, principal=testUser
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at



------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to