users@glassfish.java.net

JDBCRealm from Swing GUI

From: <glassfish_at_javadesktop.org>
Date: Wed, 21 Apr 2010 05:48:07 PDT

Hi All,

I would like to ask you please help me resolve the "No LoginModules configured" problem.
I have an GFv3 configured with jdbcRealm and deployed stateless EJB and I would like to login from ACC (Swing GUI).

Where I find a non web client example and/or document?

Thanks a lot, Attila.

SERVER SIDE CONFIG
-------------------
<sun-ejb-jar>
  <security-role-mapping>
    <role-name>developing</role-name>
    <group-name>developers</group-name>
  </security-role-mapping>
  <enterprise-beans>
      <ejb>
          <ejb-name>UserAuthenticationBean</ejb-name>
          <ior-security-config>
              <as-context>
                   <auth-method>username_password</auth-method>
                   <realm>jdbcRealm</realm>
                   <required>true</required>
              </as-context>
          </ior-security-config>
      </ejb>
  </enterprise-beans>
</sun-ejb-jar>


CLIENT CONFIG
-------------
jdbcRealm {
        com.sun.enterprise.security.auth.login.JDBCLoginModule debug=true;
};

CLIENT LOG:
------------
14:20:12,345 DEBUG CTMedikaClientFacade:423 - START: jdbcRealm
14:20:12,346 ERROR CTMedikaClientFacade:432 - javax.security.auth.login.LoginException: No LoginModules configured for jdbcRealm

CLIENT CODE SNIPET:
--------------------
public class CTMedikaClientFacade implements ClientFacade {
// -------
// -------
// -------
    public boolean authenticateUser(Map loginInfo) throws Exception {
        String username = null;
        String password = null;
            LoginContext lc = null;
            CTMedikaClientPassiveCallbackHandler ph = null;
            UserAuthenticationRemote aa = null;
            
        username = (String) loginInfo.get("username");
        try {
            password = CryptUtils.getInstance().decodeText((byte[]) loginInfo.get("password"));
        } catch (Throwable e) {
            log.error(e);
            password = new String("unknown");
        }
        // -------
        // -------
        // -------
        try {
            log.debug("START: jdbcRealm");
            ph = new CTMedikaClientPassiveCallbackHandler(username, password);
            lc = new LoginContext("jdbcRealm",ph);
            lc.login();
            aa = (UserAuthenticationRemote)getRemote(UserAuthenticationRemote.class.getName());
            aa.getUserByPassword(password);
            lc.logout();
            log.debug("STOP: jdbcRealm");
        } catch (Exception e) {
            log.error(e);
        }
        // -------
        // -------
        // -------
[Message sent by forum member 'aszomor']

http://forums.java.net/jive/thread.jspa?messageID=398210