users@glassfish.java.net

Re: Custom Security Realms

From: Harsha R A <Harsha.Ra_at_Sun.COM>
Date: Mon, 06 Aug 2007 15:22:17 +0530

Hi,
I tried your sample. You are right. The message is very generic. When I
debugged, I found out that it is coming from the following method


public class JDBCLoginModule extends PasswordLoginModule {
    /**
     * Perform JDBC authentication. Delegates to JDBCRealm.
     *
     * @throws LoginException If login fails (JAAS login() behavior).
     */
    protected void authenticate() throws LoginException {
        if (!(_currentRealm instanceof JDBCRealm)) {
            String msg = sm.getString("jdbclm.badrealm");
            throw new LoginException(msg);
        }
....
}

The message is actually "JDBCLoginModule requires JDBCRealm", but
somehow it is lost when it is thrown . I am investigating the reason for
the loss of the message.

In Summary, you need to have your own login module , you cannot use the
JDBCLoginModule of glassfish for your realm. You need to specify that
login module in login.conf and specify the name of that module as the
jaas-context property.

HTH,

Harsha

glassfish_at_javadesktop.org wrote, On Saturday 04 August 2007 01:47 AM:
> I'm trying to write my own security realm, however I get a very generic
>
> WARNING: Web login failed: Login failed: javax.security.auth.login.LoginException: Security Exception
>
> Thats all. Anyone have suggestions.
>
>
> [Message sent by forum member 'amattas' (amattas)]
>
> http://forums.java.net/jive/thread.jspa?messageID=229431
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>