2012-09-16 33 views
2

我添加了安全约束来保护应用程序的某些文件夹。本地主机的Tomcat领域安全约束禁用

<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用户添加了合适的用户超级用户,当我部署应用程序时,这似乎都工作正常。然而,当我通过maven在本地从exclipse运行它时,使用tomcat7:run,我的本地设置没有tomcat-users.xml文件,所以基本上我不知道如何在本地配置用户。安全工作,但没有用户定义。

u能请告诉我如何通过或自定义指定的tomcat-sers.xml文件的内行tomcat的plugn

回答

2

我得到了它,如果有人曾经需要它。

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

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