1
没有人知道如果tomcat能够密码保护文件(如apache .htaccess)? 我的意思是,当用户从tomcat webapp请求一个文件时,它会提示输入用户名和密码的对话框,并使用配置进行设置。Tomcat保护文件
或保护该文件取决于其IP地址。
希望有人能帮助我吗?
regads
没有人知道如果tomcat能够密码保护文件(如apache .htaccess)? 我的意思是,当用户从tomcat webapp请求一个文件时,它会提示输入用户名和密码的对话框,并使用配置进行设置。Tomcat保护文件
或保护该文件取决于其IP地址。
希望有人能帮助我吗?
regads
你可以在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
难道我的回答可以帮助您? :)如果是,请接受它作为答案。 – YoK 2010-07-29 03:29:41
有没有办法使用ip地址preotec应用程序 – SMSM 2010-07-29 10:48:26