webapp에 스프링 보안을 추가해야합니다. 내 응용 프로그램은 스프링을 사용하고 관리 부분에 vaadin을 사용합니다. auth 모드로 form-login을 사용하고 있습니다.봄 보안 http-form 404 페이지로 리디렉션
<form name='f' action="j_spring_security_check"
method='POST'>
<table>
<tr>
<td>User:</td>
<td><input type='text' name='j_username' value=''>
</td>
</tr>
<tr>
<td>Password:</td>
<td><input type='password' name='j_password' />
</td>
</tr>
<tr>
<td colspan='2'><input name="submit" type="submit"
value="submit" />
</td>
</tr>
<tr>
<td colspan='2'><input name="reset" type="reset" />
</td>
</tr>
</table>
</form>
나는 404 리디렉션을 얻을 : 그래서 고민하고있어 문제는 다음과 같은 양식을 게시 할 때이다.
<security:http authentication-manager-ref="authenticatioManager" auto-config="true" pattern="/web/**">
<security:intercept-url pattern="/web/**" access="ROLE_AUTH" />
<security:form-login login-page="/loginTest.do" default-target-url="/loginWelcome.do"
authentication-failure-url="/loginfailed.do" />
<security:logout logout-success-url="/logout.do" invalidate-session="true"/>
<security:session-management>
<security:concurrency-control max-sessions="1" error-if-maximum-exceeded="true" expired-url="/web/login" />
</security:session-management>
</security:http>
<bean id="userDetailsService" class="com.ddelizia.server.service.core.impl.UserDetailsServiceImpl"/>
<security:authentication-manager id="authenticatioManager">
<security:authentication-provider user-service-ref="userDetailsService">
<!-- <security:password-encoder hash="md5"/> -->
</security:authentication-provider>
</security:authentication-manager>
가 나는 또한 "/ login_spring"= 매개 변수 로그인 처리-URL 로그인 폼에 추가하려고 : 그래서 여기 내 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">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/root-context.xml</param-value>
</context-param>
<context-param>
<description>Vaadin production mode</description>
<param-name>productionMode</param-name>
<param-value>false</param-value>
</context-param>
<!-- Enables Spring Security -->
<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>
<!-- Enables Spring internationalization -->
<filter>
<filter-name>encoding-filter</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding-filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring/appServlet/servlet-context.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Vaadin Application Servlet</servlet-name>
<servlet-class>com.vaadin.terminal.gwt.server.ApplicationServlet</servlet-class>
<init-param>
<description>Vaadin application class to start</description>
<param-name>application</param-name>
<param-value>com.windy.server.admin.MyVaadinApplication</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Vaadin Application Servlet</servlet-name>
<url-pattern>/admin/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Vaadin Application Servlet</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<error-page>
<error-code>404</error-code>
<location>/WEB-INF/views/page404.jsp</location>
</error-page>
</web-app>
및 붙여 넣기 양식 동작에서 login_spring으로 변경했습니다.
내 응용 프로그램이 localhost : 8080/myapp 주소로 tomcat에서 실행 중이며 로그인 작업이 localhost : 8080/myapp/login_spring에서 호출되었지만 여전히 동일한 오류가 발생합니다.
또한 다음과 같은 봄 보안 필터 매핑을 변경 내 web.xml 파일을 수정하려고 : "/ login_spring.log"=
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>*.log</url-pattern>
</filter-mapping>
을하고 로그인 처리 - URL을 변경하지만 여전히 나는 404를 얻을 수 페이지.
은 그 때 나는 당신의 도움 사전에 ...감사 HTTP에-기본 authentcation로 전환하지만 작동이 경우에 ... 나는 내가 잘못 이해하지 않는 시도
여전히 404 페이지입니다.이 페이지는 http : // localhost : 8080/myapp/j_spring_security_check에 있지만 컨트롤러가 없습니다. – ddelizia
컨트롤러가 없어야합니다. 스프링 보안에 의해 내부적으로 처리되는 URL입니다. 내 편집을 참조하십시오. – Xaerxess
대단히 고마워요, 저를 미치게했습니다. 결국 나는 http 태그에서 "web/**"패턴을 지우고 그 것이 작동했다. 다시 감사합니다 – ddelizia