Tôi đã định cấu hình tomcat để xác thực cơ bản. Tôi không muốn bất kỳ ai có quyền truy cập vào ứng dụng web của mình nhưng ứng dụng đang phục vụ các dịch vụ web. Vì vậy, tôi muốn bỏ qua một địa chỉ IP cụ thể từ xác thực cơ bản (ip rằng không nên yêu cầu xác thực.)Tomcat: Bỏ qua xác thực cơ bản cho địa chỉ IP được chỉ định
tomcat-users.xml:.
<tomcat-users>
<user username="user" password="password" roles="user"/>
</tomcat-users>
web.xml:
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>You must enter your login credentials to continue</realm-name>
</login-config>
<security-role>
<description>
The role that is required to log in to the Application
</description>
<role-name>user</role-name>
</security-role>
Cảm ơn, Chetan.
Cảm ơn palacsinit, tôi sẽ cố gắng thêm điều này và sẽ sớm đăng kết quả. – Chetan
Nó hoạt động hoàn hảo, Cảm ơn bạn rất nhiều. – Chetan