【问题标题】:Tomcat Realm security-constraint disable for localhost本地主机的 Tomcat 领域安全约束禁用
【发布时间】:2012-09-16 15:40:01
【问题描述】:

我添加了安全约束来保护应用程序的某些文件夹。

<security-constraint>
    <web-resource-collection>
        <web-resource-name>panel</web-resource-name>
        <url-pattern>/secured/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>super</role-name>
    </auth-constraint>
</security-constraint>
<login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>Panel</realm-name>
</login-config>

我向 tomcat-users 添加了适当的用户 SUPER,当我部署应用程序时,这一切似乎都运行良好。但是,当我通过 maven 从 exclipse 本地运行它时,使用 tomcat7:run,我的本地设置没有 tomcat-users.xml 文件,所以基本上我不确定如何在本地配置用户。安全有效,但未定义用户。

你能告诉我如何为 mavens tomcat 插件传递或指定自定义 tomcat-sers.xml 文件

【问题讨论】:

    标签: maven tomcat plugins realm security-constraint


    【解决方案1】:

    我知道了,如果有人需要的话。

    在 pom.xml 中找到 tomcat7-maven-plugin 的插件块,并在配置中指定自定义 tomcat-users.xml 路径。

    <configuration>
        <tomcatUsers>path/tomcat-users.xml</tomcatUsers>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-08
      • 2011-07-11
      • 2014-09-23
      • 2017-04-09
      • 1970-01-01
      • 1970-01-01
      • 2020-11-04
      • 1970-01-01
      相关资源
      最近更新 更多