0
사용되지 않는 HTTP 메소드에 대한 액세스를 거부해야하는 경우가 있습니다.
우리는 JBoss 4.2에서 실행 중이며 로그인해야합니다. GET 및 POST를 제외한 다른 모든 액세스 시도는 거부되어야합니다.j2ee의 HTTP 메소드에 대한 액세스 거부
다음 web.xml 구성을 시도했지만 도움이되지 않습니다. 서블릿이 여전히 호출되어 예를 들어 반환됩니다. DELETE 요청시 "액세스가 거부되었습니다."
대신 501: Not implemented
이 반환 될 것으로 예상됩니다.
첫 번째 보안 제약 조건에 HTTP 메서드를 포함하지 않으면 사용자가 승인되지 않은 페이지를 즉시 제공받습니다.
<web-app>
<security-constraint>
<web-resource-collection>
<web-resource-name>Deny most when not logged in</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<!-- no auth-constraint tag here -->
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Allow methods</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Admin</role-name>
</auth-constraint>
</security-constraint>
</web-app>
어떻게해야하는지에 대한 아이디어가 있습니까?