Pivotal Cloud Foundry Support

 View Only

 How to override tomcat-users.xml in pcf embedded tomcat.

Bablu Prajapat's profile image
Bablu Prajapat posted Jul 20, 2020 12:19 PM

HI All,

 

I am deploying application (.war) into PCF and facing spring security in memory authentication issue due to tomcat-users.xml because it's not able to read authentication configuration tomcat-users.xml file.

 

tomcat-users.xml. and context.xml located in below path.

 AppRoot

|- src

   |- A.class

|- B.class

|--------

|-WebContent

|-META_INF

|- context.xml

  |- tomcat-user.xml

|- jks certificate

 

could you please help me on this .

Daniel Mikusa's profile image
Daniel Mikusa

How are you embedding Tomcat? Are you using Spring Boot?

 

For what it's worth `tomcat-users.xml` is a part of the global server configuration, it's not application specific.

<GlobalNamingResources> <!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users --> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources>

If you want to adjust that, you need to adjust it on the server level. Typically you'd do that by editing `conf/tomcat-users.xml`, but since you're emdedding Tomcat it really depends on how you're embedding it. Thanks.