2013-05-05 2 views
0

다음 섹션에서는 모든 클라이언트가 https 연결을 사용하도록 설정해야합니다.모든 하위 위치에 https 연결을 적용하는 방법은 무엇입니까? JAX-RS JBoss

사실 실제로 일어나는 것은 index.html 페이지 만이 ssl에 의해 보안된다는 것입니다. 따라서 http://localhost/JAX-RS_Service/과 같은 요청은 https://localhost/JAX-RS_Service/으로 리디렉션되고 index.html 페이지가 표시됩니다. 동일한 것은 http://localhost/JAX-RS_Service/index.html 입니다. 그러나 http://localhost/JAX-RS_Service/services/customers/1을 요청하면 https로 리디렉션되지 않으므로 모든 것이 일반 텍스트로 전송됩니다.

같은 인증

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>Authenticated customers only</web-resource-name> 
     <url-pattern>/services/customers/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>CUST</role-name> 
    </auth-constraint> 
</security-constraint> 

<url-pattern>/services/*</url-pattern> 같은 URL 패턴이 일을하지 않습니다 시행을위한 것입니다.

왜 하위 작업에 <url-pattern>/*</url-pattern>이 작동하지 않습니다. 이 문제를 해결할 수있는 방법이 있습니까?

답변

0

실제로 이유는 모르겠지만 다음 구성이 내 문제를 해결했습니다.

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>SSL Secured WebService</web-resource-name> 
     <url-pattern>/*</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>Authenticated customers only</web-resource-name> 
     <url-pattern>/services/customers/*</url-pattern> 
    </web-resource-collection> 
    <auth-constraint> 
     <role-name>CUST</role-name> 
    </auth-constraint> 
    <user-data-constraint> 
     <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 

<user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> 요구 그렇지 않으면 보스에 대해 작동하지 않습니다 각 <security-constraint>에 추가 할 수 있습니다. 흥미로운 점은 Tomcat의 경우 <url-pattern>/*</url-pattern>에 대해 한 번에 한 번만 <transport-guarantee>CONFIDENTIAL</transport-guarantee>을 정의해야하며 모든 것이 제대로 보호되어야합니다. 제 의견으로는 이것은 훨씬 합리적입니다!