2013-05-21 5 views
4

Tomcat을 통한 양식 기반 인증을 수행하는 웹 응용 프로그램에서이 문제가 발생하며 index.html 파일로 리디렉션하지 않고 로고 이미지 파일로 리디렉션합니다 그 로고 이미지를 포함하는 ...로그인 후 잘못된 URL로 Tomcat이 리디렉션 됨

내가 갈거야에 :

http://localhost:8080/GenTreeUploader/Servlet 

는 그 다음 나에게 로그인 양식을 제공하고 성공적으로 로그인 한 후

, 나는 거라고 해당 URL에 아니에요, 리디렉션되는 수신자 :

http://localhost:8080/GenTreeUploader/images/gdia_logo.png 
그때 그는 올바른 위치가 아닌 이미지 파일 어린 아이 리디렉션

http://localhost:8080/GenTreeUploader/Servlet 

: 나는에 갈 때가 인증하고있어 후

.

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.0" 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_3_0.xsd"> 

    <!-- WELCOME FILE LIST --> 
    <welcome-file-list> 
     <welcome-file>/Servlet</welcome-file> 
    </welcome-file-list> 

    <!-- Security --> 

    <security-constraint> 

     <web-resource-collection> 
      <web-resource-name>Wildcard means whole app requires authentication</web-resource-name> 
      <url-pattern>/*</url-pattern> 
      <http-method>GET</http-method> 
      <http-method>POST</http-method> 
     </web-resource-collection> 

     <auth-constraint> 
      <role-name>tomcat</role-name> 
     </auth-constraint> 

     <user-data-constraint> 
      <!-- transport-guarantee can be CONFIDENTIAL, INTEGRAL, or NONE --> 
      <transport-guarantee>NONE</transport-guarantee> 
     </user-data-constraint> 
    </security-constraint> 

    <login-config> 
     <auth-method>FORM</auth-method> 
     <form-login-config> 
      <form-login-page>/login.jsp</form-login-page> 
      <form-error-page>/error.html</form-error-page> 
     </form-login-config> 
    </login-config> 

    <!-- Main Servlet --> 
    <servlet> 
     <servlet-name>GenTreeUploaderServlet</servlet-name> 
     <servlet-class>org.ktu.gdia.presentation.web.GenTreeUploader</servlet-class> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>GenTreeUploaderServlet</servlet-name> 
     <url-pattern>/Servlet</url-pattern> 
    </servlet-mapping> 


    <session-config> 
     <session-timeout> 
      60 
     </session-timeout> 
    </session-config> 
</web-app> 

음 :

내 web.xml 파일을 첨부하고있어? 예상대로 작동하지 않는 이유는 무엇입니까? 미리 감사드립니다. 라는

<web-resource-collection> 
     <web-resource-name>Wildcard means whole app requires authentication</web-resource-name> 
     <url-pattern>/*</url-pattern> 
     <http-method>GET</http-method> 
     <http-method>POST</http-method> 
    </web-resource-collection> 

그래서 나는 새로운 폴더를 생성 : 로그인 파일에 요청 된 해당 자원이 실제로 보호 되었기 때문에 나는 안전한 자원으로 전체 경로를 선택했기 때문에

+0

문제가 귀하의 서블릿 코드 또는 귀하가 분석하고 도움을주기 위해 제공하지 않은 어딘가에있는 것 같습니다. –

답변

5

리디렉션에서 실제로 일어나고 있었다 "Admin"은 보안이 필요한 파일을 옮길뿐만 아니라 서블릿의 경로도 수정했습니다. 그들은 지금 인증없이 누구에게나에서 액세스 가능 되었기 때문에

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="3.0" 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_3_0.xsd"> 

    <!-- WELCOME FILE LIST --> 
    <welcome-file-list> 
     <welcome-file>Admin/Servlet</welcome-file> 
    </welcome-file-list> 

    <!-- Security --> 

    <security-constraint> 

     <web-resource-collection> 
      <web-resource-name>Wildcard means whole app requires authentication</web-resource-name> 
      <url-pattern>/Admin/*</url-pattern> 
      <http-method>GET</http-method> 
      <http-method>POST</http-method> 
     </web-resource-collection> 

     <auth-constraint> 
      <role-name>admin</role-name> 
     </auth-constraint> 

     <user-data-constraint> 
      <!-- transport-guarantee can be CONFIDENTIAL, INTEGRAL, or NONE --> 
      <transport-guarantee>NONE</transport-guarantee> 
     </user-data-constraint> 
    </security-constraint> 

    <login-config> 
     <auth-method>FORM</auth-method> 
     <form-login-config> 
      <form-login-page>/login.jsp</form-login-page> 
      <form-error-page>/error.html</form-error-page> 
     </form-login-config> 
    </login-config> 

    <!-- Main Servlet --> 
    <servlet> 
     <servlet-name>GenTreeUploaderServlet</servlet-name> 
     <servlet-class>org.ktu.gdia.presentation.web.GenTreeUploader</servlet-class> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>GenTreeUploaderServlet</servlet-name> 
     <url-pattern>/Admin/Servlet</url-pattern> 
    </servlet-mapping> 


    <session-config> 
     <session-timeout> 
      60 
     </session-timeout> 
    </session-config> 
</web-app> 

는 이제 Tomcat이 더 이상 로그인 한 후 이미지 나 CSS 파일에 저를 리디렉션 할 것 : 여기 내 전류 (고정) web.xml의 모습 방법입니다.

+0

이상하게도, Confidential를 사용하면 작동하지 않습니다. – pokeRex110

관련 문제