2012-03-15 16 views
7

ứng dụng web quản trị của tôi là bảo đảm sử dụng basic-auth:Làm cách nào để áp dụng vai trò bảo mật tomcat cho tất cả URL nhưng một?

<security-constraint> 
    <web-resource-collection> 
    <web-resource-name>myApp</web-resource-name> 
    <description> 
     Security constraint for 
     Admin resources 
    </description> 
    <url-pattern>/*</url-pattern> 
    <http-method>POST</http-method> 
    <http-method>GET</http-method> 
    </web-resource-collection> 
    <auth-constraint> 
    <description> 
     constraint 
    </description> 
    <role-name>myrolename</role-name> 
    </auth-constraint> 
    <user-data-constraint> 
    <description>SSL not required</description> 
    <transport-guarantee>NONE</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 
<login-config> 
    <auth-method>BASIC</auth-method> 
    <realm-name>Admin Login</realm-name> 
</login-config> 

Tuy nhiên, tôi cần phải thiết lập một loại trừ cho một URL duy nhất (nói /kiểm tra/, được sử dụng bởi một dịch vụ tự động kiểm tra xem ứng dụng web vẫn còn trong chu kỳ bình thường.

Đáng tiếc là tôi không thể kích hoạt xác thực cơ bản cho dịch vụ này.

Làm thế nào tôi có thể đạt được điều này?

Cảm ơn rất nhiều.

Trả lời

7

Thêm hạn chế khác trước với <transport-guarantee>NONE</transport-guarantee> đã làm các trick

<security-constraint> 
    <web-resource-collection> 
     <web-resource-name>Status page, accessed internally by application</web-resource-name> 
     <url-pattern>/status/</url-pattern> 
    </web-resource-collection> 
    <user-data-constraint> 
     <transport-guarantee>NONE</transport-guarantee> 
    </user-data-constraint> 
</security-constraint> 
+0

này làm việc cho tôi, cảm ơn! –

Các vấn đề liên quan