FirebirdSQL and JAAS

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FirebirdSQL and JAAS

Anthony Cook
Hello All,

I'm having trouble with trying to use FirebirdSQL for JAAS login realms.
  Anyone with experience getting this work please read on, if necessary,
and reply...

With everything [apparently] configured correctly, I'm getting the
following exception:

24182 [SocketListener0-9] WARN  org.mortbay.jaas.JAASUserRealm  -
javax.security.auth.login.LoginException: Login Failure: all modules ignored

Followed immediately by AUTH FAILURE.  Following is my login.conf:

// login config for the TrackerDemo web-app
//
tracker {
org.mortbay.jaas.spi.JDBCLoginModule required
debug="true"
dbUrl="jdbc:firebirdsql:localhost:traxdb.fdb"
dbUserName="myusername"
dbPassword="mypasswd"
dbDriver="org.firebirdsql.jdbc.FBDriver"
userTable="accounts_tbl"
userField="userid"
credentialField="userpw"
userRoleTable="user_roles_tbl"
userRoleUserField="userid"
userRoleRoleField="roleid";
};

tracker2 {
org.mortbay.jaas.spi.JDBCLoginModule required
debug="true"
dbUrl="jdbc:mysql://data/test"
dbUserName="myusername"
dbPassword="mypasswd"
dbDriver="com.mysql.jdbc.Driver"
userTable="accounts_tbl"
userField="userid"
credentialField="userpw"
userRoleTable="roles_tbl"
userRoleUserField="userid"
userRoleRoleField="roleid";
};
// End

-- and my web-app's Realm config...
...
     <Set name="Realm">
         <New class="org.mortbay.jaas.JAASUserRealm">
             <Set name="Name">TrackerDemo Login Realm</Set>
             <Set name="LoginModuleName">tracker</Set>
             <Set name="CallbackHandlerClass">
                 org.mortbay.jaas.callback.DefaultCallbackHandler
             </Set>
         </New>
     </Set>
...

Note that if I change the Realm config to point to 'tracker2' (MySQL),
the login succeeds (tables and accounts are identical between the two
DBMSes).

I know it's not a problem with driver loading or [apparently]
establishing the connection, since I modified JDBCLoginModule to dump
the initialization parameters and "tag" all exceptions with stack
traces.  Following is the dump from initialize():

JDBCLoginModule: dbDriver = org.firebirdsql.jdbc.FBDriver
JDBCLoginModule: dbUrl = jdbc:firebirdsql:localhost:traxdb.fdb
JDBCLoginModule: dbUserName = pendraco
JDBCLoginModule: dbPassword = 2nibiru
JDBCLoginModule: dbUserTable = accounts_tbl
JDBCLoginModule: dbUserTableUserField = userid
JDBCLoginModule: dbUserTableCredentialField = userpw
JDBCLoginModule: userQuery = select userpw from accounts_tbl where userid=?
JDBCLoginModule: dbUserRoleTable = user_roles_tbl
JDBCLoginModule: dbUserRoleTableUserField = userid
JDBCLoginModule: dbUserRoleTableRoleField = roleid
JDBCLoginModule: rolesQuery = select roleid from user_roles_tbl where
userid=?

No SQLExceptions are being caught by the login() method from loadUser().
  Nor do I see how it could be in FirebirdSQL since I also use the same
property values as in login.conf for other JDBC style connections:

pendraco@anu:sql$ more jdbcdriver.properties
# Sample ResourceBundle properties file
#
table.name=accounts_tbl

# JDBC driver oriented properties
#
db.driver=org.firebirdsql.jdbc.FBDriver
db.url=jdbc:firebirdsql:localhost:traxdb.fdb
db.user=myusername
db.pass=mypasswd
## End

Additionally, the same FB database is configured into Jetty's
DataSourceService:

...
         <Call name="addDataSource">
             <Arg>jdbc/TraxDB</Arg>
             <Arg>
               <New class="org.firebirdsql.pool.FBWrappingDataSource">
                 <Set name="database">localhost:traxdb.fdb</Set>
                 <Set name="UserName">myusername</Set>
                 <Set name="Password">mypasswd</Set>
                 <Set name="minPoolSize" type="int">1</Set>
                 <Set name="maxPoolSize" type="int">5</Set>
                 <Set name="pooling" type="boolean">true</Set>
               </New>
             </Arg>
         </Call>
...

While I'm using FirebirdSQL's own ConnectionPoolDataSource
implementation (XA not needed in this case), this should not matter
since, of course, it is a wrapper around FBDriver.  My web-app is
successfully able to access and use this datasource when JAAS is
pointing to 'tracker2' (MySQL) for login!  So, I doubt it's a
communication error with FirebirdSQL.

I am at my wit's end on this one, so if anyone can help with this --
preferably, someone who's already had to tackle this issue -- it will be
greatly appreciated.

Regards,

Tony Cook

vschade.vcf (226 bytes) Download Attachment