Getting DatabaseServerLoginModule to work, please help.
infectedrhythms Dec 14, 2004 10:10 PMHi am trying to configure bassic auth on my app... i get the browser window but i can't seem to login....
login-config.xml
<application-policy name = "mamoth"> <authentication> <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required"> <module-option name = "unauthenticatedIdentity">guest</module-option> <module-option name = "dsJndiName">java:/MamothtDS</module-option> <module-option name = "principalsQuery">select Password from Principals where PrincipalID=?</module-option> <module-option name = "rolesQuery">select Role, RoleGroup from Roles where PrincipalID=?</module-option> </login-module> </authentication> </application-policy>
web.xml
<web-app> <display-name>Mamoth Blue</display-name> <description>Mamoth Blue web site</description> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <resource-ref> <description>DB Connection</description> <res-ref-name>jdbc/MamothDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> <security-constraint> <web-resource-collection> <web-resource-name>HtmlAdaptor</web-resource-name> <description>Mamoth Blue security.</description> <url-pattern>/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>Artist</role-name> </auth-constraint> </security-constraint> <login-config> <auth-method>BASIC</auth-method> <realm-name>Mamoth Blue</realm-name> </login-config> <security-role> <role-name>Artist</role-name> </security-role> </web-app>
jboss-web.xml
<jboss-web> <context-root>/mamoth</context-root> <resource-ref> <res-ref-name>jdbc/MamothDB</res-ref-name> <jndi-name>java:/jdbc/MamothDB</jndi-name> </resource-ref> <security-domain>java:/jaas/mamoth</security-domain> </jboss-web>
DB tables
CREATE TABLE `principals` ( `PrincipalID` varchar(50) NOT NULL default '', `Password` varchar(50) NOT NULL default '', `Active` tinyint(1) NOT NULL default '0' ) TYPE=MyISAM; # Host: localhost # Database: mamoth # Table: 'roles' # CREATE TABLE `roles` ( `PrincipalID` varchar(50) NOT NULL default '', `Role` varchar(50) NOT NULL default '', `RoleGroup` varchar(50) default '', PRIMARY KEY (`PrincipalID`) ) TYPE=MyISAM;
Thanks