I'm using embedded Glassfish (org.glassfish.main.extras:glassfish-embedded-all:3.1.2.2) and tried to add a JDBC realm. The application deploys fine but when trying to login (Basic auth. shows the right realm name) the following error message occurs:
com.sun.web.security.RealmAdapter authenticate WARNING: WEB9102: Web Login Failed: com.sun.enterprise.security.auth.login.common.LoginException: Login failed: No LoginModules configured for jdbcRealm
My code looks like this:
embedded Glassfish
// create-jdbc-connection-pool ...
// create-jdbc-resource ...
String realmProperties = "jaas-context=jdbcRealm:datasource-jndi=jdbc/myDB:user-table=Users:user-name-column=userid:password-column=password:group-table=Groups:group-name-column=groupid;
glassfish.getCommandRunner().run("create-auth-realm", "--classname", "com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm", "--property", realmProperties, myRealm);
web.xml of deployed application
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>myRealm</realm-name>
</login-config>
I thought if nothing is specified default LoginModule (which in case of a non embedded Glassfish is specified in domain/conf/login.conf) applies?