2013-12-14 2 views
6

스프링 보안으로 폼 기반 인증을 구현하려고합니다. 내 메인 페이지가 제대로 작동 및 http://localhost:8080/master/admin 내가 페이지 (http://localhost:8080/master/login/)를 로그인 리디렉션 해요 : : 리디렉션 잘 작동j_spring_security_check 404가 필요한 이유는 무엇입니까?

<context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/spring/root-context.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> 

    <!-- 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-mapping> 
     <servlet-name>appServlet</servlet-name> 
     <url-pattern>/</url-pattern> 
    </servlet-mapping> 

그리고 내 루트 컨텍스트 :

<form action="j_spring_security_check" method="POST"> 
     <label for="username">User Name:</label> 
     <input id="username" name="j_username" type="text"/> 
     <label for="password">Password:</label> 
     <input id="password" name="j_password" type="password"/> 
     <input type="submit" value="Log In"/> 
     </form> 

but when I submit I get 404 on address: `http://localhost:8080/master/login/j_spring_security_check` 

가 여기 내 구성의 web.xml의 , 시도 .XML 이미 꽤 많은 시간을 잃었습니다

<sec:http auto-config="true"> 
    <sec:intercept-url pattern="/admin/**" access="ROLE_USER" /> 
    <sec:form-login login-page="/login/" 
     authentication-failure-url="http://www.google.com" default-target-url="http://www.google.com" /> 
    <sec:logout logout-success-url="/logout" /> 
</sec:http> 

<sec:authentication-manager> 
    <sec:authentication-provider> 
     <sec:user-service> 
      <sec:user name="test" password="test" authorities="ROLE_USER, ROLE_ADMIN" /> 
      <sec:user name="testuser" password="testuserpassword" 
       authorities="ROLE_USER" /> 
     </sec:user-service> 
    </sec:authentication-provider> 
</sec:authentication-manager> 

(나는 페이지 컨텍스트에 존재를 알 수 있도록 Google에 리디렉션을 만든) 다른 조합은 있지만 행운은 없습니다. 어떤 도움을 주셔서 감사합니다!

답변

5

내가 어떻게 그리고 왜 당신이 더 잘 이해하실 수에 대한 더 자세한 정보는이 보안 양식은 여기

/master/j_spring_security_check 
+1

을 가리켜 야 사실 것 같아요 : http://stackoverflow.com/questions/15365477/ 봄 - 3 - 보안 - 봄 - 보안 - 확인 –

관련 문제