Question

I have added security-constraint to protect some folders of the app.

<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>

I added proper user SUPER to tomcat-users, this is all seems to be working fine when I deploy the app. However when I run it locally from exclipse via maven, using tomcat7:run, my local setup does not have tomcat-users.xml file, so basically I am not sure how to configure users locally. Security works but no users defined.

Can u please tell me how to pass or specify custom tomcat-sers.xml file for the mavens tomcat plugn

Was it helpful?

Solution

I got it, if anybody ever needs it.

In pom.xml find your plugin block for tomcat7-maven-plugin and specify in configuration custom tomcat-users.xml path.

<configuration>
    <tomcatUsers>path/tomcat-users.xml</tomcatUsers>
</configuration>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top