我自定义了一个AuthenticationProcessingFilter,但配置后发现网站没反应,根本出现不了登陆页面,TOMCAT下也没见错误自各位高人帮我看看吧
web.xml
[code]
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param><filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter><filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list><listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>[/code]application.xml
[code]
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> <http auto-config="false" entry-point-ref="authenticationProcessingFilterEntryPoint">
<intercept-url pattern="/admin.jsp" access="ROLE_ADMIN" />
<intercept-url pattern="/**" access="ROLE_USER" />
</http> <authentication-provider>
<password-encoder hash="md5"/>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select userid,password,workstatus as enabled from wbxUser where userid=?"
authorities-by-username-query="select a.userid,b.groupname as authority from wbxuser a,usergroup b where a.groupid=b.groupid and userid=?"/>
</authentication-provider>
<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<beans:property name="url" value="jdbc:microsoft:sqlserver://10.224.104.38:1433;databasename=forumlocal"/>
<beans:property name="username" value="sa"/>
<beans:property name="password" value="pass"/>
</beans:bean>
//<font color=red>这是我自定义的一个bean</font>
<beans:bean id="authenticationProcessingFilter" class="mycompany.login.MyAuthenticationProcessingFilter">
<custom-filter position="AUTHENTICATION_PROCESSING_FILTER"/>
<beans:property name="defaultTargetUrl" value="/index.jsp"/>
<beans:property name="authenticationManager" ref="authenticationManager"/> //<font color=red>不太懂这,但还是配了</font>
</beans:bean>
<beans:bean id="authenticationProcessingFilterEntryPoint" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<beans:property name="loginFormUrl" value="/login.jsp"/>
<beans:property name="forceHttps" value="false"/>
</beans:bean>
<authentication-manager alias="authenticationManager"/>
</beans:beans>
[/code]
web.xml
[code]
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param><filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter><filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list><listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>[/code]application.xml
[code]
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> <http auto-config="false" entry-point-ref="authenticationProcessingFilterEntryPoint">
<intercept-url pattern="/admin.jsp" access="ROLE_ADMIN" />
<intercept-url pattern="/**" access="ROLE_USER" />
</http> <authentication-provider>
<password-encoder hash="md5"/>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select userid,password,workstatus as enabled from wbxUser where userid=?"
authorities-by-username-query="select a.userid,b.groupname as authority from wbxuser a,usergroup b where a.groupid=b.groupid and userid=?"/>
</authentication-provider>
<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<beans:property name="url" value="jdbc:microsoft:sqlserver://10.224.104.38:1433;databasename=forumlocal"/>
<beans:property name="username" value="sa"/>
<beans:property name="password" value="pass"/>
</beans:bean>
//<font color=red>这是我自定义的一个bean</font>
<beans:bean id="authenticationProcessingFilter" class="mycompany.login.MyAuthenticationProcessingFilter">
<custom-filter position="AUTHENTICATION_PROCESSING_FILTER"/>
<beans:property name="defaultTargetUrl" value="/index.jsp"/>
<beans:property name="authenticationManager" ref="authenticationManager"/> //<font color=red>不太懂这,但还是配了</font>
</beans:bean>
<beans:bean id="authenticationProcessingFilterEntryPoint" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<beans:property name="loginFormUrl" value="/login.jsp"/>
<beans:property name="forceHttps" value="false"/>
</beans:bean>
<authentication-manager alias="authenticationManager"/>
</beans:beans>
[/code]
解决方案 »
- 文件上传问题,请高手帮忙看看
- WebLogic 10 部署应用之后 报HTTP 503 无法访问
- 我不知道这种方式是不是跨站点漏洞,还有如何防范
- websphere 部署EJB应用 客户端lookup错误问题 急!!!
- tomcat6.0+mysql5.0+jsp奇怪问题求解!
- JSF 得到了 UIViewRoot,怎么得到指定ID的component呢?
- Hibernate神仙请进:不同数据库的表间可否关联?
- oracle DB中,如何设置链接url才能从oracleresultsetMetadata中取得table name?
- web service
- 请问:java里有没有象.NET中DataGrid显示的组件?
- 数据库脚本转换
- 求一个上传照片和显示照片的程序解决方法
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-2.0.4.xsd"> <http auto-config="false" entry-point-ref="authenticationProcessingFilterEntryPoint">
<intercept-url pattern="/admin.jsp" access="ROLE_ADMIN" />
<intercept-url pattern="/**" access="ROLE_USER" />
</http> <authentication-provider>
<password-encoder hash="md5"/>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select userid,password,workstatus as enabled from wbxUser where userid=?"
authorities-by-username-query="select a.userid,b.groupname as authority from wbxuser a,usergroup b where a.groupid=b.groupid and userid=?"/>
</authentication-provider>
<beans:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<beans:property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<beans:property name="url" value="jdbc:microsoft:sqlserver://10.224.104.38:1433;databasename=forumlocal"/>
<beans:property name="username" value="sa"/>
<beans:property name="password" value="pass"/>
</beans:bean>
<beans:bean id="authenticationProcessingFilter" class="mycompany.login.MyAuthenticationProcessingFilter">
<custom-filter position="AUTHENTICATION_PROCESSING_FILTER"/>
<beans:property name="defaultTargetUrl" value="/index.jsp"/>
<beans:property name="authenticationManager" ref="authenticationManager"/>
</beans:bean>
<beans:bean id="authenticationProcessingFilterEntryPoint" class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
<beans:property name="loginFormUrl" value="/login.jsp"/>
<beans:property name="forceHttps" value="false"/>
</beans:bean>
<authentication-manager alias="authenticationManager"/>
</beans:beans>[/code]web.xml<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param><filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter><filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list><listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>[code=Java]