Websphere j_security_check проблема с struts2

У меня есть веб-проект, отлично работающий в JBOSS с аутентификацией на основе форм. Но когда я развертываю то же самое в websphere 7, я получаю ошибку HTTP 500.

Мой 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, и этот перехватчик фактически проверяет наличие пользователей в нашей БД request.getUserPrincipal().getName(). для получения идентификатора пользователя. Поэтому, когда вызывается welcomeAction.action, он должен был прийти к AuthorizationInterceptor, но запрос никогда не достигает этого.

В вебсфере я включил глобальную безопасность. Пример Websphere LoginForm работает нормально. Должен ли я сам настраивать фильтр j_security_check? или веб-контейнер веб-сферы справиться с этим. (В LoginForm я видел код LoginFilter). Но я считаю, что веб-контейнер websphere должен обрабатывать вещи j_security_check, такие как jboss или tomcat.


person paramupk    schedule 26.06.2012    source источник


Ответы (1)


Вы должны создать пользовательскую форму и отправить ее в j_security_check. WebSphere не обрабатывает это по умолчанию. См.: http://www.redbooks.ibm.com/abstracts/tips0220.html?Open

person ad-inf    schedule 19.07.2012