보안을 위한 Java Servlet 3.1 지원 구성
Liberty는 Java™ Servlet 3.1 스펙에 정의된 대로 모든 보안 업데이트를 지원합니다.
이 태스크 정보
Liberty에서 Java Servlet 3.1 기능을 이용하십시오.
프로시저
- server.xml 파일에 servlet-3.1 기능을 추가하십시오.
<feature>servlet-3.1</feature>
- 다음 중 사용할 Java Servlet 3.1 기능을 결정하십시오.
- 로그인 양식에 autocomplete=off를 지정하십시오. 양식 로그인 페이지에 대해 HTML을 사용하는 경우, 비밀번호 양식 필드를 autocomplete="off"로 설정하여 웹 브라우저에서 비밀번호 자동 채우기를 사용 안함으로 설정하십시오. 예:
<form method="POST" action="j_security_check"> <input type="text" name="j_username"> <input type="password" name="j_password" autocomplete="off"> </form>
- 모든 인증 보안 제한조건(**)을 지정하십시오. 특수한 역할 이름 **는 임의의 인증된 사용자를 표시합니다. 인증 제한조건에 **가 표시되는 경우 해당 사용자는 제한조건에 지정된 메소드에 대한 액세스 권한이 있습니다. 사용자는 애플리케이션 바인딩에서 이 역할에 맵핑될 필요가 없습니다. 예:
<security-constraint id="SecurityConstraint_1"> <web-resource-collection id="WebResourceCollection_1"> <web-resource-name>Protected with ** role</web-resource-name> <url-pattern>/AnyAuthSecurityConstraint</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint id="AuthConstraint_1"> <role-name>**</role-name> </auth-constraint> </security-constraint>
역할 이름 **와 함께 isUserInRole() 메소드가 호출되면 isUserInRole()은 사용자가 인증된 경우 true를 리턴합니다. **가 보안 역할에 있는 구성에 정의된 역할인 경우에는 특수한 인증 사용자 역할처럼 처리되지 않습니다. isUserInRole이 true를 리턴하려면 사용자가 애플리케이션 바인딩에서 해당 역할에 맵핑되어야 합니다.
- web.xml 파일에서 deny-uncovered-http-methods 플래그를
지정하십시오. web.xml 파일에 deny-uncovered-http-methods 요소가 지정된 경우, 컨테이너는 요청 URL과 가장 잘 일치하는 URL 패턴을 위해 결합된 보안 제한조건 내에 열거되지 않은 공개 HTTP 메소드를 모두 거부합니다. 403 (SC_FORBIDDEN) 상태 코드가 리턴됩니다. 예:
<servlet-mapping id="ServletMapping_1"> <servlet-name>MyServlet</servlet-name> <url-pattern>/MyURLPattern</url-pattern> </servlet-mapping> <deny-uncovered-http-methods/> <!-- SECURITY CONSTRAINTS --> <security-constraint id="SecurityConstraint_1"> <web-resource-collection id="WebResourceCollection_1"> <web-resource-name>Protected with Employee or Manager roles</web-resource-name> <url-pattern>/MyURLPattern</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint id="AuthConstraint_1"> <role-name>Employee</role-name> <role-name>Manager</role-name> </auth-constraint> </security-constraint>
web.xml 파일에 deny-uncovered-http-methods 요소가 지정된 경우, 각 서블릿의 각 URL 패턴에 대해 공개 메소드가 보호되지 않으며 액세스 불가능함을 나타내는 메모와 함께 해당 공개 메소드를 표시하는 메시지가 messages.log 파일에 로그됩니다. 예:For URL MyURLPattern in servlet MyServlet, the following HTTP methods are uncovered, and not accessible: DELETE OPTIONS HEAD PUT TRACE
web.xml 파일에 deny-uncovered-http-methods 요소가 지정되지 않은 경우, 각 서블릿의 각 URL 패턴에 대해 공개 메소드가 보호되지 않으며 액세스 가능함을 나타내는 메모와 함께 해당 공개 메소드를 표시하는 메시지가 messages.log 파일에 로그됩니다. 예:For URL MyURLPattern in servlet MyServlet, the following HTTP methods are uncovered, and accessible: DELETE OPTIONS HEAD PUT TRACE
- 로그인 양식에 autocomplete=off를 지정하십시오.
결과


http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=twlp_servlet31
파일 이름: twlp_servlet31.html