[英]How to prevent undeploying applications in Tomcat Apache 7
I am getting one problem 我遇到一个问题
I want to hide undeploy option 我想隐藏取消部署选项
Is it possible ? 可能吗 ? If so please help me out. 如果是这样,请帮助我。
Thanks in Advance, 提前致谢,
You will have to set different roles for the deploy
and undeploy
operations. 您将必须为deploy
和undeploy
操作设置不同的角色。
First, register the roles in $TOMCAT_DIR/conf/tomcat-users.xml
. 首先,在$TOMCAT_DIR/conf/tomcat-users.xml
注册角色。 For example: 例如:
<role rolename="deploy"/>
<role rolename="undeploy"/>
Then, open the $TOMCAT_DIR/webapps/manager/WEB-INF/web.xml
and ensure the following: 然后,打开$TOMCAT_DIR/webapps/manager/WEB-INF/web.xml
并确保执行以下操作:
<security-constraint>
<web-resource-collection>
<web-resource-name>Manual Deployment</web-resource-name>
<url-pattern>/html/deploy</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager-gui</role-name>
<role-name>deploy</role-name>
</auth-constraint>
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Manual Deployment</web-resource-name>
<url-pattern>/html/undeploy</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>manager-gui</role-name>
<role-name>undeploy</role-name>
</auth-constraint>
</security-constraint>
This will allow only the users which have a undeploy
role to undeploy applications and only the users who have deploy
role to deploy applications. 这将仅允许具有undeploy
角色的用户undeploy
部署应用程序,并且仅允许具有deploy
角色的用户部署应用程序。 Note that an user can be decorated with more than on role. 请注意,可以为用户装饰更多角色。
Finally, decorate your user with some of the newly created roles, restart Tomcat and see what happens. 最后,用一些新创建的角色来装饰用户,重新启动Tomcat,然后看看会发生什么。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.