You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Jonathan Chen <jo...@chen.org.nz> on 2008/01/10 02:41:57 UTC

JAAS and OpenejbRemoteLoginModule

Hi,

I'm trying to use JAAS on a remote client to Geronimo 2.0.2 and
read a suggestion in the mail archives to use OpenejbRemoteLoginModule.
However, I have difficulty finding any documentation on how to use
this LoginModule. My JAAS configuration file has:

    MyApp {   
        org.apache.geronimo.openejb.OpenejbRemoteLoginModule required;
    };

but this is obviously not enough, as it fails with a NullPointerException.
A quick look into the source reveals that I need to define options
for the following keys:

  org.apache.geronimo.openejb.OpenejbRemoteLoginModule.RemoteSecurityRealm
  org.apache.geronimo.openejb.OpenejbRemoteLoginModule.ServerURI

I'm guessing that the first key-value should be the security realm as
defined on the Geronimo-Server, but I have no idea what the second key
should look like.

Any examples on the resultant JAAS configuration file would be
appreciated.

Cheers.
-- 
Jonathan Chen <jo...@chen.org.nz>
----------------------------------------------------------------------
The human mind ordinarily operates at only ten percent of its capacity
                     -- the rest is overhead for the operating system.

Re: JAAS and OpenejbRemoteLoginModule

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Jan 10, 2008 10:04 AM, Jonathan Chen <jo...@chen.org.nz> wrote:

> I ran my EjbClient with:
>
>         java -Djava.security.auth.login.config=MyApp.jaas -jar MyApp.jar
>
> with MyApp.jaas in the same directory containing:
>
>         MyApp
>         {
>                 org.apache.geronimo.openejb.OpenejbRemoteLoginModule required
>                         org.apache.geronimo.openejb.OpenejbRemoteLoginModule.RemoteSecurityRealm="MyAppRealm"
>                         org.apache.geronimo.openejb.OpenejbRemoteLoginModule.ServerURI="ejbd://localhost:4201";
>
>         };
>
> The big trick was finding OpenejbRemoteLoginModule in
> geronimo-openejb-2.0.2.jar and pulling the required dependancies.
>
> My EjbClient snippet is pretty simple:
>
>     LoginContext
>         loginCtx = new LoginContext (
>                     "MyApp",
>                     new ClientCallbackHandler ("joeuser", "joespassword"));
>     loginCtx.login ();
>
> with the ClientCallBackHandler class based on:
>
>     http://java.sun.com/javase/6/docs/technotes/guides/security/jaas/tutorials/SampleAcn.java

That's exactly that sort of answer I appreciate the most. Very concise
and clear. Thanks.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: JAAS and OpenejbRemoteLoginModule

Posted by Jonathan Chen <jo...@chen.org.nz>.
On Thu, Jan 10, 2008 at 09:10:49AM +0100, Jacek Laskowski wrote:
> On Jan 10, 2008 9:05 AM, Jonathan Chen <jo...@chen.org.nz> wrote:
> 
> > Here's one for the archives: After several iterations of trial and error,
> > it looks like the following configuration will work:
> 
> Hi Jonathan,
> 
> Can you tell me how you execute your remote app client and where you
> place the jaas configuration? If you could show the jaas-aware code
> snippet where the jaas configuration's used, it'd be superb.

I ran my EjbClient with:

	java -Djava.security.auth.login.config=MyApp.jaas -jar MyApp.jar

with MyApp.jaas in the same directory containing:

	MyApp
	{
		org.apache.geronimo.openejb.OpenejbRemoteLoginModule required
			org.apache.geronimo.openejb.OpenejbRemoteLoginModule.RemoteSecurityRealm="MyAppRealm"
			org.apache.geronimo.openejb.OpenejbRemoteLoginModule.ServerURI="ejbd://localhost:4201";

	};

The big trick was finding OpenejbRemoteLoginModule in
geronimo-openejb-2.0.2.jar and pulling the required dependancies.

My EjbClient snippet is pretty simple:

    LoginContext
        loginCtx = new LoginContext (
                    "MyApp",
                    new ClientCallbackHandler ("joeuser", "joespassword"));
    loginCtx.login ();

with the ClientCallBackHandler class based on:

    http://java.sun.com/javase/6/docs/technotes/guides/security/jaas/tutorials/SampleAcn.java

Cheers.
-- 
Jonathan Chen <jo...@chen.org.nz>
----------------------------------------------------------------------
                                Don't worry about avoiding temptation,
                            as you grow older, it starts avoiding you.

Re: JAAS and OpenejbRemoteLoginModule

Posted by Jacek Laskowski <ja...@laskowski.net.pl>.
On Jan 10, 2008 9:05 AM, Jonathan Chen <jo...@chen.org.nz> wrote:

> Here's one for the archives: After several iterations of trial and error,
> it looks like the following configuration will work:

Hi Jonathan,

Can you tell me how you execute your remote app client and where you
place the jaas configuration? If you could show the jaas-aware code
snippet where the jaas configuration's used, it'd be superb.

Jacek

-- 
Jacek Laskowski
http://www.JacekLaskowski.pl

Re: JAAS and OpenejbRemoteLoginModule

Posted by Jonathan Chen <jo...@chen.org.nz>.
On Thu, Jan 10, 2008 at 02:41:57PM +1300, Jonathan Chen wrote:

[...]
> Any examples on the resultant JAAS configuration file would be
> appreciated.

Here's one for the archives: After several iterations of trial and error,
it looks like the following configuration will work:

    MyApp
    {
        org.apache.geronimo.openejb.OpenejbRemoteLoginModule required
            org.apache.geronimo.openejb.OpenejbRemoteLoginModule.RemoteSecurityRealm="MyAppRealm"
            org.apache.geronimo.openejb.OpenejbRemoteLoginModule.ServerURI="ejbd://localhost:4201";
    };

My only complaint is that the option-flag names are a bit of an
overkill. It'd be nice if it was just "RemoteSecurityRealm" and
"ServerURI".

Cheers.
-- 
Jonathan Chen <jo...@chen.org.nz>
----------------------------------------------------------------------
"A little learning is a dangerous thing but a lot of ignorance is
 just as bad."                                      - Bob Edwards