我有一個web項目在基於表單的身份驗證在JBOSS中正常工作。但是當我在websphere 7中部署相同的時候,我得到了HTTP 500錯誤。Websphere j_security_check struts2問題
我的web.xml
<display-name>Test</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<listener>
<listener-class>org.apache.tiles.web.startup.TilesListener</listener-class>
</listener>
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<security-constraint>
<web-resource-collection>
<web-resource-name>test_actions</web-resource-name>
<description></description>
<url-pattern>*.action</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description></description>
<role-name>testuser</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<security-role>
<description></description>
<role-name>testuser</role-name>
</security-role>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>Default</realm-name>
<form-login-config>
<form-login-page>/login_form.jsp</form-login-page>
<form-error-page>/login_error.jsp</form-error-page>
</form-login-config>
</login-config>
的index.html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TEST</title>
</head>
<body onload="document.MainForm.submit();">
<form action="welcomeAction.action" method="post" id="MainForm" name="MainForm">
</form>
</body>
</html>
我有一個攔截器AuthorizationInterceptor延伸RolesInterceptor和這個攔截器實際上檢查用戶exsists在我們的數據庫request.getUserPrincipal()。getName()用於獲取用戶標識。因此,當welcomeAction.action被調用它應該來到AuthorizationInterceptor,但請求永遠不會到達這裏。
在websphere中,我啓用了全局安全性。 Websphere LoginForm示例正常工作。我是否需要自己過濾j_security_check過濾器?或websphere webcontainer處理這個。 (在LoginForm中,我看到了LoginFilter代碼)。但我相信websphere webcontainer應該處理像jboss或tomcat這樣的j_security_check東西。