Your simple client should have code that looks up the
JNDI context using the LoginInitialContextFactory.

Something like this:

  public Context login(String user, String password) {
    try {
      Context ctx = null;
      Properties p = new Properties();
      p.put(Context.PROVIDER_URL, "yourhost: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, "login");
      p.put(Context.SECURITY_PRINCIPAL, user);
      p.put(Context.SECURITY_CREDENTIALS, password);
      ctx = new InitialContext(p);
      return ctx;
}

When you run your cliemt, set the following system
property:

java.security.auth.login.config=<A URL THAT POINTS TO
auth.conf>

eg.

http://MYHOST:8080/security-conf/auth.conf

The auth.conf file looks like this:

login {
        org.jboss.security.ClientLoginModule required;
};
other {
        org.jboss.security.ClientLoginModule required;
};


So the line
      p.put(Context.SECURITY_PROTOCOL, "login");

refers to the entry in the auth.conf file.

Hopefully, that will sort you out.

//Nicholas


--- Christofer Dutz <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> at the moment I am learning for an exam on tuesday
> and am realy sort of
> frustrated.
> I finaly managed to understand using  XDoclet and
> simply wanted to try
> to access my Beans from a simple Client.
> Now something has to have changed since earlier
> JBoss versions (I am
> using 3.2.2RC2)
> 
> How can I authenticate a simple client application
> in a seperate VM so I
> can acces my EJBs.
> I have tried googeling for a solution, but that only
> made things worse.
> It seems impossible to find up-to-date information.
> All hints turned out
> to be wrong.
> 
> Could someone please send me a link on how to write
> a client to
> correctly authenticate with the JAAS-Service of
> JBoss ?
> 
> Thanx in advance,
>     Chris
> 
> 
> 
> 
> 
>
-------------------------------------------------------
> 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


=====
Nicholas Whitehead
Home: (973) 377 9335
Cell: (201) 615 2716
[EMAIL PROTECTED]
Get Your News From The Crowbar: http://crowbar.dnsalias.com:443/crowbar/


-------------------------------------------------------
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