Problems with DatabaseServerLoginModule
pranji Aug 8, 2007 8:31 AMHi
I am trying to use the DatabaseServerLoginModule but am facing some problems. I have created a portal instance which has to be accessed after JAAS authentication.
In my .war file for my portal instance i have the following files
web.xml
<servlet>
<servlet-name>PortalServletWithPathMapping</servlet-name>
<servlet-class>org.mex.portlets.login.servlet.LoginServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<security-role-ref>
<role-name>Authenticated</role-name>
<role-link>Authenticated</role-link>
</security-role-ref>
</servlet>
<!-- Provide access to authenticated users -->
<servlet-mapping>
<servlet-name>PortalServletWithPathMapping</servlet-name>
<url-pattern>/authpublic/*</url-pattern>
</servlet-mapping>
<!-- Force the mapping of the jsp and images because of the default servlet replacement -->
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/login.jsp</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/error.jsp</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>jdbc/PortalDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<security-constraint>
<web-resource-collection>
<web-resource-name>Authenticated</web-resource-name>
<description></description>
<url-pattern>/authpublic/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>Authenticated</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>public</realm-name>
<form-login-config>
<form-login-page>/login.jsp</form-login-page>
<form-error-page>/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<role-name>Authenticated</role-name>
</security-role>
my jboss-web.xml
<jboss-web>
<security-domain>java:jaas/publicportal</security-domain>
<context-root>/public</context-root>
<resource-ref>
<res-ref-name>jdbc/PortalDS</res-ref-name>
<jndi-name>java:PortalDS</jndi-name>
</resource-ref>
</jboss-web>
in the login-config inside portal.sar i have added this
<application-policy name = "publicportal">
<authentication>
<login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag = "required">
<module-option name = "unauthenticatedIdentity">guest</module-option>
<module-option name = "dsJndiName">java:/PortalDS</module-option>
<module-option name = "principalsQuery">SELECT PASSWD FROM JMS_USERS WHERE USERID=?</module-option>
<module-option name = "rolesQuery">SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?</module-option>
</login-module>
</authentication>
</application-policy>
I have even enabled logging as per the secutiry FAQ but when i log in i see null on the error.jsp page with no logging messages
Basically
request.getAttribute("org.jboss.portal.loginError")returns null and i am not able to login
Can anyone please help