[java-idp-tomcat-base] 02/02: Add empty tomcat-users.xml to avoid errors at startup

Tom Zeller tzeller at dragonacea.biz
Fri Mar 11 14:28:05 UTC 2022


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch 9.0
in repository java-idp-tomcat-base.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-tomcat-base.git;a=commit;h=5f7cd4ba5751eeb77673527ddaa9c9100d7da6ea

commit 5f7cd4ba5751eeb77673527ddaa9c9100d7da6ea
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Thu Mar 10 12:03:34 2022 -0600

    Add empty tomcat-users.xml to avoid errors at startup
---
 src/main/resources/tomcat-base/conf/server.xml     | 14 +++++
 .../resources/tomcat-base/conf/tomcat-users.xml    | 56 ++++++++++++++++++++
 .../resources/tomcat-base/conf/tomcat-users.xsd    | 59 ++++++++++++++++++++++
 3 files changed, 129 insertions(+)

diff --git a/src/main/resources/tomcat-base/conf/server.xml b/src/main/resources/tomcat-base/conf/server.xml
index 507f668..abb1527 100644
--- a/src/main/resources/tomcat-base/conf/server.xml
+++ b/src/main/resources/tomcat-base/conf/server.xml
@@ -31,6 +31,20 @@
   <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
   <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
 
+  <!-- Global JNDI resources
+       Documentation at /docs/jndi-resources-howto.html
+  -->
+  <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>
+
   <!-- A "Service" is a collection of one or more "Connectors" that share
        a single "Container" Note:  A "Service" is not itself a "Container",
        so you may not define subcomponents such as "Valves" at this level.
diff --git a/src/main/resources/tomcat-base/conf/tomcat-users.xml b/src/main/resources/tomcat-base/conf/tomcat-users.xml
new file mode 100644
index 0000000..86b2a4a
--- /dev/null
+++ b/src/main/resources/tomcat-base/conf/tomcat-users.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<tomcat-users xmlns="http://tomcat.apache.org/xml"
+              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+              xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
+              version="1.0">
+<!--
+  By default, no user is included in the "manager-gui" role required
+  to operate the "/manager/html" web application.  If you wish to use this app,
+  you must define such a user - the username and password are arbitrary.
+
+  Built-in Tomcat manager roles:
+    - manager-gui    - allows access to the HTML GUI and the status pages
+    - manager-script - allows access to the HTTP API and the status pages
+    - manager-jmx    - allows access to the JMX proxy and the status pages
+    - manager-status - allows access to the status pages only
+
+  The users below are wrapped in a comment and are therefore ignored. If you
+  wish to configure one or more of these users for use with the manager web
+  application, do not forget to remove the <!.. ..> that surrounds them. You
+  will also need to set the passwords to something appropriate.
+-->
+<!--
+  <user username="admin" password="<must-be-changed>" roles="manager-gui"/>
+  <user username="robot" password="<must-be-changed>" roles="manager-script"/>
+-->
+<!--
+  The sample user and role entries below are intended for use with the
+  examples web application. They are wrapped in a comment and thus are ignored
+  when reading this file. If you wish to configure these users for use with the
+  examples web application, do not forget to remove the <!.. ..> that surrounds
+  them. You will also need to set the passwords to something appropriate.
+-->
+<!--
+  <role rolename="tomcat"/>
+  <role rolename="role1"/>
+  <user username="tomcat" password="<must-be-changed>" roles="tomcat"/>
+  <user username="both" password="<must-be-changed>" roles="tomcat,role1"/>
+  <user username="role1" password="<must-be-changed>" roles="role1"/>
+-->
+</tomcat-users>
diff --git a/src/main/resources/tomcat-base/conf/tomcat-users.xsd b/src/main/resources/tomcat-base/conf/tomcat-users.xsd
new file mode 100644
index 0000000..6a3446c
--- /dev/null
+++ b/src/main/resources/tomcat-base/conf/tomcat-users.xsd
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<xs:schema xmlns="http://www.w3.org/2001/XMLSchema"
+           targetNamespace="http://tomcat.apache.org/xml"
+           xmlns:users="http://tomcat.apache.org/xml"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified"
+           attributeFormDefault="unqualified"
+           version="1.0">
+  <xs:element name="tomcat-users">
+    <xs:complexType>
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+        <xs:element name="role">
+          <xs:complexType>
+            <xs:attribute name="rolename" use="required" type="users:entityname" />
+            <xs:attribute name="description" type="xs:string" />
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="group">
+          <xs:complexType>
+            <xs:attribute name="groupname" use="required" type="users:entityname" />
+            <xs:attribute name="description" type="xs:string" />
+            <xs:attribute name="roles" type="xs:string" />
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="user">
+          <xs:complexType>
+            <xs:attribute name="username" use="required" type="users:entityname" />
+            <xs:attribute name="fullname" type="xs:string" />
+            <xs:attribute name="password" type="xs:string" />
+            <xs:attribute name="roles" type="xs:string" />
+            <xs:attribute name="groups" type="xs:string" />
+          </xs:complexType>
+        </xs:element>
+      </xs:choice>
+      <xs:attribute name="version" type="xs:string" />
+    </xs:complexType>
+  </xs:element>
+  <xs:simpleType name="entityname">
+    <xs:restriction base="xs:string">
+      <xs:minLength value="1"/>
+    </xs:restriction>
+  </xs:simpleType>
+</xs:schema>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list