简体   繁体   English

如何防止在Tomcat Apache 7中取消部署应用程序

[英]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. 您将必须为deployundeploy操作设置不同的角色。

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.

相关问题 取消部署应用程序时如何清除Tomcat日志 - How to clear Tomcat logs when undeploying the application 在从Apache Tomcat取消部署/停止应用程序之前停止进程/线程 - Stop processes/threads before undeploying/stop application from Apache Tomcat 如何配置Apache以将子域重定向到Tomcat应用程序 - How to configure Apache to redirect subdomains to Tomcat applications 如何防止Apache Tomcat中的PemGen空间错误 - how to prevent PemGen space error in Apache Tomcat Apache Tomcat 应用程序的默认会话超时 - Default session timeout for Apache Tomcat applications 如何使用apache或tomcat服务器在docker中运行java应用程序 - How can i run java applications in docker using apache or tomcat server 如何使用Tomcat Apache Server 9(如IIS)为多个域(Java应用程序)提供服务 - How can I serve Multiple Domains (Java applications) with Tomcat Apache Server 9 (Like IIS) 一台Apache Tomcat应用程序服务器,具有2个配置的war应用程序和一个MessageSource异常 - One Apache Tomcat application server with 2 configured war applications and a MessageSource exception 在Apache Tomcat上运行针对不同IDP配置的多个Fedlet应用程序 - Running multiple Fedlet applications configured against different IDPs on Apache Tomcat 在Apache Tomcat服务器7.0中部署PHP和Java EE应用程序 - Deploying PHP and Java EE applications in Apache Tomcat server 7.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM