我正在使用spring 3 + struts 2 + hibernate 3,以下是我的配置:
app-security:
<beans:import resource="datasource.xml"/>
<http auto-config='true'>
<intercept-url pattern="/CMS/login*" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<intercept-url pattern="/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<form-login login-page='/CMS/login' default-target-url="/j_spring_security_check"/>
</http>
<authentication-manager alias="authenticationManager">
<authentication-provider user-service-ref="userDetailsService">
<!-- <password-encoder hash="md5"/>-->
</authentication-provider>
</authentication-manager>
</beans:beans>
datasource.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<bean id="userDetailsService"
class="mo.cam.service.impl.UserDetailsServiceImpl">
<property name="dataSource" ref="dataSource"/>
<property name="enableAuthorities" value="true"/>
<property name="usersByUsernameQuery">
<value>SELECT LOGIN, PASSWORD,
1 FROM USER_INFO WHERE LOGIN = ?
</value>
</property>
<property name="groupAuthoritiesByUsernameQuery">
<value>SELECT G.GROUP_ID, G.GROUP_NAME, P.NAME
FROM USER_INFO U
JOIN USER_GROUP UG on U.USER_INFO_ID = UG.USER_INFO_ID
JOIN GROUP G ON UG.GROUP_ID = G.GROUP_ID
JOIN GROUP_PERMISSION GP ON G.GROUP_ID = GP.GROUP_ID
JOIN PERMISSION P ON GP.PERMISSION_ID = P.PERMISSION_ID
WHERE U.LOGIN = ?
</value>
</property>
</bean>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
</property>
<property name="url"
value="***">
</property>
<property name="username" value=""></property>
<property name="password" value=""></property>
</bean>
</beans>
然后设置我的登录页面,但系统只是告诉我: 没有为/ cms / j_acegi_security_check定义任何操作 我试图设置一个断点:mo.cam.service.impl.UserDetailsServiceImpl,但它不会破坏! 为什么?
答案 0 :(得分:0)
您应该将登录的目标网址定义为/ j_spring_security_check(在app:security中定义)而不是/ j_acegi_security_check