8
我配置了tomcat進行基本身份驗證。 我不希望任何人訪問我的Web應用程序,但該應用程序正在提供Web服務。 所以我想從基本身份驗證繞過特定的IP地址(即IP不應該要求身份驗證。)Tomcat:繞過指定IP地址的基本身份驗證
的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>
謝謝, Chetan。
謝謝palacsinit,我會嘗試添加此功能,並且會盡快發佈結果。 – Chetan
它工作完美,非常感謝palacsint。 – Chetan