tomcat がファイルをパスワードで保護できるかどうか (apache .htaccess など) を知っている人はいますか? つまり、ユーザーが tomcat webapp からファイルを要求すると、ユーザー名とパスワードを入力するダイアログが表示され、構成を使用してこれが作成されます。
または IP アドレスに応じてファイルを保護します。
誰かが私を助けてくれることを願っていますか?
よろしく
tomcat がファイルをパスワードで保護できるかどうか (apache .htaccess など) を知っている人はいますか? つまり、ユーザーが tomcat webapp からファイルを要求すると、ユーザー名とパスワードを入力するダイアログが表示され、構成を使用してこれが作成されます。
または IP アドレスに応じてファイルを保護します。
誰かが私を助けてくれることを願っていますか?
よろしく
Tomcatで基本認証を設定できます。
ユーザーを tomcat-users.xml に追加します。何かのようなもの :
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="tomcat"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="myname" password="mypassword" roles="tomcat"/>
<user username="test" password="test"/>
</tomcat-users>
アプリの web.xml に構成を追加します。お気に入り:
<!-- Define a Security Constraint on this Application -->
<security-constraint>
<web-resource-collection>
<web-resource-name>Entire Application</web-resource-name>
<url-pattern>/references/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>your-role</role-name>
</auth-constraint>
</security-constraint>
<!-- Define the Login Configuration for this Application -->
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Application</realm-name>
</login-config>
<!-- Security roles referenced by this web application -->
<security-role>
<description>
The role that is required to log in to the Manager Application
</description>
<role-name>your-role</role-name>
</security-role>
詳細を理解するためのリンク:
http://www.avajava.com/tutorials/lessons/how-do-i-use-basic-authentication-with-tomcat.html