서블릿 보안 동적 어노테이션

프로그램화된 API를 사용하여 서블릿을 추가 또는 작성하는 경우, 보안 어노테이션, RunAs, declareRoles, ServletSecurity는 각각 setRunAsRole(), declareRoles(), setServletSecurity()를 사용하여 동적으로 업데이트 가능합니다.

참고: RunAs, declareRoles, ServletSecurity 서블릿 보안 어노테이션은 WebSphere® Application Server의 이 릴리스에서 새로운 기능입니다.

애플리케이션 시작 시, 웹 컨테이너는 RunAs, declareRoles 및 ServletSecurity 어노테이션이 있는 모든 서블릿을 조사하여 ServletRegistration 어노테이션의 setServletSecurity() 메소드에서 해당 어노테이션을 설정합니다. 웹 컨테이너는 URL 패턴 및 보안 제한조건이 있는 모든 ServletRegistration 어노테이션을 조사하도록 보안 컴포넌트에 알립니다. 그러면 보안 컴포넌트는 배치 디스크립터에 URL 패턴이 정의되어 있는지 판별합니다. 배치 디스크립터에 일치 항목이 이미 정의되어 있으면 동적 데이터 대신 배치 디스크립터의 URL 패턴에서 보안 제한조건과 RunAs 역할을 사용합니다.

문제점 방지 문제점 방지: 동적 보안 어노테이션 declareRoles, setRunAs, rolesAllowed가 사용되는 경우, 배치 디스크립터 또는 서블릿 클래스의 declareRoles 및/또는 RunAs를 통해 역할 이름은 사전 정의되어야 합니다. 배치 중에 관리 콘솔을 사용하여 이 역할에 사용자 또는 그룹을 맵핑할 수 있습니다. gotcha

보안 동적 어노테이션에서 ServletSecurity 어노테이션에 정확하게 일치하는 URL 패턴이 있는 경우, 보안 동적 어노테이션에서 URL 패턴의 보안 제한사항이 우선적으로 사용됩니다. 또한, 동일한 URL 패턴으로 setServletSecurity() 메소드를 여러 번 호출하면 마지막 호출이 사용됩니다.

  • ServletRegistration.Dynamic.setRunAsRole(String roleName)은 이 서블릿 등록을 위한 RunAs 역할 이름을 설정합니다.
  • ServletContext.declareRoles(String roleNames)는 isUserInRole() 메소드에 테스트된 역할 이름을 선언합니다.
  • ServletRegistration.Dynmaic.setServletSecurity(ServletSecurityElement constraint)는 이 서블릿 등록에 대해 ServletSecurityElement를 설정합니다.
참고: 웹 인증 시스템 특성인 com.ibm.wsspi.security.web.webAuthReq를 지속적으로 설정하면 유효한 사용자 이름과 비밀번호를 제공한 경우 보호되지 않은 URL에 로그인할 수 있습니다.

다음 두 예는 setServletSecurity() 메소드를 사용하여 동적 서블릿에 대해 보안 제한조건 및 RunAs 역할을 설정하는 데 사용할 수 있습니다.

이 예에서 모든 HTTP 요소에는 직원 역할에 대해 멤버십이 필요하며 PUT 메소드는 제외됩니다. PUT 메소드의 경우, <auth-constraint> 요소에는 관리자 역할의 멤버십이 필요하고 TransportGuarantee는 기밀입니다.
HttpConstraintElement constraint = new HttpConstraintElement(TransportGuarantee.NONE,
new String[]{"Employee"});
List<HttpMethodConstraintElement> methodConstraints =
new ArrayList<HttpMethodConstraintElement>();
methodConstraints.add(new HttpMethodConstraintElement("PUT",
new HttpConstraintElement(TransportGuarantee.CONFIDENTIAL, new String[]{"Manager"})));
ServletSecurityElement servletSecurity =
new ServletSecurityElement(constraint, methodConstraints);
이 예에서 모든 HTTP 메소드가 허용되며 CUSTOM 및 GET 메소드는 제외됩니다. CUSTOM 메소드에 대해 <auth-constraint> 요소에는 관리자 역할의 멤버십이 필요합니다. GET 메소드에 대해 <auth-constraint> 요소에는 직원 역할의 멤버십이 필요하며 TransportGuarantee는 기밀입니다.
HttpConstraintElement constraint = new HttpConstraintElement();
List<HttpMethodConstraintElement> methodConstraints = 
new ArrayList<HttpMethodConstraintElement>();
methodConstraints.add(new HttpMethodConstraintElement("CUSTOM", 
new HttpConstraintElement(TransportGuarantee.NONE, new String[]{"Manager"})));
methodConstraints.add(new HttpMethodConstraintElement("GET", 
new HttpConstraintElement(TransportGuarantee.CONFIDENTIAL, new String[]{"Employee"})));
ServletSecurityElement servletSecurity = new ServletSecurityElement(constraint, 
methodConstraints);

주제 유형을 표시하는 아이콘 개념 주제



시간소인 아이콘 마지막 업데이트 날짜: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=csec_dynamic_annotations
파일 이름:csec_dynamic_annotations.html