[jboss-user] [Security & JAAS/JBoss] - Re: Error 403 when using DatabaseServerLoginModule

jaikiran do-not-reply at jboss.com
Sun Nov 5 07:38:15 EST 2006


I tried your example and it did not work even in my case. Did some changes and it started working. Here's what i did:

1) Change the schema of the tables:

User table:
  | 
  | CREATE TABLE `users` (
  |   `userid` varchar(255) NOT NULL default '',
  |   `Password` varchar(255) NOT NULL default '',
  |   PRIMARY KEY  (`userid`)
  | ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  | 
  | Roles table:
  | 
  | CREATE TABLE `roles` (
  |   `roleid` varchar(255) NOT NULL default '',
  |   `userid` varchar(255) NOT NULL default '',
  |   
  |   PRIMARY KEY  (`roleid`)
  | ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  | 
  | Data in the tables:
  | 
  | insert into users values ('user','user');
  | insert into users values ('Admin','admin');
  | 
  | insert into roles values('Admin','Admin');
  | insert into roles values('user','User');
  | 

2) Change the contents in the login-config.xml to:

<application-policy name = "jaastest">
  |            <authentication>
  |               <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
  |                  flag = "required">
  |                  <module-option name = "dsJndiName">java:/jaastestDatasource</module-option>
  |                  <module-option name = "principalsQuery">select Password from users where userid=?</module-option>
  |              <module-option name = "rolesQuery">select roleid, 'Roles' from Roles where userid=?</module-option>
  |               </login-module>
  |            </authentication>
  |     </application-policy>
  | 

Thats it. No changes to any other files. This worked for me.

Let us know, if you still have any issues.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983291#3983291

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983291



More information about the jboss-user mailing list