My login doesn't work, I don't know why. When I type login and password redirect to fail.jsp page, no exception happen.
I think the problem can be below. I changed the select for a wrong name like jjjj=? and nothing happened
<bean id="authenticationDao" class="org.springframework.security.userdetails.jd bc.JdbcDaoImpl">
<property name="dataSource" ref="dataSource" />
<property name="usersByUsernameQuery">
<value>
SELECT user, password FROM users WHERE jjjj=? (jjjj doesn't exist in database)
</value>
</property>
</bean>
I'm using spring 2.5.6 and springseccurity 2.0.4. Can anyone help me?
----------------------------------------------------------------
web.xml
<!-- spring configuration -->
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListe ner</listener-class>
</listener>
<
servlet>
<servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>authenticationProcessingFilter</filter-name>
<filter-class>org.springframework.security.ui.webapp.Authe nticationProcessingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>authenticationProcessingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
---------------------------------------------------------------------------------------------------------------------------------------
applicationContext.xml
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverM anagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost/apress" />
<property name="username" value="root" />
<property name="password" value="root" />
</bean>
---------------------------------------------------------------------------------------------------------------------------------------
springSecurityContext.xml
<security:http>
<security:intercept-url pattern="/secure.jsp" access="ROLE_ADMIN" />
<security:form-login login-page="/index.jsp" authentication-failure-url="/fail.jsp" />
<security:logout logout-success-url="/logout.jsp" />
</security:http>
<security:authentication-provider>
<security:jdbc-user-service data-source-ref="dataSource" />
</security:authentication-provider>
<bean id="authenticationDao" class="org.springframework.security.userdetails.jd bc.JdbcDaoImpl">
<property name="dataSource" ref="dataSource" />
<property name="usersByUsernameQuery">
<value>
SELECT user, password FROM users WHERE
user=? <!--
I changed for a wrong name like jjjj=? and nothing happened -->
</value>
</property>
</bean>
<bean id="authenticationProvider" class="org.springframework.security.providers.dao. DaoAuthenticationProvider">
<property name="userDetailsService" ref="authenticationDao" />
</bean>
<bean id="authenticationManager" class="org.springframework.security.providers.Prov iderManager">
<property name="providers">
<list>
<ref bean="authenticationProvider" />
</list>
</property>
</bean>
<bean id="authenticationEntryPoint" class="org.springframework.security.ui.webapp.Auth enticationProcessingFilterEntryPoint">
<property name="loginFormUrl" value="/index.jsp" />
</bean>
<bean id="authenticationProcessingFilter" class="org.springframework.security.ui.webapp.Auth enticationProcessingFilter">
<property name="filterProcessesUrl" value="/j_spring_security_check" />
<property name="authenticationFailureUrl" value="/fail.jsp" />
<property name="defaultTargetUrl" value="/secure.jsp" />
<property name="authenticationManager" ref="authenticationManager" />
</bean>