I'm trying to use JdbcDaoImpl to check the users when they log in. However, because of the database schema I am using, I have to modify the DEF_USERS_BY_USERNAME_QUERY. I'm configuring it in the springapp.xml file, but whenever I test the page, I cannot log in with the correct credentials. I simply receive my default error message that the password or username are not correct. My web.xml is :
and my spring config file is :HTML Code:<web-app> - <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> <param-value>/WEB-INF/springapp-servlet.xml</param-value> </context-param> - <filter> <filter-name>Acegi Authentication Processing Filter</filter-name> <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class> - <init-param> <param-name>targetClass</param-name> - <param-value> org.acegisecurity.ui.webapp.AuthenticationProcessingFilter </param-value> </init-param> </filter> - <filter-mapping> <filter-name>Acegi Authentication Processing Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> - <filter> <filter-name>Acegi HTTP Request Security Filter</filter-name> <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class> - <init-param> <param-name>targetClass</param-name> - <param-value> org.acegisecurity.intercept.web.SecurityEnforcementFilter </param-value> </init-param> </filter> - <filter-mapping> <filter-name>Acegi HTTP Request Security Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> - <listener> <description>Listener for Acegi</description> - <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> - <listener> - <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> - <servlet> <servlet-name>springapp</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> - <servlet-mapping> <servlet-name>springapp</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> - <taglib> <taglib-uri>/spring</taglib-uri> <taglib-location> spring.tld</taglib-location> </taglib> - <session-config> <session-timeout> 30 </session-timeout> </session-config> - <welcome-file-list> <welcome-file> lookupBook.htm </welcome-file> </welcome-file-list> </web-app
Are there any problems in my configuration or do I have an error elsewhere? Any help would be greatly appreciated.HTML Code:<beans> - <!-- ************************** Acegi Security ************************** --> - <bean id="securityEnforcementFilter" class="org.acegisecurity.intercept.web.SecurityEnforcementFilter"> - <property name="filterSecurityInterceptor"> <ref bean="filterInvocationInterceptor"/> </property> - <property name="authenticationEntryPoint"> <ref bean="authenticationEntryPoint"/> </property> </bean> - <bean id="authenticationEntryPoint" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint"> - <property name="loginFormUrl"> <value>/acegilogin.jsp</value> </property> - <property name="forceHttps"> <value>false</value> </property> </bean> - <bean id="filterInvocationInterceptor" class="org.acegisecurity.intercept.web.FilterSecurityInterceptor"> - <property name="authenticationManager"> <ref bean="authenticationManager"/> </property> - <property name="accessDecisionManager"> <ref bean="accessDecisionManager"/> </property> - <property name="runAsManager"> <ref bean="runAsManager"/> </property> - <property name="objectDefinitionSource"> - <value> CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON \A/log.htm\Z=ROLE_USER \A/lookupbookloggedin.htm\Z=ROLE_USER \A/userlandingpage.htm\Z=ROLE_USER \A/modifylist.htm\Z=ROLE_USER \A/deletelist.htm\Z=ROLE_USER </value> </property> </bean> - <bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager"> - <property name="providers"> - <list> <ref bean="daoAuthenticationProvider"/> </list> </property> </bean> - <bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider"> - <property name="userDetailsService"> <ref bean="jdbcDaoImpl"/> </property> - <property name="userCache"> <ref bean="userCache"/> </property> </bean> - <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> - <property name="configLocation"> <value>classpath:/ehcache-failsafe.xml</value> </property> </bean> <bean id="userCacheBackend" class="org.springframework.cache.ehcache.EhCacheFactoryBean"> <property name="cacheManager"> <ref local="cacheManager"/> </property> <property name="cacheName"> <value>userCache</value> </property> </bean> <bean id="userCache" class="org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache"> <property name="cache"> <ref local="userCacheBackend"/> </property> </bean> <bean id="jdbcDaoImpl" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl"> <property name="dataSource"> <ref bean="myDataSource"/> </property> <property name="usersByUsernameQuery"> <value> SELECT email,password FROM usertable WHERE email = ? </value> </property> </bean> <bean id="runAsManager" class="org.acegisecurity.runas.RunAsManagerImpl"> <property name="key"> <value>34T_s0m3_c4NDy</value> </property> </bean> <bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter"/> <bean id="userVoter" class="Voters.UserVoter"> <property name="userDAO"> <ref bean="userDAO"/> </property> </bean> <bean id="accessDecisionManager" class="Voters.MultiBased"> <property name="allowIfAllUnanimousAbstain"> <value>true</value> </property> <property name="allowIfAllConsensusAbstain"> <value>true</value> </property> <property name="allowIfAllAffirmativeAbstain"> <value>false</value> </property> <property name="affirmativeDecisionVoters"> <list> <ref bean="roleVoter"/> </list> </property> </bean> <bean id="authenticationProcessingFilter" class="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter"> <property name="authenticationManager"> <ref bean="authenticationManager"/> </property> <property name="authenticationFailureUrl"> <value>/acegilogin.jsp?login_error=1</value> </property> <property name="defaultTargetUrl"> <value>/</value> </property> <property name="filterProcessesUrl"> <value>/j_acegi_security_check</value> </property> </bean> <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="/lookupBook.htm">bookLookupController</prop> <prop key="/ajaxBib.htm">myController</prop> <prop key="/log.htm">userController</prop> <prop key="/lookupBookLoggedIn.htm">userListController</prop> </props> </property> </bean> <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName"> <value>org.postgresql.Driver</value> </property> <property name="url"> <value>jdbc:postgresql://localhost/travis</value> </property> <property name="username"> <value>travis</value> </property> <property name="password"> <value>servlets2</value> </property> <property name="maxActive"> <value>5</value> </property> <property name="maxIdle"> <value>2</value> </property> </bean> <bean id="mySessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="myDataSource"/> </property> <property name="mappingResources"> <list> <value>Bibliography.hbm.xml</value> <value>BookList.hbm.xml</value> <value>ListOfBooks.hbm.xml</value> <value>MissedBooks.hbm.xml</value> <value>User.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.PostgreSQLDialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> <bean id="bibDAO" class="DAOs.BibliographyDAOImpl"> <property name="sessionFactory"> <ref bean="mySessionFactory"/> </property> </bean> <bean id="userDAO" class="DAOs.UserDAOImpl"> <property name="sessionFactory"> <ref bean="mySessionFactory"/> </property> </bean> </beans>
Thanks,
Travis


