users@glassfish.java.net

AppClient with JAAS

From: Major Péter <majorpetya_at_sch.bme.hu>
Date: Thu, 02 Sep 2010 01:52:56 +0200

Hi,

I have a basic enterprise which is protected by an OpenSSO instance.
(this only means, that there is an "agentRealm" configured in GlassFish,
and there is an extended PasswordLoginModule, which authenticates users
against OpenSSO and retrieves group memberships, etc.)
The thing is, that I would like to create an application client for this
enterprise app, which would authenticate into GlassFish (and
"agentRealm"). How am I supposed to do this?

Currently I tried with ProgrammaticLogin:
ProgrammaticLogin pLogin = new ProgrammaticLogin();
        try {
            if ((userName != null) && (password != null)) {
                return pLogin.login(userName, password, "agentRealm", true);
            }
        } catch (Exception ex) {ex.printStackTrace();}

but based on the javadoc this will always return true, since I haven't
called anything so far.
After executing this login, I was trying to lookup a simple remote EJB
with global JNDI name, but I've got:
Caused by: java.lang.ClassCastException: Object is not of remote type
com.sun.enterprise.naming.impl.SerialContextProvider
        at
com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:250)

and now I have no idea, where to go any further...
Do I need to set something in application-client.xml or
sun-application-client.xml to get this thing working? Do I need to
override the original login.conf file? How?

Thanks in advance

Regards,
Peter