[tomcat] branch main updated: Add version number

2021-09-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new ca11d56  Add version number
ca11d56 is described below

commit ca11d5650cafd197190e950d0e05e8ddf87482dd
Author: remm 
AuthorDate: Thu Sep 23 11:01:27 2021 +0200

Add version number
---
 java/org/apache/tomcat/util/descriptor/web/WebXml.java | 4 
 1 file changed, 4 insertions(+)

diff --git a/java/org/apache/tomcat/util/descriptor/web/WebXml.java 
b/java/org/apache/tomcat/util/descriptor/web/WebXml.java
index 4708f7c..8cba46f 100644
--- a/java/org/apache/tomcat/util/descriptor/web/WebXml.java
+++ b/java/org/apache/tomcat/util/descriptor/web/WebXml.java
@@ -186,6 +186,10 @@ public class WebXml extends XmlEncodingBase implements 
DocumentProperties.Charse
 majorVersion = 5;
 minorVersion = 0;
 break;
+case "6.0":
+majorVersion = 6;
+minorVersion = 0;
+break;
 default:
 log.warn(sm.getString("webXml.version.unknown", version));
 }

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Fix delete then create

2021-09-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 4c8e01b  Fix delete then create
4c8e01b is described below

commit 4c8e01b8bbd08eba5d8c5e137e405201cea0e511
Author: remm 
AuthorDate: Mon Sep 20 21:19:12 2021 +0200

Fix delete then create

Delete is remembered so that everything gets removed before creating new
objects.
---
 .../catalina/users/DataSourceUserDatabase.java | 221 ++---
 webapps/docs/changelog.xml |   4 +
 2 files changed, 114 insertions(+), 111 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 01f6718..a010498 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -562,7 +562,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 Group group = new GenericGroup<>(this, groupname, description, 
null);
 createdGroups.put(groupname, group);
 modifiedGroups.remove(groupname);
-removedGroups.remove(groupname);
 return group;
 } finally {
 readLock.unlock();
@@ -576,7 +575,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 Role role = new GenericRole<>(this, rolename, description);
 createdRoles.put(rolename, role);
 modifiedRoles.remove(rolename);
-removedRoles.remove(rolename);
 return role;
 } finally {
 readLock.unlock();
@@ -590,7 +588,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 User user = new GenericUser<>(this, username, password, fullName, 
null, null);
 createdUsers.put(username, user);
 modifiedUsers.remove(username);
-removedUsers.remove(username);
 return user;
 } finally {
 readLock.unlock();
@@ -1048,6 +1045,49 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 
 if (isRoleStoreDefined()) {
 
+// Removed roles
+if (!removedRoles.isEmpty()) {
+temp = new StringBuilder("DELETE FROM ");
+temp.append(roleTable);
+temp.append(" WHERE ").append(roleNameCol);
+temp.append(" = ?");
+if (groupRoleTable != null) {
+tempRelationDelete = new StringBuilder("DELETE FROM ");
+tempRelationDelete.append(groupRoleTable);
+tempRelationDelete.append(" WHERE ");
+tempRelationDelete.append(roleNameCol);
+tempRelationDelete.append(" = ?");
+}
+StringBuilder tempRelationDelete2 = new StringBuilder("DELETE 
FROM ");
+tempRelationDelete2.append(userRoleTable);
+tempRelationDelete2.append(" WHERE ");
+tempRelationDelete2.append(roleNameCol);
+tempRelationDelete2.append(" = ?");
+for (Role role : removedRoles.values()) {
+if (tempRelationDelete != null) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+}
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete2.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(temp.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+}
+removedRoles.clear();
+}
+
 // Created roles
 if (!createdRoles.isEmpty()) {
 temp = new StringBuilder("INSERT INTO ");
@@ -1094,49 +1134,6 @@ publ

[tomcat] branch 10.0.x updated: Fix delete then create

2021-09-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 509138a  Fix delete then create
509138a is described below

commit 509138afb41308ef4cd3d60feaa863f5e496244a
Author: remm 
AuthorDate: Mon Sep 20 21:19:12 2021 +0200

Fix delete then create

Delete is remembered so that everything gets removed before creating new
objects.
---
 .../catalina/users/DataSourceUserDatabase.java | 221 ++---
 webapps/docs/changelog.xml |   4 +
 2 files changed, 114 insertions(+), 111 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 01f6718..a010498 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -562,7 +562,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 Group group = new GenericGroup<>(this, groupname, description, 
null);
 createdGroups.put(groupname, group);
 modifiedGroups.remove(groupname);
-removedGroups.remove(groupname);
 return group;
 } finally {
 readLock.unlock();
@@ -576,7 +575,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 Role role = new GenericRole<>(this, rolename, description);
 createdRoles.put(rolename, role);
 modifiedRoles.remove(rolename);
-removedRoles.remove(rolename);
 return role;
 } finally {
 readLock.unlock();
@@ -590,7 +588,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 User user = new GenericUser<>(this, username, password, fullName, 
null, null);
 createdUsers.put(username, user);
 modifiedUsers.remove(username);
-removedUsers.remove(username);
 return user;
 } finally {
 readLock.unlock();
@@ -1048,6 +1045,49 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 
 if (isRoleStoreDefined()) {
 
+// Removed roles
+if (!removedRoles.isEmpty()) {
+temp = new StringBuilder("DELETE FROM ");
+temp.append(roleTable);
+temp.append(" WHERE ").append(roleNameCol);
+temp.append(" = ?");
+if (groupRoleTable != null) {
+tempRelationDelete = new StringBuilder("DELETE FROM ");
+tempRelationDelete.append(groupRoleTable);
+tempRelationDelete.append(" WHERE ");
+tempRelationDelete.append(roleNameCol);
+tempRelationDelete.append(" = ?");
+}
+StringBuilder tempRelationDelete2 = new StringBuilder("DELETE 
FROM ");
+tempRelationDelete2.append(userRoleTable);
+tempRelationDelete2.append(" WHERE ");
+tempRelationDelete2.append(roleNameCol);
+tempRelationDelete2.append(" = ?");
+for (Role role : removedRoles.values()) {
+if (tempRelationDelete != null) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+}
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete2.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(temp.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+}
+removedRoles.clear();
+}
+
 // Created roles
 if (!createdRoles.isEmpty()) {
 temp = new StringBuilder("INSERT INTO ");
@@ -1094,49 +1134,6 @@ publ

[tomcat] branch main updated: Fix delete then create

2021-09-20 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new ff7f2c4  Fix delete then create
ff7f2c4 is described below

commit ff7f2c4495598f542be4592f5ec187353a46333e
Author: remm 
AuthorDate: Mon Sep 20 21:19:12 2021 +0200

Fix delete then create

Delete is remembered so that everything gets removed before creating new
objects.
---
 .../catalina/users/DataSourceUserDatabase.java | 221 ++---
 webapps/docs/changelog.xml |   4 +
 2 files changed, 114 insertions(+), 111 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 01f6718..a010498 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -562,7 +562,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 Group group = new GenericGroup<>(this, groupname, description, 
null);
 createdGroups.put(groupname, group);
 modifiedGroups.remove(groupname);
-removedGroups.remove(groupname);
 return group;
 } finally {
 readLock.unlock();
@@ -576,7 +575,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 Role role = new GenericRole<>(this, rolename, description);
 createdRoles.put(rolename, role);
 modifiedRoles.remove(rolename);
-removedRoles.remove(rolename);
 return role;
 } finally {
 readLock.unlock();
@@ -590,7 +588,6 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 User user = new GenericUser<>(this, username, password, fullName, 
null, null);
 createdUsers.put(username, user);
 modifiedUsers.remove(username);
-removedUsers.remove(username);
 return user;
 } finally {
 readLock.unlock();
@@ -1048,6 +1045,49 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 
 if (isRoleStoreDefined()) {
 
+// Removed roles
+if (!removedRoles.isEmpty()) {
+temp = new StringBuilder("DELETE FROM ");
+temp.append(roleTable);
+temp.append(" WHERE ").append(roleNameCol);
+temp.append(" = ?");
+if (groupRoleTable != null) {
+tempRelationDelete = new StringBuilder("DELETE FROM ");
+tempRelationDelete.append(groupRoleTable);
+tempRelationDelete.append(" WHERE ");
+tempRelationDelete.append(roleNameCol);
+tempRelationDelete.append(" = ?");
+}
+StringBuilder tempRelationDelete2 = new StringBuilder("DELETE 
FROM ");
+tempRelationDelete2.append(userRoleTable);
+tempRelationDelete2.append(" WHERE ");
+tempRelationDelete2.append(roleNameCol);
+tempRelationDelete2.append(" = ?");
+for (Role role : removedRoles.values()) {
+if (tempRelationDelete != null) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+}
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete2.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(temp.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
+}
+removedRoles.clear();
+}
+
 // Created roles
 if (!createdRoles.isEmpty()) {
 temp = new StringBuilder("INSERT INTO ");
@@ -1094,49 +1134,6 @@ publ

svn commit: r1893329 - in /tomcat/site/trunk: docs/doap_Tomcat.rdf xdocs/doap_Tomcat.rdf

2021-09-14 Thread remm
Author: remm
Date: Tue Sep 14 08:03:17 2021
New Revision: 1893329

URL: http://svn.apache.org/viewvc?rev=1893329=rev
Log:
Missed update to doap_Tomcat for a couple releases

Modified:
tomcat/site/trunk/docs/doap_Tomcat.rdf
tomcat/site/trunk/xdocs/doap_Tomcat.rdf

Modified: tomcat/site/trunk/docs/doap_Tomcat.rdf
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/doap_Tomcat.rdf?rev=1893329=1893328=1893329=diff
==
--- tomcat/site/trunk/docs/doap_Tomcat.rdf (original)
+++ tomcat/site/trunk/docs/doap_Tomcat.rdf Tue Sep 14 08:03:17 2021
@@ -67,8 +67,8 @@
 
   
 Latest Stable 9.0.x Release
-2021-07-02
-9.0.50
+2021-09-10
+9.0.53
   
 
 

Modified: tomcat/site/trunk/xdocs/doap_Tomcat.rdf
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/doap_Tomcat.rdf?rev=1893329=1893328=1893329=diff
==
--- tomcat/site/trunk/xdocs/doap_Tomcat.rdf (original)
+++ tomcat/site/trunk/xdocs/doap_Tomcat.rdf Tue Sep 14 08:03:17 2021
@@ -67,8 +67,8 @@
 
   
 Latest Stable 9.0.x Release
-2021-07-02
-9.0.50
+2021-09-10
+9.0.53
   
 
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r49926 - /release/tomcat/tomcat-9/v9.0.52/

2021-09-13 Thread remm
Author: remm
Date: Mon Sep 13 19:16:32 2021
New Revision: 49926

Log:
Drop 9.0.52

Removed:
release/tomcat/tomcat-9/v9.0.52/


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Update with release date for 9.0.53

2021-09-13 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new f9a04a4  Update with release date for 9.0.53
f9a04a4 is described below

commit f9a04a426f1b1208cd6806e3d61a001d1b0c331a
Author: remm 
AuthorDate: Mon Sep 13 21:02:11 2021 +0200

Update with release date for 9.0.53
---
 webapps/docs/changelog.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index c76bd90..6b56b8a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -124,7 +124,7 @@
 
   
 
-
+
   
 
   

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1893320 - in /tomcat/site/trunk: docs/download-90.html docs/index.html docs/migration-9.html docs/oldnews.html docs/whichversion.html xdocs/download-90.xml xdocs/index.xml xdocs/migration

2021-09-13 Thread remm
Author: remm
Date: Mon Sep 13 18:58:47 2021
New Revision: 1893320

URL: http://svn.apache.org/viewvc?rev=1893320=rev
Log:
Update site for Tomcat 9.0.53

Modified:
tomcat/site/trunk/docs/download-90.html
tomcat/site/trunk/docs/index.html
tomcat/site/trunk/docs/migration-9.html
tomcat/site/trunk/docs/oldnews.html
tomcat/site/trunk/docs/whichversion.html
tomcat/site/trunk/xdocs/download-90.xml
tomcat/site/trunk/xdocs/index.xml
tomcat/site/trunk/xdocs/migration-9.xml
tomcat/site/trunk/xdocs/oldnews.xml
tomcat/site/trunk/xdocs/whichversion.xml

Modified: tomcat/site/trunk/docs/download-90.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/download-90.html?rev=1893320=1893319=1893320=diff
==
--- tomcat/site/trunk/docs/download-90.html (original)
+++ tomcat/site/trunk/docs/download-90.html Mon Sep 13 18:58:47 2021
@@ -12,7 +12,7 @@
 
   Quick Navigation
 
-[define v]9.0.52[end]
+[define v]9.0.53[end]
 https://downloads.apache.org/tomcat/tomcat-9/KEYS;>KEYS |
 [v] |
 Browse |

Modified: tomcat/site/trunk/docs/index.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/index.html?rev=1893320=1893319=1893320=diff
==
--- tomcat/site/trunk/docs/index.html (original)
+++ tomcat/site/trunk/docs/index.html Mon Sep 13 18:58:47 2021
@@ -36,6 +36,28 @@ wiki page.
 Apache Tomcat, Tomcat, Apache, the Apache feather, and the Apache Tomcat
 project logo are trademarks of the Apache Software Foundation.
 
+2021-09-10 Tomcat 9.0.53 Released
+
+The Apache Tomcat Project is proud to announce the release of version 9.0.53
+of Apache Tomcat. This release implements specifications that are part of the
+Java EE 8 platform. The notable changes compared to 9.0.52 include:
+
+Add a UserDatabase implementation as a superset of the DataSourceRealm
+functionality
+Update the internal fork of Apache Commons DBCP to 2.9.0 and Apache
+Commons Pool to 2.11.1
+Update the packaged version of the Tomcat Native Library to 1.2.31 to
+pick up Windows binaries built with OpenSSL 1.1.1l 
+
+
+Full details of these changes, and all the other changes, are available in the
+Tomcat 9
+changelog.
+
+
+
+https://tomcat.apache.org/download-90.cgi;>Download
+
 2021-09-10 Tomcat 10.0.11 Released
 
 The Apache Tomcat Project is proud to announce the release of version 10.0.11
@@ -135,28 +157,6 @@ changelog.
 
 https://tomcat.apache.org/download-80.cgi;>Download
 
-2021-08-06 Tomcat 9.0.52 Released
-
-The Apache Tomcat Project is proud to announce the release of version 9.0.52
-of Apache Tomcat. This release implements specifications that are part of the
-Java EE 8 platform. The notable changes compared to 9.0.50 include:
-
-Correct a regression in the previous release in the HTTP/2 flow
-control window management
-Correct a regression the could cause some TLS connections to hang when
-using NIO
-Use of GraalVM native images no longer automatically disables JMX
-support 
-
-
-Full details of these changes, and all the other changes, are available in the
-Tomcat 9
-changelog.
-
-
-
-https://tomcat.apache.org/download-90.cgi;>Download
-
 2021-05-07 Tomcat Migration Tool for Jakarta EE 1.0.0 
Released
 
 The Apache Tomcat Project is proud to announce the release of 1.0.0 of the

Modified: tomcat/site/trunk/docs/migration-9.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/migration-9.html?rev=1893320=1893319=1893320=diff
==
--- tomcat/site/trunk/docs/migration-9.html (original)
+++ tomcat/site/trunk/docs/migration-9.html Mon Sep 13 18:58:47 2021
@@ -418,7 +418,8 @@ of Apache Tomcat.
 9.0.45
 9.0.46
 9.0.48
-9.0.50
+9.0.50
+9.0.52
 , new version:
 
 9.0.0-M1
@@ -477,7 +478,8 @@ of Apache Tomcat.
 9.0.46
 9.0.48
 9.0.50
-9.0.52
+9.0.52
+9.0.53
 trunk (unreleased)
 
 

Modified: tomcat/site/trunk/docs/oldnews.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/oldnews.html?rev=1893320=1893319=1893320=diff
==
--- tomcat/site/trunk/docs/oldnews.html (original)
+++ tomcat/site/trunk/docs/oldnews.html Mon Sep 13 18:58:47 2021
@@ -17,6 +17,28 @@
   year 2011
   year 2010
 
+2021-08-06 Tomcat 9.0.52 Released
+
+The Apache Tomcat Project is proud to announce the release of version 9.0.52
+of Apache Tomcat. This release implements specifications that are part of the
+Java EE 8 platform. The notable changes compared to 9.0.50 include:
+
+Correct a regression in the previous release in the HTTP/2 flow
+control window management
+Correct a regression the could cause some TLS connections to hang when
+using NIO
+Use of GraalVM native images no longer a

svn commit: r1893319 [6/7] - in /tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache: catalina/mbeans/ catalina/users/ tomcat/dbcp/dbcp2/ tomcat/util/threads/

2021-09-13 Thread remm
Added: 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.html?rev=1893319=auto
==
--- 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.html
 (added)
+++ 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.html
 Mon Sep 13 18:58:18 2021
@@ -0,0 +1,1099 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+
+
+
+DataSourceMXBean (Apache Tomcat 9.0.53 API Documentation)
+
+
+
+
+
+var methods = 
{"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":18,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":6,"i22":6,"i23":6,"i24":6,"i25":6,"i26":6,"i27":6,"i28":6,"i29":6,"i30":6,"i31":6,"i32":6,"i33":6,"i34":6,"i35":6,"i36":6,"i37":6,"i38":18,"i39":6,"i40":6,"i41":18,"i42":18};
+var tabs = {65535:["t0","All Methods"],2:["t2","Instance 
Methods"],4:["t3","Abstract Methods"],16:["t5","Default Methods"]};
+var altColor = "altColor";
+var rowColor = "rowColor";
+var tableTab = "tableTab";
+var activeTableTab = "activeTableTab";
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Skip navigation links
+
+
+
+
+Overview
+Package
+Class
+Tree
+Deprecated
+Index
+Help
+
+Apache Tomcat 9.0.53
+
+
+
+PrevClass
+NextClass
+
+
+Frames
+NoFrames
+
+
+AllClasses
+
+
+
+
+
+
+
+Summary:
+Nested|
+Field|
+Constr|
+Method
+
+
+Detail:
+Field|
+Constr|
+Method
+
+
+
+
+
+
+
+
+org.apache.tomcat.dbcp.dbcp2
+Interface 
DataSourceMXBean
+
+
+
+
+
+
+All Known Subinterfaces:
+BasicDataSourceMXBean
+
+
+All Known Implementing Classes:
+BasicDataSource, BasicManagedDataSource
+
+
+
+public interface DataSourceMXBean
+Defines the methods that will be made available via
+ https://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html;>JMX.
+
+Since:
+2.9.0
+
+
+
+
+
+
+
+
+
+
+
+
+Method Summary
+
+All MethodsInstance MethodsAbstract MethodsDefault Methods
+
+Modifier and Type
+Method and Description
+
+
+boolean
+getAbandonedUsageTracking()
+See BasicDataSource.getAbandonedUsageTracking().
+
+
+
+boolean
+getCacheState()
+See BasicDataSource.getCacheState().
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String[]
+getConnectionInitSqlsAsArray()
+See BasicDataSource.getConnectionInitSqlsAsArray().
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html?is-external=true;
 title="class or interface in java.lang">Boolean
+getDefaultAutoCommit()
+See BasicDataSource.getDefaultAutoCommit().
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+getDefaultCatalog()
+See BasicDataSource.getDefaultCatalog().
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Boolean.html?is-external=true;
 title="class or interface in java.lang">Boolean
+getDefaultReadOnly()
+See BasicDataSource.getDefaultReadOnly().
+
+
+
+default https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+getDefaultSchema()
+See BasicDataSource.getDefaultSchema().
+
+
+
+int
+getDefaultTransactionIsolation()
+See BasicDataSource.getDefaultTransactionIsolation().
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String[]
+getDisconnectionSqlCodesAsArray()
+See BasicDataSource.getDisconnectionSqlCodesAsArray().
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+getDriverClassName()
+See BasicDataSource.getDriverClassName().
+
+
+
+boolean
+getFastFailValidation()
+See BasicDataSource.getFastFailValidation().
+
+
+
+int
+getInitialSize()
+See BasicDataSource.getInitialSize().
+
+
+
+boolean
+getLifo()
+See BasicDataSource.getLifo().
+
+
+
+boolean
+getLogAbandoned()
+See BasicDataSource.getLogAbandoned().
+
+
+
+boolean
+getLogExpiredConnections()
+See BasicDataSource.getLogExpiredConnections().
+
+
+
+long
+getMaxConnLifetimeMillis()
+See BasicDataSource.getMaxConnLifetimeMillis().
+
+
+
+int
+getMaxIdle()
+See BasicDataSource.getMaxIdle().
+
+
+
+int
+getMaxOpenPreparedStatements()
+See BasicDataSource.getMaxOpenPreparedStatements().
+
+
+
+int

svn commit: r1893319 [7/7] - in /tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache: catalina/mbeans/ catalina/users/ tomcat/dbcp/dbcp2/ tomcat/util/threads/

2021-09-13 Thread remm
Added: 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.CallerRunsPolicy.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.CallerRunsPolicy.html?rev=1893319=auto
==
--- 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.CallerRunsPolicy.html
 (added)
+++ 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.CallerRunsPolicy.html
 Mon Sep 13 18:58:18 2021
@@ -0,0 +1,302 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+
+
+
+ThreadPoolExecutor.CallerRunsPolicy (Apache Tomcat 9.0.53 API 
Documentation)
+
+
+
+
+
+var methods = {"i0":10};
+var tabs = {65535:["t0","All Methods"],2:["t2","Instance 
Methods"],8:["t4","Concrete Methods"]};
+var altColor = "altColor";
+var rowColor = "rowColor";
+var tableTab = "tableTab";
+var activeTableTab = "activeTableTab";
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Skip navigation links
+
+
+
+
+Overview
+Package
+Class
+Tree
+Deprecated
+Index
+Help
+
+Apache Tomcat 9.0.53
+
+
+
+PrevClass
+NextClass
+
+
+Frames
+NoFrames
+
+
+AllClasses
+
+
+
+
+
+
+
+Summary:
+Nested|
+Field|
+Constr|
+Method
+
+
+Detail:
+Field|
+Constr|
+Method
+
+
+
+
+
+
+
+
+org.apache.tomcat.util.threads
+Class 
ThreadPoolExecutor.CallerRunsPolicy
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">java.lang.Object
+
+
+org.apache.tomcat.util.threads.ThreadPoolExecutor.CallerRunsPolicy
+
+
+
+
+
+
+
+All Implemented Interfaces:
+ThreadPoolExecutor.RejectedExecutionHandler
+
+
+Enclosing class:
+ThreadPoolExecutor
+
+
+
+public static class ThreadPoolExecutor.CallerRunsPolicy
+extends https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">Object
+implements ThreadPoolExecutor.RejectedExecutionHandler
+A handler for rejected tasks that runs the rejected task
+ directly in the calling thread of the execute method,
+ unless the executor has been shut down, in which case the task
+ is discarded.
+
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+Constructors
+
+Constructor and Description
+
+
+CallerRunsPolicy()
+Creates a CallerRunsPolicy.
+
+
+
+
+
+
+
+
+
+
+Method Summary
+
+All MethodsInstance MethodsConcrete Methods
+
+Modifier and Type
+Method and Description
+
+
+void
+rejectedExecution(https://docs.oracle.com/javase/8/docs/api/java/lang/Runnable.html?is-external=true;
 title="class or interface in java.lang">Runnabler,
+ ThreadPoolExecutore)
+Executes task r in the caller's thread, unless the executor
+ has been shut down, in which case the task is discarded.
+
+
+
+
+
+
+
+Methods inherited from classjava.lang.https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">Object
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--;
 title="class or interface in java.lang">clone, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-;
 title="class or interface in java.lang">equals, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--;
 title="class or interface in java.lang">finalize, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--;
 title="class or interface in java.lang">getClass, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--;
 title="class or interface in java.lang">hashCode, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--;
 title="class or interface in java.lang">notify, https://docs.oracle.com/javase/8/docs/api/ja
 va/lang/Object.html?is-external=true#notifyAll--" title="class or interface in 
java.lang">notifyAll, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--;
 title="class or interface in java.lang">toString, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--;
 title="class or interface in java.lang">wait, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-;
 title="class or interface in java.lang">wait, 

svn commit: r1893319 [2/7] - in /tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache: catalina/mbeans/ catalina/users/ tomcat/dbcp/dbcp2/ tomcat/util/threads/

2021-09-13 Thread remm
Added: 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/SparseUserDatabaseMBean.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/SparseUserDatabaseMBean.html?rev=1893319=auto
==
--- 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/SparseUserDatabaseMBean.html
 (added)
+++ 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/SparseUserDatabaseMBean.html
 Mon Sep 13 18:58:18 2021
@@ -0,0 +1,692 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+
+
+
+SparseUserDatabaseMBean (Apache Tomcat 9.0.53 API Documentation)
+
+
+
+
+
+var methods = 
{"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10};
+var tabs = {65535:["t0","All Methods"],2:["t2","Instance 
Methods"],8:["t4","Concrete Methods"]};
+var altColor = "altColor";
+var rowColor = "rowColor";
+var tableTab = "tableTab";
+var activeTableTab = "activeTableTab";
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Skip navigation links
+
+
+
+
+Overview
+Package
+Class
+Tree
+Deprecated
+Index
+Help
+
+Apache Tomcat 9.0.53
+
+
+
+PrevClass
+NextClass
+
+
+Frames
+NoFrames
+
+
+AllClasses
+
+
+
+
+
+
+
+Summary:
+Nested|
+Field|
+Constr|
+Method
+
+
+Detail:
+Field|
+Constr|
+Method
+
+
+
+
+
+
+
+
+org.apache.catalina.mbeans
+Class 
SparseUserDatabaseMBean
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">java.lang.Object
+
+
+org.apache.tomcat.util.modeler.BaseModelMBean
+
+
+org.apache.catalina.mbeans.SparseUserDatabaseMBean
+
+
+
+
+
+
+
+
+
+All Implemented Interfaces:
+https://docs.oracle.com/javase/8/docs/api/javax/management/DynamicMBean.html?is-external=true;
 title="class or interface in javax.management">DynamicMBean, https://docs.oracle.com/javase/8/docs/api/javax/management/MBeanRegistration.html?is-external=true;
 title="class or interface in javax.management">MBeanRegistration, https://docs.oracle.com/javase/8/docs/api/javax/management/modelmbean/ModelMBeanNotificationBroadcaster.html?is-external=true;
 title="class or interface in 
javax.management.modelmbean">ModelMBeanNotificationBroadcaster, https://docs.oracle.com/javase/8/docs/api/javax/management/NotificationBroadcaster.html?is-external=true;
 title="class or interface in javax.management">NotificationBroadcaster
+
+
+Direct Known Subclasses:
+MemoryUserDatabaseMBean
+
+
+
+public class SparseUserDatabaseMBean
+extends BaseModelMBean
+A ModelMBean implementation for the
+ org.apache.catalina.users.SparseUserDatabase component.
+ The main difference is that the MBeans are created on demand (for exemple,
+ the findUser method would register the corresponding user and make it
+ available for management. All the MBeans created for users, groups and roles
+ are then discarded when save is invoked.
+
+Author:
+Craig R. McClanahan
+
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+Fields
+
+Modifier and Type
+Field and Description
+
+
+protected ManagedBean
+managed
+The ManagedBean information describing this 
MBean.
+
+
+
+protected ManagedBean
+managedGroup
+The ManagedBean information describing Group 
MBeans.
+
+
+
+protected ManagedBean
+managedRole
+The ManagedBean information describing Group 
MBeans.
+
+
+
+protected ManagedBean
+managedUser
+The ManagedBean information describing User 
MBeans.
+
+
+
+protected https://docs.oracle.com/javase/8/docs/api/javax/management/MBeanServer.html?is-external=true;
 title="class or interface in javax.management">MBeanServer
+mserver
+The MBeanServer for this application.
+
+
+
+protected Registry
+registry
+The configuration information registry for our managed 
beans.
+
+
+
+
+
+
+
+Fields inherited from classorg.apache.tomcat.util.modeler.BaseModelMBean
+attributeBroadcaster,
 generalBroadcaster,
 managedBean,
 oname,
 resource,
 resourceType
+
+
+
+
+
+
+
+
+Constructor Summary
+
+Constructors
+
+Constructor and Description
+
+
+SparseUserDatabaseMBean()
+
+
+
+
+
+
+
+
+
+Method Summary
+
+All MethodsInstance MethodsConcrete Methods
+
+Modifier and Type
+Method and Description
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+createGroup(https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">Stringgroupname,
+   

svn commit: r1893319 [5/7] - in /tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache: catalina/mbeans/ catalina/users/ tomcat/dbcp/dbcp2/ tomcat/util/threads/

2021-09-13 Thread remm
Added: 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/GenericUser.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/GenericUser.html?rev=1893319=auto
==
--- 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/GenericUser.html
 (added)
+++ 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/GenericUser.html
 Mon Sep 13 18:58:18 2021
@@ -0,0 +1,721 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+
+
+
+GenericUser (Apache Tomcat 9.0.53 API Documentation)
+
+
+
+
+
+var methods = 
{"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10};
+var tabs = {65535:["t0","All Methods"],2:["t2","Instance 
Methods"],8:["t4","Concrete Methods"]};
+var altColor = "altColor";
+var rowColor = "rowColor";
+var tableTab = "tableTab";
+var activeTableTab = "activeTableTab";
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Skip navigation links
+
+
+
+
+Overview
+Package
+Class
+Tree
+Deprecated
+Index
+Help
+
+Apache Tomcat 9.0.53
+
+
+
+PrevClass
+NextClass
+
+
+Frames
+NoFrames
+
+
+AllClasses
+
+
+
+
+
+
+
+Summary:
+Nested|
+Field|
+Constr|
+Method
+
+
+Detail:
+Field|
+Constr|
+Method
+
+
+
+
+
+
+
+
+org.apache.catalina.users
+Class GenericUserUD extends UserDatabase
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">java.lang.Object
+
+
+org.apache.catalina.users.AbstractUser
+
+
+org.apache.catalina.users.GenericUserUD
+
+
+
+
+
+
+
+
+
+Type Parameters:
+UD - The specific type of UserDase with which this role is 
associated
+
+
+All Implemented Interfaces:
+https://docs.oracle.com/javase/8/docs/api/java/security/Principal.html?is-external=true;
 title="class or interface in java.security">Principal, User
+
+
+Direct Known Subclasses:
+MemoryUser
+
+
+
+public class GenericUserUD extends UserDatabase
+extends AbstractUser
+Concrete implementation of User for a
+ UserDatabase.
+
+Author:
+Craig R. McClanahan
+
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+Fields
+
+Modifier and Type
+Field and Description
+
+
+protected UD
+database
+The UserDatabase that owns this user.
+
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArrayList.html?is-external=true;
 title="class or interface in 
java.util.concurrent">CopyOnWriteArrayListGroup
+groups
+The set of Groups that this user is a member 
of.
+
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CopyOnWriteArrayList.html?is-external=true;
 title="class or interface in 
java.util.concurrent">CopyOnWriteArrayListRole
+roles
+The set of Roles associated with this user.
+
+
+
+
+
+
+
+Fields inherited from classorg.apache.catalina.users.AbstractUser
+fullName,
 password,
 username
+
+
+
+
+
+
+
+
+Method Summary
+
+All MethodsInstance MethodsConcrete Methods
+
+Modifier and Type
+Method and Description
+
+
+void
+addGroup(Groupgroup)
+Add a new Group to those this user belongs to.
+
+
+
+void
+addRole(Rolerole)
+Add a new Role to those assigned specifically to 
this user.
+
+
+
+boolean
+equals(https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">Objectobj)
+
+
+https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html?is-external=true;
 title="class or interface in java.util">IteratorGroup
+getGroups()
+Return the set of Groups to which this user belongs.
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html?is-external=true;
 title="class or interface in java.util">IteratorRole
+getRoles()
+Return the set of Roles assigned specifically to this 
user.
+
+
+
+UserDatabase
+getUserDatabase()
+Return the UserDatabase within which this User is 
defined.
+
+
+
+int
+hashCode()
+
+
+boolean
+isInGroup(Groupgroup)
+Is this user in the specified group?
+
+
+
+boolean
+isInRole(Rolerole)
+Is this user specifically assigned the specified Role?
+
+
+
+void
+removeGroup(Groupgroup)
+Remove a Group from those this user belongs 
to.
+
+
+
+void
+removeGroups()
+Remove all Groups from those this user belongs 
to.
+
+
+
+void
+removeRole(Rolerole)
+Remove a Role from those assigned to this 
user.
+
+
+
+void
+removeRoles()
+Remove all Roles from those assigned to this 
user.
+
+
+
+void

svn commit: r1893319 [4/7] - in /tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache: catalina/mbeans/ catalina/users/ tomcat/dbcp/dbcp2/ tomcat/util/threads/

2021-09-13 Thread remm
Added: 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabaseFactory.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabaseFactory.html?rev=1893319=auto
==
--- 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabaseFactory.html
 (added)
+++ 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabaseFactory.html
 Mon Sep 13 18:58:18 2021
@@ -0,0 +1,323 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+
+
+
+DataSourceUserDatabaseFactory (Apache Tomcat 9.0.53 API 
Documentation)
+
+
+
+
+
+var methods = {"i0":10};
+var tabs = {65535:["t0","All Methods"],2:["t2","Instance 
Methods"],8:["t4","Concrete Methods"]};
+var altColor = "altColor";
+var rowColor = "rowColor";
+var tableTab = "tableTab";
+var activeTableTab = "activeTableTab";
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Skip navigation links
+
+
+
+
+Overview
+Package
+Class
+Tree
+Deprecated
+Index
+Help
+
+Apache Tomcat 9.0.53
+
+
+
+PrevClass
+NextClass
+
+
+Frames
+NoFrames
+
+
+AllClasses
+
+
+
+
+
+
+
+Summary:
+Nested|
+Field|
+Constr|
+Method
+
+
+Detail:
+Field|
+Constr|
+Method
+
+
+
+
+
+
+
+
+org.apache.catalina.users
+Class 
DataSourceUserDatabaseFactory
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">java.lang.Object
+
+
+org.apache.catalina.users.DataSourceUserDatabaseFactory
+
+
+
+
+
+
+
+All Implemented Interfaces:
+https://docs.oracle.com/javase/8/docs/api/javax/naming/spi/ObjectFactory.html?is-external=true;
 title="class or interface in javax.naming.spi">ObjectFactory
+
+
+
+public class DataSourceUserDatabaseFactory
+extends https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">Object
+implements https://docs.oracle.com/javase/8/docs/api/javax/naming/spi/ObjectFactory.html?is-external=true;
 title="class or interface in javax.naming.spi">ObjectFactory
+JNDI object creation factory for 
DataSourceUserDatabase
+ instances.  This makes it convenient to configure a user database
+ in the global JNDI resources associated with this Catalina instance,
+ and then link to that resource for web applications that administer
+ the contents of the user database.
+
+ The DataSourceUserDatabase instance is configured based
+ on the following parameter values:
+ 
+ dataSourceName - JNDI name of the DataSource, which
+ must be located in the same Context environment as the UserDatabase
+ 
+
+Author:
+Craig R. McClanahan
+
+
+
+
+
+
+
+
+
+
+
+
+Constructor Summary
+
+Constructors
+
+Constructor and Description
+
+
+DataSourceUserDatabaseFactory()
+
+
+
+
+
+
+
+
+
+Method Summary
+
+All MethodsInstance MethodsConcrete Methods
+
+Modifier and Type
+Method and Description
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">Object
+getObjectInstance(https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">Objectobj,
+ https://docs.oracle.com/javase/8/docs/api/javax/naming/Name.html?is-external=true;
 title="class or interface in javax.naming">Namename,
+ https://docs.oracle.com/javase/8/docs/api/javax/naming/Context.html?is-external=true;
 title="class or interface in javax.naming">ContextnameCtx,
+ https://docs.oracle.com/javase/8/docs/api/java/util/Hashtable.html?is-external=true;
 title="class or interface in 
java.util">Hashtable?,?environment)
+Create and return a new DataSourceUserDatabase 
instance
+ that has been configured according to the properties of the
+ specified Reference.
+
+
+
+
+
+
+
+Methods inherited from classjava.lang.https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">Object
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--;
 title="class or interface in java.lang">clone, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-;
 title="class or interface in java.lang">equals, https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--;
 title="class or interface in java.lang">finalize, 

svn commit: r1893319 [3/7] - in /tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache: catalina/mbeans/ catalina/users/ tomcat/dbcp/dbcp2/ tomcat/util/threads/

2021-09-13 Thread remm
Added: 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabase.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabase.html?rev=1893319=auto
==
--- 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabase.html
 (added)
+++ 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabase.html
 Mon Sep 13 18:58:18 2021
@@ -0,0 +1,1743 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+
+
+
+DataSourceUserDatabase (Apache Tomcat 9.0.53 API Documentation)
+
+
+
+
+
+var methods = 
{"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10,"i25":10,"i26":10,"i27":10,"i28":10,"i29":10,"i30":10,"i31":10,"i32":10,"i33":10,"i34":10,"i35":10,"i36":10,"i37":10,"i38":10,"i39":10,"i40":10,"i41":10,"i42":10,"i43":10,"i44":10,"i45":10,"i46":10,"i47":10,"i48":10,"i49":10,"i50":10,"i51":10,"i52":10,"i53":10,"i54":10,"i55":10};
+var tabs = {65535:["t0","All Methods"],2:["t2","Instance 
Methods"],8:["t4","Concrete Methods"]};
+var altColor = "altColor";
+var rowColor = "rowColor";
+var tableTab = "tableTab";
+var activeTableTab = "activeTableTab";
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Skip navigation links
+
+
+
+
+Overview
+Package
+Class
+Tree
+Deprecated
+Index
+Help
+
+Apache Tomcat 9.0.53
+
+
+
+PrevClass
+NextClass
+
+
+Frames
+NoFrames
+
+
+AllClasses
+
+
+
+
+
+
+
+Summary:
+Nested|
+Field|
+Constr|
+Method
+
+
+Detail:
+Field|
+Constr|
+Method
+
+
+
+
+
+
+
+
+org.apache.catalina.users
+Class 
DataSourceUserDatabase
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">java.lang.Object
+
+
+org.apache.catalina.users.SparseUserDatabase
+
+
+org.apache.catalina.users.DataSourceUserDatabase
+
+
+
+
+
+
+
+
+
+All Implemented Interfaces:
+UserDatabase
+
+
+
+public class DataSourceUserDatabase
+extends SparseUserDatabase
+UserDatabase backed by a data source.
+
+
+
+
+
+
+
+
+
+
+
+Field Summary
+
+Fields
+
+Modifier and Type
+Field and Description
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html?is-external=true;
 title="class or interface in java.util.concurrent">ConcurrentHashMaphttps://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String,Group
+createdGroups
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html?is-external=true;
 title="class or interface in java.util.concurrent">ConcurrentHashMaphttps://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String,Role
+createdRoles
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html?is-external=true;
 title="class or interface in java.util.concurrent">ConcurrentHashMaphttps://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String,User
+createdUsers
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+dataSourceName
+The name of the JNDI JDBC DataSource
+
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+groupNameCol
+The column in the user group table that names a group
+
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+groupRoleTable
+The table that holds the relation between groups and 
roles
+
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+groupTable
+The table that holds user data.
+
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true;
 title="class or interface in java.lang">String
+id
+The unique global identifier of this user database.
+
+
+
+protected https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html?is-external=true;
 title="class or 

svn commit: r1893319 [1/7] - in /tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache: catalina/mbeans/ catalina/users/ tomcat/dbcp/dbcp2/ tomcat/util/threads/

2021-09-13 Thread remm
Author: remm
Date: Mon Sep 13 18:58:18 2021
New Revision: 1893319

URL: http://svn.apache.org/viewvc?rev=1893319=rev
Log:
Update docs for Tomcat 9.0.53

Added:

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/SparseUserDatabaseMBean.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabase.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/DataSourceUserDatabaseFactory.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/GenericGroup.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/GenericRole.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/GenericUser.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/users/SparseUserDatabase.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/dbcp/dbcp2/DataSourceMXBean.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.AbortPolicy.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.CallerRunsPolicy.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.DiscardOldestPolicy.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.DiscardPolicy.html

tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/tomcat/util/threads/ThreadPoolExecutor.RejectedExecutionHandler.html

Added: 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.html?rev=1893319=auto
==
--- 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.html
 (added)
+++ 
tomcat/site/trunk/docs/tomcat-9.0-doc/api/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.html
 Mon Sep 13 18:58:18 2021
@@ -0,0 +1,759 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+
+
+
+DataSourceUserDatabaseMBean (Apache Tomcat 9.0.53 API 
Documentation)
+
+
+
+
+<!--
+try {
+if (location.href.indexOf('is-external=true') == -1) {
+parent.document.title="DataSourceUserDatabaseMBean (Apache Tomcat 
9.0.53 API Documentation)";
+}
+}
+catch(err) {
+}
+//-->
+var methods = 
{"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10};
+var tabs = {65535:["t0","All Methods"],2:["t2","Instance 
Methods"],8:["t4","Concrete Methods"]};
+var altColor = "altColor";
+var rowColor = "rowColor";
+var tableTab = "tableTab";
+var activeTableTab = "activeTableTab";
+
+
+JavaScript is disabled on your browser.
+
+
+
+
+
+Skip navigation links
+
+
+
+
+Overview
+Package
+Class
+Tree
+Deprecated
+Index
+Help
+
+Apache Tomcat 9.0.53
+
+
+
+PrevClass
+NextClass
+
+
+Frames
+NoFrames
+
+
+AllClasses
+
+
+<!--
+  allClassesLink = document.getElementById("allclasses_navbar_top");
+  if(window==top) {
+allClassesLink.style.display = "block";
+  }
+  else {
+allClassesLink.style.display = "none";
+  }
+  //-->
+
+
+
+
+Summary:
+Nested|
+Field|
+Constr|
+Method
+
+
+Detail:
+Field|
+Constr|
+Method
+
+
+
+
+
+
+
+
+org.apache.catalina.mbeans
+Class 
DataSourceUserDatabaseMBean
+
+
+
+https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true;
 title="class or interface in java.lang">java.lang.Object
+
+
+org.apache.tomcat.util.modeler.BaseModelMBean
+
+
+org.apache.catalina.mbeans.DataSourceUserDatabaseMBean
+
+
+
+
+
+
+
+
+
+All Implemented Interfaces:
+https://docs.oracle.com/javase/8/docs/api/javax/management/DynamicMBean.html?is-external=true;
 title="class or interface in javax.management">DynamicMBean, https://docs.oracle.com/javase/8/docs/api/javax/management/MBeanRegistration.html?is-external=true;
 title="class or interface in javax.management">MBeanRegistration, https://docs.oracle.com/javase/8/docs/api/javax/management/modelmbean/ModelMBeanNotificationBroadcaster.html?is-external=true;
 title="class or interface in 
javax.management.modelmbean">ModelMBeanNotificationBroadcaster, https://docs.oracle.com/javase/8/docs/api/javax/management/NotificationBroadcaster.html?is-e

svn commit: r1893318 - in /tomcat/site/trunk/docs/tomcat-9.0-doc: ./ annotationapi/ annotationapi/javax/annotation/ annotationapi/javax/annotation/security/ annotationapi/javax/annotation/sql/ api/ ap

2021-09-13 Thread remm
Author: remm
Date: Mon Sep 13 18:56:52 2021
New Revision: 1893318

URL: http://svn.apache.org/viewvc?rev=1893318=rev
Log:
Update docs for Tomcat 9.0.53


[This commit notification would consist of 107 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r49864 - /dev/tomcat/tomcat-9/v9.0.53/ /release/tomcat/tomcat-9/v9.0.53/

2021-09-10 Thread remm
Author: remm
Date: Fri Sep 10 07:18:16 2021
New Revision: 49864

Log:
Tomcat 9.0.53

Added:
release/tomcat/tomcat-9/v9.0.53/
  - copied from r49863, dev/tomcat/tomcat-9/v9.0.53/
Removed:
dev/tomcat/tomcat-9/v9.0.53/


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Use DataSource in DataSourceUserDatabase constructor

2021-09-09 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new c177e9d  Use DataSource in DataSourceUserDatabase constructor
c177e9d is described below

commit c177e9dadf9e1438da5649116a4dd5d45ad403d1
Author: remm 
AuthorDate: Thu Sep 9 11:38:23 2021 +0200

Use DataSource in DataSourceUserDatabase constructor

Easy to do since there's no support for a local DataSource.
Also allows much easier and complete testing since a JNDI environment is
no longer needed.
---
 .../apache/catalina/users/DataSourceUserDatabase.java| 16 
 .../catalina/users/DataSourceUserDatabaseFactory.java| 14 ++
 java/org/apache/catalina/users/mbeans-descriptors.xml|  3 ++-
 webapps/docs/changelog.xml   |  8 
 4 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 99cf584..01f6718 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import javax.naming.Context;
 import javax.sql.DataSource;
 
 import org.apache.catalina.Group;
@@ -45,16 +44,16 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 private static final Log log = 
LogFactory.getLog(DataSourceUserDatabase.class);
 private static final StringManager sm = 
StringManager.getManager(DataSourceUserDatabase.class);
 
-public DataSourceUserDatabase(Context namingContext, String id) {
-this.namingContext = namingContext;
+public DataSourceUserDatabase(DataSource dataSource, String id) {
+this.dataSource = dataSource;
 this.id = id;
 }
 
 
 /**
- * Associated naming context (will be used to bet the DataSource).
+ * DataSource to use.
  */
-protected final Context namingContext;
+protected final DataSource dataSource;
 
 
 /**
@@ -243,7 +242,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  * @param dataSourceName the name of the JNDI JDBC DataSource
  */
 public void setDataSourceName(String dataSourceName) {
-  this.dataSourceName = dataSourceName;
+this.dataSourceName = dataSourceName;
 }
 
 /**
@@ -1509,9 +1508,10 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  * @return Connection to the database
  */
 protected Connection openConnection() {
+if (dataSource == null) {
+return null;
+}
 try {
-Context context = namingContext;
-DataSource dataSource = (DataSource) 
context.lookup(dataSourceName);
 Connection connection = dataSource.getConnection();
 connectionSuccess = true;
 return connection;
diff --git a/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java 
b/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
index d288eff..1a69b7f 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
@@ -24,6 +24,7 @@ import javax.naming.Name;
 import javax.naming.RefAddr;
 import javax.naming.Reference;
 import javax.naming.spi.ObjectFactory;
+import javax.sql.DataSource;
 
 
 /**
@@ -78,16 +79,21 @@ public class DataSourceUserDatabaseFactory implements 
ObjectFactory {
 return null;
 }
 
-// Create and configure a MemoryUserDDataSourceUserDatabaseatabase 
instance based on the
-// RefAddr values associated with this Reference
-DataSourceUserDatabase database = new DataSourceUserDatabase(nameCtx, 
name.toString());
+DataSource dataSource = null;
+String dataSourceName = null;
 RefAddr ra = null;
 
 ra = ref.get("dataSourceName");
 if (ra != null) {
-database.setDataSourceName(ra.getContent().toString());
+dataSourceName = ra.getContent().toString();
+dataSource = (DataSource) nameCtx.lookup(dataSourceName);
 }
 
+// Create and configure a DataSourceUserDatabase instance based on the
+// RefAddr values associated with this Reference
+DataSourceUserDatabase database = new 
DataSourceUserDatabase(dataSource, name.toString());
+database.setDataSourceName(dataSourceName);
+
 ra = ref.get("readonly");
 if (ra != null) {
 
database.setReadonly(Boolean.parseBoolean(ra.getContent().toString()));
diff --git a/java/org/apache/catalina/users/mbeans-des

[tomcat] branch 10.0.x updated: Use DataSource in DataSourceUserDatabase constructor

2021-09-09 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new b2dd7da  Use DataSource in DataSourceUserDatabase constructor
b2dd7da is described below

commit b2dd7da238028b9c1f63cf427df8de387863f306
Author: remm 
AuthorDate: Thu Sep 9 11:38:23 2021 +0200

Use DataSource in DataSourceUserDatabase constructor

Easy to do since there's no support for a local DataSource.
Also allows much easier and complete testing since a JNDI environment is
no longer needed.
---
 .../apache/catalina/users/DataSourceUserDatabase.java| 16 
 .../catalina/users/DataSourceUserDatabaseFactory.java| 14 ++
 java/org/apache/catalina/users/mbeans-descriptors.xml|  3 ++-
 webapps/docs/changelog.xml   |  8 
 4 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 99cf584..01f6718 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import javax.naming.Context;
 import javax.sql.DataSource;
 
 import org.apache.catalina.Group;
@@ -45,16 +44,16 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 private static final Log log = 
LogFactory.getLog(DataSourceUserDatabase.class);
 private static final StringManager sm = 
StringManager.getManager(DataSourceUserDatabase.class);
 
-public DataSourceUserDatabase(Context namingContext, String id) {
-this.namingContext = namingContext;
+public DataSourceUserDatabase(DataSource dataSource, String id) {
+this.dataSource = dataSource;
 this.id = id;
 }
 
 
 /**
- * Associated naming context (will be used to bet the DataSource).
+ * DataSource to use.
  */
-protected final Context namingContext;
+protected final DataSource dataSource;
 
 
 /**
@@ -243,7 +242,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  * @param dataSourceName the name of the JNDI JDBC DataSource
  */
 public void setDataSourceName(String dataSourceName) {
-  this.dataSourceName = dataSourceName;
+this.dataSourceName = dataSourceName;
 }
 
 /**
@@ -1509,9 +1508,10 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  * @return Connection to the database
  */
 protected Connection openConnection() {
+if (dataSource == null) {
+return null;
+}
 try {
-Context context = namingContext;
-DataSource dataSource = (DataSource) 
context.lookup(dataSourceName);
 Connection connection = dataSource.getConnection();
 connectionSuccess = true;
 return connection;
diff --git a/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java 
b/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
index d288eff..1a69b7f 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
@@ -24,6 +24,7 @@ import javax.naming.Name;
 import javax.naming.RefAddr;
 import javax.naming.Reference;
 import javax.naming.spi.ObjectFactory;
+import javax.sql.DataSource;
 
 
 /**
@@ -78,16 +79,21 @@ public class DataSourceUserDatabaseFactory implements 
ObjectFactory {
 return null;
 }
 
-// Create and configure a MemoryUserDDataSourceUserDatabaseatabase 
instance based on the
-// RefAddr values associated with this Reference
-DataSourceUserDatabase database = new DataSourceUserDatabase(nameCtx, 
name.toString());
+DataSource dataSource = null;
+String dataSourceName = null;
 RefAddr ra = null;
 
 ra = ref.get("dataSourceName");
 if (ra != null) {
-database.setDataSourceName(ra.getContent().toString());
+dataSourceName = ra.getContent().toString();
+dataSource = (DataSource) nameCtx.lookup(dataSourceName);
 }
 
+// Create and configure a DataSourceUserDatabase instance based on the
+// RefAddr values associated with this Reference
+DataSourceUserDatabase database = new 
DataSourceUserDatabase(dataSource, name.toString());
+database.setDataSourceName(dataSourceName);
+
 ra = ref.get("readonly");
 if (ra != null) {
 
database.setReadonly(Boolean.parseBoolean(ra.getContent().toString()));
diff --git a/java/org/apache/catalina/users/mbean

[tomcat] branch main updated: Use DataSource in DataSourceUserDatabase constructor

2021-09-09 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 878caf6  Use DataSource in DataSourceUserDatabase constructor
878caf6 is described below

commit 878caf69ca333929b31ed821c2a7f2593e785495
Author: remm 
AuthorDate: Thu Sep 9 11:38:23 2021 +0200

Use DataSource in DataSourceUserDatabase constructor

Easy to do since there's no support for a local DataSource.
Also allows much easier and complete testing since a JNDI environment is
no longer needed.
---
 .../apache/catalina/users/DataSourceUserDatabase.java| 16 
 .../catalina/users/DataSourceUserDatabaseFactory.java| 14 ++
 java/org/apache/catalina/users/mbeans-descriptors.xml|  3 ++-
 webapps/docs/changelog.xml   |  8 
 4 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 99cf584..01f6718 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
-import javax.naming.Context;
 import javax.sql.DataSource;
 
 import org.apache.catalina.Group;
@@ -45,16 +44,16 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 private static final Log log = 
LogFactory.getLog(DataSourceUserDatabase.class);
 private static final StringManager sm = 
StringManager.getManager(DataSourceUserDatabase.class);
 
-public DataSourceUserDatabase(Context namingContext, String id) {
-this.namingContext = namingContext;
+public DataSourceUserDatabase(DataSource dataSource, String id) {
+this.dataSource = dataSource;
 this.id = id;
 }
 
 
 /**
- * Associated naming context (will be used to bet the DataSource).
+ * DataSource to use.
  */
-protected final Context namingContext;
+protected final DataSource dataSource;
 
 
 /**
@@ -243,7 +242,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  * @param dataSourceName the name of the JNDI JDBC DataSource
  */
 public void setDataSourceName(String dataSourceName) {
-  this.dataSourceName = dataSourceName;
+this.dataSourceName = dataSourceName;
 }
 
 /**
@@ -1509,9 +1508,10 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  * @return Connection to the database
  */
 protected Connection openConnection() {
+if (dataSource == null) {
+return null;
+}
 try {
-Context context = namingContext;
-DataSource dataSource = (DataSource) 
context.lookup(dataSourceName);
 Connection connection = dataSource.getConnection();
 connectionSuccess = true;
 return connection;
diff --git a/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java 
b/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
index d288eff..1a69b7f 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabaseFactory.java
@@ -24,6 +24,7 @@ import javax.naming.Name;
 import javax.naming.RefAddr;
 import javax.naming.Reference;
 import javax.naming.spi.ObjectFactory;
+import javax.sql.DataSource;
 
 
 /**
@@ -78,16 +79,21 @@ public class DataSourceUserDatabaseFactory implements 
ObjectFactory {
 return null;
 }
 
-// Create and configure a MemoryUserDDataSourceUserDatabaseatabase 
instance based on the
-// RefAddr values associated with this Reference
-DataSourceUserDatabase database = new DataSourceUserDatabase(nameCtx, 
name.toString());
+DataSource dataSource = null;
+String dataSourceName = null;
 RefAddr ra = null;
 
 ra = ref.get("dataSourceName");
 if (ra != null) {
-database.setDataSourceName(ra.getContent().toString());
+dataSourceName = ra.getContent().toString();
+dataSource = (DataSource) nameCtx.lookup(dataSourceName);
 }
 
+// Create and configure a DataSourceUserDatabase instance based on the
+// RefAddr values associated with this Reference
+DataSourceUserDatabase database = new 
DataSourceUserDatabase(dataSource, name.toString());
+database.setDataSourceName(dataSourceName);
+
 ra = ref.get("readonly");
 if (ra != null) {
 
database.setReadonly(Boolean.parseBoolean(ra.getContent().toString()));
diff --git a/java/org/apache/catalina/users/mbeans-des

svn commit: r49788 - in /dev/tomcat/tomcat-9/v9.0.53/bin: apache-tomcat-9.0.53.tar.gz.asc apache-tomcat-9.0.53.zip.asc

2021-09-07 Thread remm
Author: remm
Date: Tue Sep  7 07:07:05 2021
New Revision: 49788

Log:
Add missing signatures, that were not created by build.xml

Added:
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz.asc   (with 
props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.zip.asc   (with props)

Added: dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz.asc
==
Binary file - no diff available.

Propchange: dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz.asc
--
svn:mime-type = application/pgp-signature

Added: dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.zip.asc
==
Binary file - no diff available.

Propchange: dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.zip.asc
--
svn:mime-type = application/pgp-signature



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r49786 - in /dev/tomcat/tomcat-9/v9.0.53: ./ bin/ bin/embed/ src/

2021-09-06 Thread remm
Author: remm
Date: Mon Sep  6 19:16:15 2021
New Revision: 49786

Log:
Upload 9.0.53 for voting

Added:
dev/tomcat/tomcat-9/v9.0.53/
dev/tomcat/tomcat-9/v9.0.53/KEYS
dev/tomcat/tomcat-9/v9.0.53/README.html
dev/tomcat/tomcat-9/v9.0.53/RELEASE-NOTES
dev/tomcat/tomcat-9/v9.0.53/bin/
dev/tomcat/tomcat-9/v9.0.53/bin/README.html
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-deployer.tar.gz   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-deployer.tar.gz.asc   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-deployer.tar.gz.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-deployer.zip   (with 
props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-deployer.zip.asc   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-deployer.zip.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-fulldocs.tar.gz   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-fulldocs.tar.gz.asc   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-fulldocs.tar.gz.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-windows-x64.zip   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-windows-x64.zip.asc   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-windows-x64.zip.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-windows-x86.zip   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-windows-x86.zip.asc   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53-windows-x86.zip.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.exe   (with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.exe.asc   (with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.exe.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz   (with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.tar.gz.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.zip   (with props)
dev/tomcat/tomcat-9/v9.0.53/bin/apache-tomcat-9.0.53.zip.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/embed/
dev/tomcat/tomcat-9/v9.0.53/bin/embed/apache-tomcat-9.0.53-embed.tar.gz   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/embed/apache-tomcat-9.0.53-embed.tar.gz.asc 
  (with props)

dev/tomcat/tomcat-9/v9.0.53/bin/embed/apache-tomcat-9.0.53-embed.tar.gz.sha512
dev/tomcat/tomcat-9/v9.0.53/bin/embed/apache-tomcat-9.0.53-embed.zip   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/embed/apache-tomcat-9.0.53-embed.zip.asc   
(with props)
dev/tomcat/tomcat-9/v9.0.53/bin/embed/apache-tomcat-9.0.53-embed.zip.sha512
dev/tomcat/tomcat-9/v9.0.53/src/
dev/tomcat/tomcat-9/v9.0.53/src/apache-tomcat-9.0.53-src.tar.gz   (with 
props)
dev/tomcat/tomcat-9/v9.0.53/src/apache-tomcat-9.0.53-src.tar.gz.asc   (with 
props)
dev/tomcat/tomcat-9/v9.0.53/src/apache-tomcat-9.0.53-src.tar.gz.sha512
dev/tomcat/tomcat-9/v9.0.53/src/apache-tomcat-9.0.53-src.zip   (with props)
dev/tomcat/tomcat-9/v9.0.53/src/apache-tomcat-9.0.53-src.zip.asc   (with 
props)
dev/tomcat/tomcat-9/v9.0.53/src/apache-tomcat-9.0.53-src.zip.sha512

Added: dev/tomcat/tomcat-9/v9.0.53/KEYS
==
--- dev/tomcat/tomcat-9/v9.0.53/KEYS (added)
+++ dev/tomcat/tomcat-9/v9.0.53/KEYS Mon Sep  6 19:16:15 2021
@@ -0,0 +1,736 @@
+This file contains the PGP keys of various Apache developers.
+Please don't use them for email unless you have to. Their main
+purpose is code signing.
+
+Apache users: pgp < KEYS
+Apache developers:
+(pgpk -ll  && pgpk -xa ) >> this file.
+  or
+(gpg --fingerprint --list-sigs 
+ && gpg --armor --export ) >> this file.
+
+Apache developers: please ensure that your key is also available via the
+PGP keyservers (such as pgpkeys.mit.edu).
+
+
+Type Bits/KeyIDDate   User ID
+pub  2048/F22C4FED 2001/07/02 Andy Armstrong 
+
+-BEGIN PGP PUBLIC KEY BLOCK-
+Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
+
+mQGiBDtAWuURBADZ0KUEyUkSUiTA09e7tvEbX25STsjxrR+DNTainCls+XlkVOij
+gBv216lqge9tIsS0L6hCP4OQbFf/64qVtJssX4QXdyiZGb5wpmcj0Mz602Ew8r+N
+I0S5NvmogoYWW7BlP4r61jNxO5zrr03KaijM5r4ipJdLUxyOmM6P2jRPUwCg/5gm
+bpqiYl7pXX5FgDeB36tmD+UD/06iLqOnoiKO0vMbOk7URclhCObMNrHqxTxozMTS
+B9soYURbIeArei+plYo2n+1qB12ayybjhVu3uksXRdT9bEkyxMfslvLbIpDAG8Cz
+gNftTbKx/MVS7cQU0II8BKo2Akr+1FZah+sD4ovK8SfkMXUQUbTeefTntsAQKyyU
+9M9tA/9on9tBiHFl0qVJht6N4GiJ2G689v7rS2giLgKjetjiCduxBXEgvUSuyQID
+nF9ATrpXjITwsRlGKFmpZiFm5oCeCXihIVH0u6q066xNW2AXkLVoJ1l1Rs2Z0lsb
+0cq3xEAcwAmYLKQvCtgDV8CYgWKVmPi+49rSuQn7Lo9l02OUbLQgQW5keSBBcm1z
+dHJvbmcgPGFuZHlAdGFnaXNoLmNvbT6JAFgEEBECABgFAjtAWuUICwMJCAcCAQoC
+GQEFGwMACgkQajrT9PIsT+1plgCfXAovWnVL3MjrTfcGlFSKw7GHCSYAoJkz
+x+r2ANe8/0e+u5ZcYtSaSry+uQI

[tomcat] branch 9.0.x updated: Increment version for next development cycle

2021-09-06 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new a059112  Increment version for next development cycle
a059112 is described below

commit a05911219f828c9d0b51f52005e7edf1f07cc560
Author: remm 
AuthorDate: Mon Sep 6 21:07:16 2021 +0200

Increment version for next development cycle
---
 build.properties.default | 2 +-
 res/maven/mvn.properties.default | 2 +-
 webapps/docs/changelog.xml   | 4 +++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index 0724e67..489a7c0 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -25,7 +25,7 @@
 # - Version Control Flags -
 version.major=9
 version.minor=0
-version.build=53
+version.build=54
 version.patch=0
 version.suffix=-dev
 
diff --git a/res/maven/mvn.properties.default b/res/maven/mvn.properties.default
index 84befb6..a56b70c 100644
--- a/res/maven/mvn.properties.default
+++ b/res/maven/mvn.properties.default
@@ -39,7 +39,7 @@ 
maven.asf.release.repo.url=https://repository.apache.org/service/local/staging/d
 maven.asf.release.repo.repositoryId=apache.releases.https
 
 # Release version info
-maven.asf.release.deploy.version=9.0.53
+maven.asf.release.deploy.version=9.0.54
 
 #Where do we load the libraries from
 tomcat.lib.path=../../output/build/lib
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0a411c5..4c023be 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -104,7 +104,9 @@
   They eventually become mixed with the numbered issues (i.e., numbered
   issues do not "pop up" wrt. others).
 -->
-
+
+
+
   
 
   

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/01: Tag 9.0.53

2021-09-06 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to tag 9.0.53
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 966ec5401970b9d4b41b53f5fff9f65966d887dd
Author: remm 
AuthorDate: Mon Sep 6 20:59:11 2021 +0200

Tag 9.0.53
---
 build.properties.default   | 2 +-
 webapps/docs/changelog.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index 0724e67..a17a152 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -27,7 +27,7 @@ version.major=9
 version.minor=0
 version.build=53
 version.patch=0
-version.suffix=-dev
+version.suffix=
 
 # - Reproducible builds -
 # Uncomment and set to current time for reproducible builds
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0a411c5..4df0c67 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -104,7 +104,7 @@
   They eventually become mixed with the numbered issues (i.e., numbered
   issues do not "pop up" wrt. others).
 -->
-
+
   
 
   

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] tag 9.0.53 created (now 966ec54)

2021-09-06 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to tag 9.0.53
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


  at 966ec54  (commit)
This tag includes the following new commits:

 new 966ec54  Tag 9.0.53

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Update timestamp

2021-09-06 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new f56d52a  Update timestamp
f56d52a is described below

commit f56d52a07a59b3ac96800b8de91a4fd0f7f2f4d5
Author: remm 
AuthorDate: Mon Sep 6 20:57:31 2021 +0200

Update timestamp
---
 build.properties.default | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index 92e2c9e..0724e67 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -32,8 +32,8 @@ version.suffix=-dev
 # - Reproducible builds -
 # Uncomment and set to current time for reproducible builds
 # Note: The value is in seconds (unlike milliseconds used by 
System.currentTimeMillis()).
-#2021-07-29T12:00:00Z
-#ant.tstamp.now=162756
+#2021-09-06T12:00:00Z
+#ant.tstamp.now=1630929600
 
 # - Source control flags -
 git.branch=9.0.x

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Fix docs inconsistencies

2021-09-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new cf29253  Fix docs inconsistencies
cf29253 is described below

commit cf29253074d82c954a96cf3d75df56f256f94e8e
Author: remm 
AuthorDate: Fri Sep 3 16:19:18 2021 +0200

Fix docs inconsistencies
---
 webapps/docs/config/realm.xml |  3 +++
 webapps/docs/realm-howto.xml  | 20 ++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/webapps/docs/config/realm.xml b/webapps/docs/config/realm.xml
index 4f6569e..51f586d 100644
--- a/webapps/docs/config/realm.xml
+++ b/webapps/docs/config/realm.xml
@@ -670,6 +670,9 @@
 This allows using a static Principal instance
 disconnected from the database if needed. This makes the bahavior of
 authenticated prinicipals equivalent to that of the other realms.
+If there is a plan to use serialization, it is best to set this to
+true as the principal will always be replaced by this
+equivalent static principal when serializing.
 If not specified, the default is false: use a
 Principal connected to the UserDatabase.
   
diff --git a/webapps/docs/realm-howto.xml b/webapps/docs/realm-howto.xml
index 2a358a8..5c68644 100644
--- a/webapps/docs/realm-howto.xml
+++ b/webapps/docs/realm-howto.xml
@@ -811,8 +811,8 @@ configuration documentation.
 
 User File Format
 
-The users file uses the same format as the
-MemoryRealm.
+For the XML file based UserDatabase, the users file uses the
+same format as the MemoryRealm.
 
 Example
 
@@ -838,12 +838,20 @@ to all virtual hosts and web applications.  The default 
contents of the
 When a user attempts to access a protected resource for the first time,
 Tomcat will call the authenticate() method of this
 Realm.
-Once a user has been authenticated, the user (and their associated
-roles) are cached within Tomcat for the duration of the user's login.
+Once a user has been authenticated, the user becomes associated within
+Tomcat for the duration of the user's login.
 (For FORM-based authentication, that means until the session times out or
 is invalidated; for BASIC authentication, that means until the user
-closes their browser).  The cached user is not saved and
-restored across sessions serialisations.
+closes their browser). However, the user roles will still reflect the
+UserDatabase contents, unlike for the other realms. If a user
+is removed from the database, it will be considered to have no roles.
+The useStaticPrincipal attribute of the
+UserDatabaseRealm can be used to instead cache the user along
+with all its roles. The cached user is not saved and
+restored across sessions serialisations. When the user's principal object
+is serialized for any reason, it will also be replaced by a static
+equivalent object with roles that will no longer reflect the databse
+contents.
 
 
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Fix docs inconsistencies

2021-09-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 312b8b7  Fix docs inconsistencies
312b8b7 is described below

commit 312b8b7c648ceb9851c1afe0e2a2cd93c99dc391
Author: remm 
AuthorDate: Fri Sep 3 16:19:18 2021 +0200

Fix docs inconsistencies
---
 webapps/docs/config/realm.xml |  3 +++
 webapps/docs/realm-howto.xml  | 20 ++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/webapps/docs/config/realm.xml b/webapps/docs/config/realm.xml
index 32c28b0..76e00ef 100644
--- a/webapps/docs/config/realm.xml
+++ b/webapps/docs/config/realm.xml
@@ -670,6 +670,9 @@
 This allows using a static Principal instance
 disconnected from the database if needed. This makes the bahavior of
 authenticated prinicipals equivalent to that of the other realms.
+If there is a plan to use serialization, it is best to set this to
+true as the principal will always be replaced by this
+equivalent static principal when serializing.
 If not specified, the default is false: use a
 Principal connected to the UserDatabase.
   
diff --git a/webapps/docs/realm-howto.xml b/webapps/docs/realm-howto.xml
index 9f19c6d..d03291c 100644
--- a/webapps/docs/realm-howto.xml
+++ b/webapps/docs/realm-howto.xml
@@ -809,8 +809,8 @@ configuration documentation.
 
 User File Format
 
-The users file uses the same format as the
-MemoryRealm.
+For the XML file based UserDatabase, the users file uses the
+same format as the MemoryRealm.
 
 Example
 
@@ -836,12 +836,20 @@ to all virtual hosts and web applications.  The default 
contents of the
 When a user attempts to access a protected resource for the first time,
 Tomcat will call the authenticate() method of this
 Realm.
-Once a user has been authenticated, the user (and their associated
-roles) are cached within Tomcat for the duration of the user's login.
+Once a user has been authenticated, the user becomes associated within
+Tomcat for the duration of the user's login.
 (For FORM-based authentication, that means until the session times out or
 is invalidated; for BASIC authentication, that means until the user
-closes their browser).  The cached user is not saved and
-restored across sessions serialisations.
+closes their browser). However, the user roles will still reflect the
+UserDatabase contents, unlike for the other realms. If a user
+is removed from the database, it will be considered to have no roles.
+The useStaticPrincipal attribute of the
+UserDatabaseRealm can be used to instead cache the user along
+with all its roles. The cached user is not saved and
+restored across sessions serialisations. When the user's principal object
+is serialized for any reason, it will also be replaced by a static
+equivalent object with roles that will no longer reflect the databse
+contents.
 
 
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Fix docs inconsistencies

2021-09-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 92ccdb3  Fix docs inconsistencies
92ccdb3 is described below

commit 92ccdb339fff3e3e06d57fd28389ceb9ad9cecf1
Author: remm 
AuthorDate: Fri Sep 3 16:19:18 2021 +0200

Fix docs inconsistencies
---
 webapps/docs/config/realm.xml |  3 +++
 webapps/docs/realm-howto.xml  | 20 ++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/webapps/docs/config/realm.xml b/webapps/docs/config/realm.xml
index 32c28b0..76e00ef 100644
--- a/webapps/docs/config/realm.xml
+++ b/webapps/docs/config/realm.xml
@@ -670,6 +670,9 @@
 This allows using a static Principal instance
 disconnected from the database if needed. This makes the bahavior of
 authenticated prinicipals equivalent to that of the other realms.
+If there is a plan to use serialization, it is best to set this to
+true as the principal will always be replaced by this
+equivalent static principal when serializing.
 If not specified, the default is false: use a
 Principal connected to the UserDatabase.
   
diff --git a/webapps/docs/realm-howto.xml b/webapps/docs/realm-howto.xml
index 9f19c6d..d03291c 100644
--- a/webapps/docs/realm-howto.xml
+++ b/webapps/docs/realm-howto.xml
@@ -809,8 +809,8 @@ configuration documentation.
 
 User File Format
 
-The users file uses the same format as the
-MemoryRealm.
+For the XML file based UserDatabase, the users file uses the
+same format as the MemoryRealm.
 
 Example
 
@@ -836,12 +836,20 @@ to all virtual hosts and web applications.  The default 
contents of the
 When a user attempts to access a protected resource for the first time,
 Tomcat will call the authenticate() method of this
 Realm.
-Once a user has been authenticated, the user (and their associated
-roles) are cached within Tomcat for the duration of the user's login.
+Once a user has been authenticated, the user becomes associated within
+Tomcat for the duration of the user's login.
 (For FORM-based authentication, that means until the session times out or
 is invalidated; for BASIC authentication, that means until the user
-closes their browser).  The cached user is not saved and
-restored across sessions serialisations.
+closes their browser). However, the user roles will still reflect the
+UserDatabase contents, unlike for the other realms. If a user
+is removed from the database, it will be considered to have no roles.
+The useStaticPrincipal attribute of the
+UserDatabaseRealm can be used to instead cache the user along
+with all its roles. The cached user is not saved and
+restored across sessions serialisations. When the user's principal object
+is serialized for any reason, it will also be replaced by a static
+equivalent object with roles that will no longer reflect the databse
+contents.
 
 
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Rename method for consistency

2021-09-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 2007f9c  Rename method for consistency
2007f9c is described below

commit 2007f9ca8734eb668984b10447931af913d3f4b2
Author: remm 
AuthorDate: Fri Sep 3 10:27:16 2021 +0200

Rename method for consistency
---
 .../apache/catalina/users/DataSourceUserDatabase.java   | 17 +
 .../catalina/users/DataSourceUserDatabaseTests.java |  2 +-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index ec44e8b..99cf584 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -74,6 +74,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 protected final ConcurrentHashMap modifiedRoles = new 
ConcurrentHashMap<>();
 protected final ConcurrentHashMap removedRoles = new 
ConcurrentHashMap<>();
 
+
 // - Instance Variables
 
 
@@ -470,7 +471,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return groups.values().iterator();
@@ -506,7 +507,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return roles.values().iterator();
@@ -542,7 +543,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return users.values().iterator();
@@ -623,7 +624,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findGroupInternal(dbConnection, groupname);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } else {
 return null;
@@ -697,7 +698,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findRoleInternal(dbConnection, rolename);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } else {
 return null;
@@ -750,7 +751,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findUserInternal(dbConnection, username);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } finally {
 readLock.unlock();
@@ -1033,7 +1034,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 saveInternal(dbConnection);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } finally {
 writeLock.unlock();
@@ -1527,7 +1528,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  *
  * @param dbConnection The connection to be closed
  */
-protected void close(Connection dbConnection) {
+protected void closeConnection(Connection dbConnection) {
 
 // Do nothing if the database connection is already closed
 if (dbConnection == null) {
diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
index 55194e1..0defa39 100644
--- a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -89,7 +89,7 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 return connection;
 }
 @Override
-protected void close(Connection dbConnection) {
+protected void closeConnection(Connection dbConnection) {

[tomcat] branch 10.0.x updated: Rename method for consistency

2021-09-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 9039b4d  Rename method for consistency
9039b4d is described below

commit 9039b4dcc56bf172d947d47cc1e6065d78e1b222
Author: remm 
AuthorDate: Fri Sep 3 10:27:16 2021 +0200

Rename method for consistency
---
 .../apache/catalina/users/DataSourceUserDatabase.java   | 17 +
 .../catalina/users/DataSourceUserDatabaseTests.java |  2 +-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index ec44e8b..99cf584 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -74,6 +74,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 protected final ConcurrentHashMap modifiedRoles = new 
ConcurrentHashMap<>();
 protected final ConcurrentHashMap removedRoles = new 
ConcurrentHashMap<>();
 
+
 // - Instance Variables
 
 
@@ -470,7 +471,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return groups.values().iterator();
@@ -506,7 +507,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return roles.values().iterator();
@@ -542,7 +543,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return users.values().iterator();
@@ -623,7 +624,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findGroupInternal(dbConnection, groupname);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } else {
 return null;
@@ -697,7 +698,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findRoleInternal(dbConnection, rolename);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } else {
 return null;
@@ -750,7 +751,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findUserInternal(dbConnection, username);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } finally {
 readLock.unlock();
@@ -1033,7 +1034,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 saveInternal(dbConnection);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } finally {
 writeLock.unlock();
@@ -1527,7 +1528,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  *
  * @param dbConnection The connection to be closed
  */
-protected void close(Connection dbConnection) {
+protected void closeConnection(Connection dbConnection) {
 
 // Do nothing if the database connection is already closed
 if (dbConnection == null) {
diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
index 55194e1..0defa39 100644
--- a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -89,7 +89,7 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 return connection;
 }
 @Override
-protected void close(Connection dbConnection) {
+protected void closeConnection(Connection dbConnection) {
   

[tomcat] branch main updated: Rename method for consistency

2021-09-03 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 791b6af  Rename method for consistency
791b6af is described below

commit 791b6afdb3feb6e2a5c1b3b8fd92d4e8361271b4
Author: remm 
AuthorDate: Fri Sep 3 10:27:16 2021 +0200

Rename method for consistency
---
 .../apache/catalina/users/DataSourceUserDatabase.java   | 17 +
 .../catalina/users/DataSourceUserDatabaseTests.java |  2 +-
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index ec44e8b..99cf584 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -74,6 +74,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 protected final ConcurrentHashMap modifiedRoles = new 
ConcurrentHashMap<>();
 protected final ConcurrentHashMap removedRoles = new 
ConcurrentHashMap<>();
 
+
 // - Instance Variables
 
 
@@ -470,7 +471,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return groups.values().iterator();
@@ -506,7 +507,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return roles.values().iterator();
@@ -542,7 +543,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 } catch (SQLException e) {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 }
 return users.values().iterator();
@@ -623,7 +624,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findGroupInternal(dbConnection, groupname);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } else {
 return null;
@@ -697,7 +698,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findRoleInternal(dbConnection, rolename);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } else {
 return null;
@@ -750,7 +751,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 return findUserInternal(dbConnection, username);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } finally {
 readLock.unlock();
@@ -1033,7 +1034,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 try {
 saveInternal(dbConnection);
 } finally {
-close(dbConnection);
+closeConnection(dbConnection);
 }
 } finally {
 writeLock.unlock();
@@ -1527,7 +1528,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
  *
  * @param dbConnection The connection to be closed
  */
-protected void close(Connection dbConnection) {
+protected void closeConnection(Connection dbConnection) {
 
 // Do nothing if the database connection is already closed
 if (dbConnection == null) {
diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
index 55194e1..0defa39 100644
--- a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -89,7 +89,7 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 return connection;
 }
 @Override
-protected void close(Connection dbConnection) {
+protected void closeConnection(Connection dbConnection) {

[tomcat] branch 9.0.x updated: Tighten up for partial roles and groups configuration

2021-09-02 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 98075af  Tighten up for partial roles and groups configuration
98075af is described below

commit 98075af3745589d73e8278ccf7f8e3030a09b197
Author: remm 
AuthorDate: Thu Sep 2 11:33:14 2021 +0200

Tighten up for partial roles and groups configuration

Add debug log in open() that show the current feature in use, as there
are three levels and lots of configuration attributes.
Also harmonize some names.
---
 .../catalina/users/DataSourceUserDatabase.java | 243 +
 webapps/docs/jndi-resources-howto.xml  |  12 +-
 2 files changed, 155 insertions(+), 100 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 2c6eb5e..ec44e8b 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -110,7 +110,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the roles PreparedStatement
  */
-private String preparedRoles = null;
+private String preparedUserRoles = null;
 
 
 /**
@@ -122,7 +122,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the groups PreparedStatement
  */
-private String preparedGroups = null;
+private String preparedUserGroups = null;
 
 
 /**
@@ -615,15 +615,19 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 return null;
 }
 
-Connection dbConnection = openConnection();
-if (dbConnection == null) {
+if (isGroupStoreDefined()) {
+Connection dbConnection = openConnection();
+if (dbConnection == null) {
+return null;
+}
+try {
+return findGroupInternal(dbConnection, groupname);
+} finally {
+close(dbConnection);
+}
+} else {
 return null;
 }
-try {
-return findGroupInternal(dbConnection, groupname);
-} finally {
-close(dbConnection);
-}
 } finally {
 readLock.unlock();
 }
@@ -685,15 +689,19 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 return null;
 }
 
-Connection dbConnection = openConnection();
-if (dbConnection == null) {
+if (userRoleTable != null && roleNameCol != null) {
+Connection dbConnection = openConnection();
+if (dbConnection == null) {
+return null;
+}
+try {
+return findRoleInternal(dbConnection, rolename);
+} finally {
+close(dbConnection);
+}
+} else {
 return null;
 }
-try {
-return findRoleInternal(dbConnection, rolename);
-} finally {
-close(dbConnection);
-}
 } finally {
 readLock.unlock();
 }
@@ -773,7 +781,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 // Lookup groups
 ArrayList groups = new ArrayList<>();
 if (isGroupStoreDefined()) {
-try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedGroups)) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedUserGroups)) {
 stmt.setString(1, userName);
 try (ResultSet rs = stmt.executeQuery()) {
 while (rs.next()) {
@@ -792,8 +800,8 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 }
 
 ArrayList roles = new ArrayList<>();
-if (isRoleStoreDefined()) {
-try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedRoles)) {
+if (userRoleTable != null && roleNameCol != null) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedUserRoles)) {
 stmt.setString(1, userName);
 try (ResultSet rs = stmt.executeQuery()) {
 while (rs.next()) {
@@ -857,19 +865,45 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 @Override
 public void open() throws Exception {
 
+if (log.isDebugEnabled()) {
+// As there are lots of parameters to configure, log some debug to 
help out
+log.debug("DataS

[tomcat] branch 10.0.x updated: Tighten up for partial roles and groups configuration

2021-09-02 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new a1bd28d  Tighten up for partial roles and groups configuration
a1bd28d is described below

commit a1bd28d937053592d0a1a18e12f89694b2f65865
Author: remm 
AuthorDate: Thu Sep 2 11:33:14 2021 +0200

Tighten up for partial roles and groups configuration

Add debug log in open() that show the current feature in use, as there
are three levels and lots of configuration attributes.
Also harmonize some names.
---
 .../catalina/users/DataSourceUserDatabase.java | 243 +
 webapps/docs/jndi-resources-howto.xml  |  12 +-
 2 files changed, 155 insertions(+), 100 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 2c6eb5e..ec44e8b 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -110,7 +110,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the roles PreparedStatement
  */
-private String preparedRoles = null;
+private String preparedUserRoles = null;
 
 
 /**
@@ -122,7 +122,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the groups PreparedStatement
  */
-private String preparedGroups = null;
+private String preparedUserGroups = null;
 
 
 /**
@@ -615,15 +615,19 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 return null;
 }
 
-Connection dbConnection = openConnection();
-if (dbConnection == null) {
+if (isGroupStoreDefined()) {
+Connection dbConnection = openConnection();
+if (dbConnection == null) {
+return null;
+}
+try {
+return findGroupInternal(dbConnection, groupname);
+} finally {
+close(dbConnection);
+}
+} else {
 return null;
 }
-try {
-return findGroupInternal(dbConnection, groupname);
-} finally {
-close(dbConnection);
-}
 } finally {
 readLock.unlock();
 }
@@ -685,15 +689,19 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 return null;
 }
 
-Connection dbConnection = openConnection();
-if (dbConnection == null) {
+if (userRoleTable != null && roleNameCol != null) {
+Connection dbConnection = openConnection();
+if (dbConnection == null) {
+return null;
+}
+try {
+return findRoleInternal(dbConnection, rolename);
+} finally {
+close(dbConnection);
+}
+} else {
 return null;
 }
-try {
-return findRoleInternal(dbConnection, rolename);
-} finally {
-close(dbConnection);
-}
 } finally {
 readLock.unlock();
 }
@@ -773,7 +781,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 // Lookup groups
 ArrayList groups = new ArrayList<>();
 if (isGroupStoreDefined()) {
-try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedGroups)) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedUserGroups)) {
 stmt.setString(1, userName);
 try (ResultSet rs = stmt.executeQuery()) {
 while (rs.next()) {
@@ -792,8 +800,8 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 }
 
 ArrayList roles = new ArrayList<>();
-if (isRoleStoreDefined()) {
-try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedRoles)) {
+if (userRoleTable != null && roleNameCol != null) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedUserRoles)) {
 stmt.setString(1, userName);
 try (ResultSet rs = stmt.executeQuery()) {
 while (rs.next()) {
@@ -857,19 +865,45 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 @Override
 public void open() throws Exception {
 
+if (log.isDebugEnabled()) {
+// As there are lots of parameters to configure, log some debug to 
help out
+log.debug("

[tomcat] branch main updated: Tighten up for partial roles and groups configuration

2021-09-02 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new e1cef2c  Tighten up for partial roles and groups configuration
e1cef2c is described below

commit e1cef2cfc47982c947b5f23a8dae7c71cf1b979c
Author: remm 
AuthorDate: Thu Sep 2 11:33:14 2021 +0200

Tighten up for partial roles and groups configuration

Add debug log in open() that show the current feature in use, as there
are three levels and lots of configuration attributes.
Also harmonize some names.
---
 .../catalina/users/DataSourceUserDatabase.java | 243 +
 webapps/docs/jndi-resources-howto.xml  |  12 +-
 2 files changed, 155 insertions(+), 100 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index 2c6eb5e..ec44e8b 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -110,7 +110,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the roles PreparedStatement
  */
-private String preparedRoles = null;
+private String preparedUserRoles = null;
 
 
 /**
@@ -122,7 +122,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the groups PreparedStatement
  */
-private String preparedGroups = null;
+private String preparedUserGroups = null;
 
 
 /**
@@ -615,15 +615,19 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 return null;
 }
 
-Connection dbConnection = openConnection();
-if (dbConnection == null) {
+if (isGroupStoreDefined()) {
+Connection dbConnection = openConnection();
+if (dbConnection == null) {
+return null;
+}
+try {
+return findGroupInternal(dbConnection, groupname);
+} finally {
+close(dbConnection);
+}
+} else {
 return null;
 }
-try {
-return findGroupInternal(dbConnection, groupname);
-} finally {
-close(dbConnection);
-}
 } finally {
 readLock.unlock();
 }
@@ -685,15 +689,19 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 return null;
 }
 
-Connection dbConnection = openConnection();
-if (dbConnection == null) {
+if (userRoleTable != null && roleNameCol != null) {
+Connection dbConnection = openConnection();
+if (dbConnection == null) {
+return null;
+}
+try {
+return findRoleInternal(dbConnection, rolename);
+} finally {
+close(dbConnection);
+}
+} else {
 return null;
 }
-try {
-return findRoleInternal(dbConnection, rolename);
-} finally {
-close(dbConnection);
-}
 } finally {
 readLock.unlock();
 }
@@ -773,7 +781,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 // Lookup groups
 ArrayList groups = new ArrayList<>();
 if (isGroupStoreDefined()) {
-try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedGroups)) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedUserGroups)) {
 stmt.setString(1, userName);
 try (ResultSet rs = stmt.executeQuery()) {
 while (rs.next()) {
@@ -792,8 +800,8 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 }
 
 ArrayList roles = new ArrayList<>();
-if (isRoleStoreDefined()) {
-try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedRoles)) {
+if (userRoleTable != null && roleNameCol != null) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(preparedUserRoles)) {
 stmt.setString(1, userName);
 try (ResultSet rs = stmt.executeQuery()) {
 while (rs.next()) {
@@ -857,19 +865,45 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 @Override
 public void open() throws Exception {
 
+if (log.isDebugEnabled()) {
+// As there are lots of parameters to configure, log some debug to 
help out
+log.debug("DataS

[tomcat] branch 9.0.x updated: Cleanup derby.log

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 1cb9875  Cleanup derby.log
1cb9875 is described below

commit 1cb987588fd87cae166bb9abeba5c92aa1aea808
Author: remm 
AuthorDate: Wed Sep 1 17:02:11 2021 +0200

Cleanup derby.log
---
 test/org/apache/catalina/users/DataSourceUserDatabaseTests.java | 9 +
 1 file changed, 9 insertions(+)

diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
index 5529917..55194e1 100644
--- a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -16,11 +16,13 @@
  */
 package org.apache.catalina.users;
 
+import java.io.File;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.Statement;
 import java.util.Iterator;
 
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -109,6 +111,11 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 
 private DerbyUserDatabase db;
 
+@AfterClass
+public static void derbyCleanup() {
+System.out.println("Deleted derby.log: " + (new 
File("derby.log")).delete());
+}
+
 @Test
 public void testBasicUserRoleDatabase()
 throws Exception {
@@ -156,6 +163,7 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 Assert.assertFalse("Unexpected role for user", 
tomcatUser.isInRole(managerRole));
 
 db.close();
+
 }
 
 @Test
@@ -224,5 +232,6 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 Assert.assertTrue("No group for user", 
randomUser.isInGroup(userGroup));
 
 db.close();
+
 }
 }

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Cleanup derby.log

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 1b4b9d1  Cleanup derby.log
1b4b9d1 is described below

commit 1b4b9d12e9e46e3614fddfd9afff6b0915af492c
Author: remm 
AuthorDate: Wed Sep 1 17:02:11 2021 +0200

Cleanup derby.log
---
 test/org/apache/catalina/users/DataSourceUserDatabaseTests.java | 9 +
 1 file changed, 9 insertions(+)

diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
index 5529917..55194e1 100644
--- a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -16,11 +16,13 @@
  */
 package org.apache.catalina.users;
 
+import java.io.File;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.Statement;
 import java.util.Iterator;
 
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -109,6 +111,11 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 
 private DerbyUserDatabase db;
 
+@AfterClass
+public static void derbyCleanup() {
+System.out.println("Deleted derby.log: " + (new 
File("derby.log")).delete());
+}
+
 @Test
 public void testBasicUserRoleDatabase()
 throws Exception {
@@ -156,6 +163,7 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 Assert.assertFalse("Unexpected role for user", 
tomcatUser.isInRole(managerRole));
 
 db.close();
+
 }
 
 @Test
@@ -224,5 +232,6 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 Assert.assertTrue("No group for user", 
randomUser.isInGroup(userGroup));
 
 db.close();
+
 }
 }

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Cleanup derby.log

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new a4490a2  Cleanup derby.log
a4490a2 is described below

commit a4490a2af64308cfdd9cc92663fd390380aee1a2
Author: remm 
AuthorDate: Wed Sep 1 17:02:11 2021 +0200

Cleanup derby.log
---
 test/org/apache/catalina/users/DataSourceUserDatabaseTests.java | 9 +
 1 file changed, 9 insertions(+)

diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
index 5529917..55194e1 100644
--- a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -16,11 +16,13 @@
  */
 package org.apache.catalina.users;
 
+import java.io.File;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.Statement;
 import java.util.Iterator;
 
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -109,6 +111,11 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 
 private DerbyUserDatabase db;
 
+@AfterClass
+public static void derbyCleanup() {
+System.out.println("Deleted derby.log: " + (new 
File("derby.log")).delete());
+}
+
 @Test
 public void testBasicUserRoleDatabase()
 throws Exception {
@@ -156,6 +163,7 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 Assert.assertFalse("Unexpected role for user", 
tomcatUser.isInRole(managerRole));
 
 db.close();
+
 }
 
 @Test
@@ -224,5 +232,6 @@ public class DataSourceUserDatabaseTests extends 
LoggingBaseTest {
 Assert.assertTrue("No group for user", 
randomUser.isInGroup(userGroup));
 
 db.close();
+
 }
 }

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 06/16: Add lock use similar to the memory user database

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 9eff810ba36aefb79b92a5d916526bc2e75499a6
Author: remm 
AuthorDate: Thu Aug 26 16:40:44 2021 +0200

Add lock use similar to the memory user database

Remove duplicated code, I verified the memory MBean works fine.
---
 .../catalina/mbeans/MemoryUserDatabaseMBean.java   | 277 +--
 .../catalina/mbeans/SparseUserDatabaseMBean.java   |  59 +--
 .../catalina/users/DataSourceUserDatabase.java | 553 -
 3 files changed, 353 insertions(+), 536 deletions(-)

diff --git a/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java 
b/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
index b8fc248..7105cf8 100644
--- a/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
+++ b/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
@@ -16,21 +16,7 @@
  */
 package org.apache.catalina.mbeans;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.catalina.Group;
-import org.apache.catalina.Role;
-import org.apache.catalina.User;
-import org.apache.catalina.UserDatabase;
-import org.apache.tomcat.util.modeler.BaseModelMBean;
 import org.apache.tomcat.util.modeler.ManagedBean;
-import org.apache.tomcat.util.modeler.Registry;
-import org.apache.tomcat.util.res.StringManager;
 
 /**
  * A ModelMBean implementation for the
@@ -38,272 +24,11 @@ import org.apache.tomcat.util.res.StringManager;
  *
  * @author Craig R. McClanahan
  */
-public class MemoryUserDatabaseMBean extends BaseModelMBean {
-
-private static final StringManager sm = 
StringManager.getManager(MemoryUserDatabaseMBean.class);
-
-// - Instance Variables
-
-/**
- * The configuration information registry for our managed beans.
- */
-protected final Registry registry = MBeanUtils.createRegistry();
-
+public class MemoryUserDatabaseMBean extends SparseUserDatabaseMBean {
 
 /**
  * The ManagedBean information describing this MBean.
  */
 protected final ManagedBean managed = 
registry.findManagedBean("MemoryUserDatabase");
 
-
-/**
- * The ManagedBean information describing Group MBeans.
- */
-protected final ManagedBean managedGroup = 
registry.findManagedBean("Group");
-
-
-/**
- * The ManagedBean information describing Group MBeans.
- */
-protected final ManagedBean managedRole = registry.findManagedBean("Role");
-
-
-/**
- * The ManagedBean information describing User MBeans.
- */
-protected final ManagedBean managedUser = registry.findManagedBean("User");
-
-
-// - Attributes
-
-/**
- * @return the MBean Names of all groups defined in this database.
- */
-public String[] getGroups() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator groups = database.getGroups();
-while (groups.hasNext()) {
-Group group = groups.next();
-results.add(findGroup(group.getGroupname()));
-}
-return results.toArray(new String[0]);
-}
-
-
-/**
- * @return the MBean Names of all roles defined in this database.
- */
-public String[] getRoles() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator roles = database.getRoles();
-while (roles.hasNext()) {
-Role role = roles.next();
-results.add(findRole(role.getRolename()));
-}
-return results.toArray(new String[0]);
-}
-
-
-/**
- * @return the MBean Names of all users defined in this database.
- */
-public String[] getUsers() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator users = database.getUsers();
-while (users.hasNext()) {
-User user = users.next();
-results.add(findUser(user.getUsername()));
-}
-return results.toArray(new String[0]);
-}
-
-
-// - Operations
-
-/**
- * Create a new Group and return the corresponding MBean Name.
- *
- * @param groupname Group name of the new group
- * @param description Description of the new group
- * @return the new group object name
- */
-public String createGroup(String groupname, String description) {
-UserDatabase database = (UserDatabase) this.resource;
-Group group = database.createGroup(groupname, description)

[tomcat] 14/16: Use Derby 10.14 for Java 8 compatibility

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit e1d0a7d778dede41c815327a7022c4b5dcfd3507
Author: remm 
AuthorDate: Wed Sep 1 13:00:49 2021 +0200

Use Derby 10.14 for Java 8 compatibility
---
 build.properties.default   | 13 -
 build.xml  | 10 --
 webapps/docs/changelog.xml |  2 +-
 3 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index 80dd4fa..5d395ad 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -323,24 +323,19 @@ jsign.jar=${jsign.home}/jsign-${jsign.version}.jar
 
jsign.loc=${base-maven.loc}/net/jsign/jsign/${jsign.version}/jsign-${jsign.version}.jar
 
 # - Derby, used by unit tests -
-derby.version=10.15.2.0
+derby.version=10.14.2.0
 
-# checksums for Derby 10.15.2.0
+# checksums for Derby 10.14.2.0
 derby.checksum.enabled=true
 derby.checksum.algorithm=MD5|SHA-1
-derby.checksum.value=abff01351b19bc62a188bac08a8bb58b|b64da6681994f33ba5783ffae55cdb44885b9e70
-derby-shared.checksum.enabled=true
-derby-shared.checksum.algorithm=MD5|SHA-1
-derby-shared.checksum.value=2cb9ab8b9cfb06c2da5a1d3825d04344|ff2dfb3e2a92d593cf111baad242d156947abbc1
+derby.checksum.value=3ddcc1d435344d39d0122dbc2f39a746|7efad40ef52fbb1f08142f07a83b42d29e47d8ce
 derby-tools.checksum.enabled=true
 derby-tools.checksum.algorithm=MD5|SHA-1
-derby-tools.checksum.value=d41578eeb336b0e479be8f30bfd9ab9b|d63722381e0e893d797e4d531e219e2917898364
+derby-tools.checksum.value=3189a1d586f98f0d203fb5f3e5d88fbe|338d5a54b4089c80414fe0ecb3899d521da69b26
 
 derby.home=${base.path}/derby-${derby.version}
 derby.jar=${derby.home}/derby-${derby.version}.jar
 
derby.loc=${base-maven.loc}/org/apache/derby/derby/${derby.version}/derby-${derby.version}.jar
-derby-shared.jar=${derby.home}/derby-shared-${derby.version}.jar
-derby-shared.loc=${base-maven.loc}/org/apache/derby/derbyshared/${derby.version}/derbyshared-${derby.version}.jar
 derby-tools.jar=${derby.home}/derby-tools-${derby.version}.jar
 
derby-tools.loc=${base-maven.loc}/org/apache/derby/derbytools/${derby.version}/derbytools-${derby.version}.jar
 
diff --git a/build.xml b/build.xml
index 34301df..4566582 100644
--- a/build.xml
+++ b/build.xml
@@ -261,7 +261,6 @@
 
 
 
-
 
 
 
@@ -3260,15 +3259,6 @@ skip.installer property in build.properties" />
 
 
 
-  
-  
-  
-  
-  
-  
-
-
-
   
   
   
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4b2b413..aa5a111 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -210,7 +210,7 @@
   
 ===
   
-Add Apache Derby 10.15.2.0 to the testsuite dependencies, for JDBC
+Add Apache Derby 10.14.2.0 to the testsuite dependencies, for JDBC
 and DataSource testing. (remm)
   
 >>>>>>> 86177f0839 (Add Derby for the testsuite)

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 15/16: Checkstyle

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit e3cf4ac94ec30f3a5415efb9234f42bf061ad39e
Author: remm 
AuthorDate: Wed Sep 1 13:45:18 2021 +0200

Checkstyle
---
 java/org/apache/catalina/realm/UserDatabaseRealm.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/realm/UserDatabaseRealm.java 
b/java/org/apache/catalina/realm/UserDatabaseRealm.java
index 8269a60..822c807 100644
--- a/java/org/apache/catalina/realm/UserDatabaseRealm.java
+++ b/java/org/apache/catalina/realm/UserDatabaseRealm.java
@@ -202,7 +202,7 @@ public class UserDatabaseRealm extends RealmBase {
 return null;
 } else {
 if (useStaticPrincipal) {
-return new GenericPrincipal(username, null, 
Arrays.asList(getRoles(user))); 
+return new GenericPrincipal(username, null, 
Arrays.asList(getRoles(user)));
 } else {
 return new UserDatabasePrincipal(user, database);
 }

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 05/16: Fix compile

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit bbab0a61343d5a682c26dd652acac7ef0aa4def9
Author: remm 
AuthorDate: Wed Sep 1 13:41:29 2021 +0200

Fix compile
---
 java/org/apache/catalina/realm/UserDatabaseRealm.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/catalina/realm/UserDatabaseRealm.java 
b/java/org/apache/catalina/realm/UserDatabaseRealm.java
index ef072d6..8269a60 100644
--- a/java/org/apache/catalina/realm/UserDatabaseRealm.java
+++ b/java/org/apache/catalina/realm/UserDatabaseRealm.java
@@ -202,7 +202,7 @@ public class UserDatabaseRealm extends RealmBase {
 return null;
 } else {
 if (useStaticPrincipal) {
-return new GenericPrincipal(username, 
Arrays.asList(getRoles(user))); 
+return new GenericPrincipal(username, null, 
Arrays.asList(getRoles(user))); 
 } else {
 return new UserDatabasePrincipal(user, database);
 }

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 09/16: Fix IDE warnings. Use <> where possible.

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit ce75358df10c6b56771d446c378b636f8dc1b646
Author: Mark Thomas 
AuthorDate: Tue Aug 31 18:03:42 2021 +0100

Fix IDE warnings. Use <> where possible.
---
 java/org/apache/catalina/users/DataSourceUserDatabase.java | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index dbe1a69..a5bff3a 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -559,7 +559,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 public Group createGroup(String groupname, String description) {
 readLock.lock();
 try {
-Group group = new GenericGroup(this, 
groupname, description, null);
+Group group = new GenericGroup<>(this, groupname, description, 
null);
 createdGroups.put(groupname, group);
 modifiedGroups.remove(groupname);
 removedGroups.remove(groupname);
@@ -573,7 +573,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 public Role createRole(String rolename, String description) {
 readLock.lock();
 try {
-Role role = new GenericRole(this, 
rolename, description);
+Role role = new GenericRole<>(this, rolename, description);
 createdRoles.put(rolename, role);
 modifiedRoles.remove(rolename);
 removedRoles.remove(rolename);
@@ -587,7 +587,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 public User createUser(String username, String password, String fullName) {
 readLock.lock();
 try {
-User user = new GenericUser(this, 
username, password, fullName, null, null);
+User user = new GenericUser<>(this, username, password, fullName, 
null, null);
 createdUsers.put(username, user);
 modifiedUsers.remove(username);
 removedUsers.remove(username);
@@ -657,7 +657,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 }
 }
-group = new GenericGroup(this, 
groupName, description, groupRoles);
+group = new GenericGroup<>(this, groupName, 
description, groupRoles);
 }
 }
 }
@@ -707,7 +707,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 if (rs.next()) {
 if (rs.getString(1) != null) {
 String description = (roleAndGroupDescriptionCol != 
null) ? rs.getString(2) : null;
-role = new GenericRole(this, 
roleName, description);
+role = new GenericRole<>(this, roleName, description);
 }
 }
 }
@@ -811,8 +811,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 }
 }
 
-User user = new GenericUser(this, userName, 
dbCredentials,
-fullName, groups, roles);
+User user = new GenericUser<>(this, userName, dbCredentials, fullName, 
groups, roles);
 return user;
 }
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 16/16: Fix bad merge

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a63ed576610f1fe46b689f8e672cfb0255e08428
Author: remm 
AuthorDate: Wed Sep 1 13:47:17 2021 +0200

Fix bad merge
---
 webapps/docs/changelog.xml | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index aa5a111..abb2055 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -199,7 +199,6 @@
 Update to JSign version 4.0 to enable code signing without the need for
 the installation of additional client tools. (markt)
   
-<<<<<<< HEAD
   
 Update the internal fork of Apache Commons BCEL to 40d5eb4 (2021-09-01,
 6.6.0-SNAPSHOT). Code clean-up only. (markt)
@@ -208,12 +207,10 @@
 Update the internal fork of Apache Commons Codec to fd44e6b 
(2021-09-01,
 1.16-SNAPSHOT). Minor refactoring. (markt)
   
-===
   
 Add Apache Derby 10.14.2.0 to the testsuite dependencies, for JDBC
 and DataSource testing. (remm)
   
->>>>>>> 86177f0839 (Add Derby for the testsuite)
 
   
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 03/16: Add available flag for UserDatabase

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 1e50c19b5f5164d4fbb38616af4c5548e44700f8
Author: remm 
AuthorDate: Wed Aug 25 22:36:17 2021 +0200

Add available flag for UserDatabase

Also avoid loading the whole database as MBeans, the behavior is fancy
but only makes sense for a memory user database.
---
 java/org/apache/catalina/UserDatabase.java | 22 ++
 .../mbeans/GlobalResourcesLifecycleListener.java   |  5 +
 .../apache/catalina/realm/UserDatabaseRealm.java   |  6 ++
 3 files changed, 33 insertions(+)

diff --git a/java/org/apache/catalina/UserDatabase.java 
b/java/org/apache/catalina/UserDatabase.java
index 9242170..713cc1d 100644
--- a/java/org/apache/catalina/UserDatabase.java
+++ b/java/org/apache/catalina/UserDatabase.java
@@ -198,4 +198,26 @@ public interface UserDatabase {
 public default void backgroundProcess() {
 // NO-OP by default
 }
+
+
+/**
+ * Is the database available.
+ *
+ * @return true
+ */
+public default boolean isAvailable() {
+return true;
+}
+
+
+/**
+ * Is the database data loaded on demand. This is used to avoid eager
+ * loading of the full database data, for example for JMX registration of
+ * all objects.
+ *
+ * @return false
+ */
+public default boolean isSparse() {
+return false;
+}
 }
diff --git 
a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java 
b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
index a86b486..bca1ed7 100644
--- a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
+++ b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
@@ -168,6 +168,11 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
 throw new 
IllegalArgumentException(sm.getString("globalResources.createError.userDatabase",
 name), e);
 }
 
+if (database.isSparse()) {
+// Avoid loading all the database as mbeans
+return;
+}
+
 // Create the MBeans for each defined Role
 Iterator roles = database.getRoles();
 while (roles.hasNext()) {
diff --git a/java/org/apache/catalina/realm/UserDatabaseRealm.java 
b/java/org/apache/catalina/realm/UserDatabaseRealm.java
index e76adbd..d98115f 100644
--- a/java/org/apache/catalina/realm/UserDatabaseRealm.java
+++ b/java/org/apache/catalina/realm/UserDatabaseRealm.java
@@ -231,6 +231,12 @@ public class UserDatabaseRealm extends RealmBase {
 }
 
 
+@Override
+public boolean isAvailable() {
+return (database == null) ? false : database.isAvailable();
+}
+
+
 public static final class UserDatabasePrincipal extends GenericPrincipal {
 private static final long serialVersionUID = 1L;
 private final transient User user;

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 13/16: Add first pass at tests for the DataSource UserDatabase

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 7375b36f8a5e67a14a13214ffa6bdae23cc3248c
Author: remm 
AuthorDate: Tue Aug 31 21:37:47 2021 +0200

Add first pass at tests for the DataSource UserDatabase

Use a shortcut to allow independent testing without a real DataSource.
Test both the DataSourceRealm schema as well as the full schema with
groups.
Only glitch is that Derby leaves a derby.log, I haven't found how to
configure it away.
---
 .../users/DataSourceUserDatabaseTests.java | 228 +
 1 file changed, 228 insertions(+)

diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
new file mode 100644
index 000..5529917
--- /dev/null
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -0,0 +1,228 @@
+/*
+ *  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.
+ */
+package org.apache.catalina.users;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.Iterator;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.catalina.Group;
+import org.apache.catalina.Role;
+import org.apache.catalina.User;
+import org.apache.catalina.startup.LoggingBaseTest;
+
+public class DataSourceUserDatabaseTests extends LoggingBaseTest {
+
+public static final String SIMPLE_SCHEMA =
+"create table users (\n"
++ "  user_name varchar(15) not null primary key,\n"
++ "  user_pass varchar(15) not null\n"
++ ");\n"
++ "create table user_roles (\n"
++ "  user_name varchar(15) not null,\n"
++ "  role_name varchar(15) not null,\n"
++ "  primary key (user_name, role_name)\n"
++ ");";
+
+public static final String FULL_SCHEMA =
+"create table users (\n"
++ "  user_name varchar(15) not null primary key,\n"
++ "  user_pass varchar(15) not null,\n"
++ "  user_fullname varchar(128)\n"
++ "  -- Add more attributes as needed\n"
++ ");\n"
++ "create table roles (\n"
++ "  role_name varchar(15) not null primary key,\n"
++ "  role_description  varchar(128)\n"
++ ");\n"
++ "create table groups (\n"
++ "  group_namevarchar(15) not null primary key,\n"
++ "  group_description varchar(128)\n"
++ ");\n"
++ "create table user_roles (\n"
++ "  user_name varchar(15) references users(user_name),\n"
++ "  role_name varchar(15) references roles(role_name),\n"
++ "  primary key (user_name, role_name)\n"
++ ");\n"
++ "create table user_groups (\n"
++ "  user_name varchar(15) references users(user_name),\n"
++ "  group_namevarchar(15) references 
groups(group_name),\n"
++ "  primary key (user_name, group_name)\n"
++ ");\n"
++ "create table group_roles (\n"
++ "  group_namevarchar(15) references 
groups(group_name),\n"
++ "  role_name varchar(15) references roles(role_name),\n"
++ "  primary key (group_name, role_name)\n"
++ ");";
+
+protected class DerbyUserDatabase extends DataSourceUserDatabase {
+protected final String name;
+protected Connection connection = null;
+public DerbyUserDatabase(String name) {
+super(null, "tomcat");

[tomcat] 12/16: Fix group roles not working

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a25cb20de815339c7d1edb4c6009d7705eed3fe8
Author: remm 
AuthorDate: Tue Aug 31 21:34:41 2021 +0200

Fix group roles not working

Also for a simple schema, the roles didn't work properly. Now when
there's no role table, roles exist when they are assigned to a user.
---
 .../catalina/users/DataSourceUserDatabase.java | 26 +++---
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index a5bff3a..2c6eb5e 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -128,7 +128,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the groups PreparedStatement
  */
-private String preparedGroupsR = null;
+private String preparedGroupRoles = null;
 
 
 /**
@@ -640,7 +640,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 ArrayList groupRoles = new ArrayList<>();
 if (groupName != null) {
 groupName = groupName.trim();
-try (PreparedStatement stmt2 = 
dbConnection.prepareStatement(preparedGroupsR)) {
+try (PreparedStatement stmt2 = 
dbConnection.prepareStatement(preparedGroupRoles)) {
 stmt2.setString(1, groupName);
 try (ResultSet rs2 = stmt2.executeQuery()) {
 while (rs2.next()) {
@@ -869,7 +869,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(" = ?");
 preparedRoles = temp.toString();
 
-if (userGroupTable != null && userGroupTable.length() > 0) {
+if (userGroupTable != null) {
 temp = new StringBuilder("SELECT ");
 temp.append(groupNameCol);
 temp.append(" FROM ");
@@ -880,15 +880,15 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 preparedGroups = temp.toString();
 }
 
-if (groupRoleTable != null && groupRoleTable.length() > 0) {
+if (groupRoleTable != null) {
 temp = new StringBuilder("SELECT ");
-temp.append(groupNameCol);
+temp.append(roleNameCol);
 temp.append(" FROM ");
 temp.append(groupRoleTable);
 temp.append(" WHERE ");
 temp.append(groupNameCol);
 temp.append(" = ?");
-preparedGroupsR = temp.toString();
+preparedGroupRoles = temp.toString();
 }
 
 temp = new StringBuilder("SELECT ");
@@ -909,7 +909,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(userTable);
 preparedAllUsers = temp.toString();
 
-if (groupTable != null && groupTable.length() > 0) {
+if (groupTable != null) {
 temp = new StringBuilder("SELECT ");
 temp.append(groupNameCol);
 if (roleAndGroupDescriptionCol != null) {
@@ -929,7 +929,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 preparedAllGroups = temp.toString();
 }
 
-if (roleTable != null && roleTable.length() > 0) {
+if (roleTable != null) {
 // Create the role PreparedStatement string
 temp = new StringBuilder("SELECT ");
 temp.append(roleNameCol);
@@ -948,6 +948,16 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(" FROM ");
 temp.append(roleTable);
 preparedAllRoles = temp.toString();
+} else {
+// Validate roles existence from the user <-> roles table
+temp = new StringBuilder("SELECT ");
+temp.append(roleNameCol);
+temp.append(" FROM ");
+temp.append(userRoleTable);
+temp.append(" WHERE ");
+temp.append(roleNameCol);
+temp.append(" = ?");
+preparedRole = temp.toString();
 }
 
 } finally {

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/16: Fix Javadoc warning

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 75cdff2a9d37d1c6b691def42ef41d433dd8d6dd
Author: Mark Thomas 
AuthorDate: Tue Aug 17 15:54:42 2021 +0100

Fix Javadoc warning
---
 java/org/apache/catalina/users/GenericGroup.java | 2 ++
 java/org/apache/catalina/users/GenericRole.java  | 2 ++
 java/org/apache/catalina/users/GenericUser.java  | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/java/org/apache/catalina/users/GenericGroup.java 
b/java/org/apache/catalina/users/GenericGroup.java
index d59e57d..986c9f7 100644
--- a/java/org/apache/catalina/users/GenericGroup.java
+++ b/java/org/apache/catalina/users/GenericGroup.java
@@ -31,6 +31,8 @@ import org.apache.catalina.UserDatabase;
  * Concrete implementation of {@link org.apache.catalina.Group} for a
  * {@link UserDatabase}.
  *
+ * @param  The specific type of UserDase with which this group is 
associated
+ *
  * @author Craig R. McClanahan
  */
 public class GenericGroup extends AbstractGroup {
diff --git a/java/org/apache/catalina/users/GenericRole.java 
b/java/org/apache/catalina/users/GenericRole.java
index c6b0eba..2957280 100644
--- a/java/org/apache/catalina/users/GenericRole.java
+++ b/java/org/apache/catalina/users/GenericRole.java
@@ -24,6 +24,8 @@ import org.apache.catalina.UserDatabase;
  * Concrete implementation of {@link org.apache.catalina.Role} for a
  * {@link UserDatabase}.
  *
+ * @param  The specific type of UserDase with which this role is associated
+ *
  * @author Craig R. McClanahan
  */
 public class GenericRole extends AbstractRole {
diff --git a/java/org/apache/catalina/users/GenericUser.java 
b/java/org/apache/catalina/users/GenericUser.java
index 77b70b4..7d69360 100644
--- a/java/org/apache/catalina/users/GenericUser.java
+++ b/java/org/apache/catalina/users/GenericUser.java
@@ -29,6 +29,8 @@ import org.apache.catalina.UserDatabase;
  * Concrete implementation of {@link org.apache.catalina.User} for a
  * {@link UserDatabase}.
  *
+ * @param  The specific type of UserDase with which this role is associated
+ *
  * @author Craig R. McClanahan
  */
 public class GenericUser extends AbstractUser {

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 08/16: Refactor to avoid NPE warnings in IDE

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 2996ab071f58ca689c5432801736093e7c327cbb
Author: Mark Thomas 
AuthorDate: Tue Aug 31 18:02:36 2021 +0100

Refactor to avoid NPE warnings in IDE
---
 java/org/apache/catalina/users/DataSourceUserDatabase.java | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index f90d1b0..dbe1a69 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -1092,11 +1092,13 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 tempRelationDelete2.append(roleNameCol);
 tempRelationDelete2.append(" = ?");
 for (Role role : removedRoles.values()) {
-try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete.toString())) {
-stmt.setString(1, role.getRolename());
-stmt.executeUpdate();
-} catch (SQLException e) {
-
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+if (tempRelationDelete != null) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
 }
 try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete2.toString())) {
 stmt.setString(1, role.getRolename());
@@ -1180,7 +1182,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(" = ?");
 }
 for (Group group : modifiedGroups.values()) {
-if (roleAndGroupDescriptionCol != null) {
+if (temp != null) {
 try (PreparedStatement stmt = 
dbConnection.prepareStatement(temp.toString())) {
 stmt.setString(1, group.getDescription());
 stmt.setString(2, group.getGroupname());

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 11/16: Add Derby for the testsuite

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 73b125b58d167db541281d219c2788be71fdee60
Author: remm 
AuthorDate: Tue Aug 31 21:32:10 2021 +0200

Add Derby for the testsuite

It can be used for JDBC testing. Also for DataSource with our pools.
---
 build.properties.default   | 24 
 build.xml  | 30 ++
 webapps/docs/changelog.xml |  7 +++
 3 files changed, 61 insertions(+)

diff --git a/build.properties.default b/build.properties.default
index f2208e7..80dd4fa 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -321,3 +321,27 @@ 
jsign.checksum.value=50982facf864df4f08a051b43f7d2e42|3d203fbffdc45e837f98b7c9c5
 jsign.home=${base.path}/jsign-${jsign.version}
 jsign.jar=${jsign.home}/jsign-${jsign.version}.jar
 
jsign.loc=${base-maven.loc}/net/jsign/jsign/${jsign.version}/jsign-${jsign.version}.jar
+
+# - Derby, used by unit tests -
+derby.version=10.15.2.0
+
+# checksums for Derby 10.15.2.0
+derby.checksum.enabled=true
+derby.checksum.algorithm=MD5|SHA-1
+derby.checksum.value=abff01351b19bc62a188bac08a8bb58b|b64da6681994f33ba5783ffae55cdb44885b9e70
+derby-shared.checksum.enabled=true
+derby-shared.checksum.algorithm=MD5|SHA-1
+derby-shared.checksum.value=2cb9ab8b9cfb06c2da5a1d3825d04344|ff2dfb3e2a92d593cf111baad242d156947abbc1
+derby-tools.checksum.enabled=true
+derby-tools.checksum.algorithm=MD5|SHA-1
+derby-tools.checksum.value=d41578eeb336b0e479be8f30bfd9ab9b|d63722381e0e893d797e4d531e219e2917898364
+
+derby.home=${base.path}/derby-${derby.version}
+derby.jar=${derby.home}/derby-${derby.version}.jar
+derby.loc=${base-maven.loc}/org/apache/derby/derby/${derby.version}/derby-${derby.version}.jar
+derby-shared.jar=${derby.home}/derby-shared-${derby.version}.jar
+derby-shared.loc=${base-maven.loc}/org/apache/derby/derbyshared/${derby.version}/derbyshared-${derby.version}.jar
+derby-tools.jar=${derby.home}/derby-tools-${derby.version}.jar
+derby-tools.loc=${base-maven.loc}/org/apache/derby/derbytools/${derby.version}/derbytools-${derby.version}.jar
+
+
diff --git a/build.xml b/build.xml
index 1a37c0f..34301df 100644
--- a/build.xml
+++ b/build.xml
@@ -260,6 +260,9 @@
 
 
 
+
+
+
 
 
   
@@ -3247,6 +3250,33 @@ skip.installer property in build.properties" />
   
 
 
+
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+
+
   
 
   
+<<<<<<< HEAD
   
 Update the internal fork of Apache Commons BCEL to 40d5eb4 (2021-09-01,
 6.6.0-SNAPSHOT). Code clean-up only. (markt)
@@ -207,6 +208,12 @@
 Update the internal fork of Apache Commons Codec to fd44e6b 
(2021-09-01,
 1.16-SNAPSHOT). Minor refactoring. (markt)
   
+===
+  
+Add Apache Derby 10.15.2.0 to the testsuite dependencies, for JDBC
+and DataSource testing. (remm)
+  
+>>>>>>> 86177f0839 (Add Derby for the testsuite)
 
   
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 07/16: Add UserDatabase documentation

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 47b97e0e4a53dcb7d9d5ce8fc8d2b59884b6c8fd
Author: remm 
AuthorDate: Fri Aug 27 09:56:32 2021 +0200

Add UserDatabase documentation
---
 webapps/docs/jndi-resources-howto.xml | 204 +-
 1 file changed, 202 insertions(+), 2 deletions(-)

diff --git a/webapps/docs/jndi-resources-howto.xml 
b/webapps/docs/jndi-resources-howto.xml
index 4cdba75..0c682f8 100644
--- a/webapps/docs/jndi-resources-howto.xml
+++ b/webapps/docs/jndi-resources-howto.xml
@@ -428,14 +428,14 @@ public class MyBean2 {
   
 
 
-  
+  
 
 0.  Introduction
 
 UserDatabase resources are typically configured as global resources for
 use by a UserDatabase realm. Tomcat includes a UserDatabaseFactory that
 creates UserDatabase resources backed by an XML file - usually
-tomcat-users.xml
+tomcat-users.xml.
 
 The steps required to set up a global UserDatabase resource are 
described
 below.
@@ -496,6 +496,206 @@ public class MyBean2 {
   
 
 
+  
+
+0.  Introduction
+
+Tomcat also include a UserDatabase that uses a
+DataSource resource as the backend. The backend resource
+must be declared in the same JNDI context as the user database that will 
use
+it.
+
+The steps required to set up a global UserDatabase resource are 
described
+below.
+
+1. Database schema
+
+The database shema for the user database is flexible. It can be the same
+as the schema used for the DataSourceRealm, with only a table
+for users (user name, password), and another one listing the roles
+associated with each user. To support the full UserDatabase
+features, it must include additional tables for groups, and is
+compatible with referential integrity between users, groups and roles.
+
+The full featured schema with groups and referential integrity
+could be:
+
+
+
+The minimal schema without the ability to use groups will be
+(it is the same as for the DataSourceRealm):
+
+
+
+2.  Declare Your Resource
+
+Next, modify $CATALINA_BASE/conf/server.xml to create the
+UserDatabase resource based on your DataSource and its schema.
+It should look something like this:
+
+
+
+The dataSourceName attribute is the JNDI name of the
+DataSource that will be the backend for the
+UserDatabase. It must be declared in the same JNDI
+Context as the UserDatabase. Please refer to the
+DataSource resources
+documentation for further instructions.
+
+The readonly attribute is optional and defaults to
+true if not supplied. If the database is writeable then 
changes
+made through the Tomcat management to the UserDatabase can
+be persisted to the database using the save operation.
+
+Alternately, changes can also be made directly to the backend database.
+
+
+3.  Resource configuration
+
+
+
+  
+The name of the JNDI JDBC DataSource for this UserDatabase.
+  
+
+  
+Name of the column, in the "groups", "group roles" and "user groups"
+tables, that contains the group's name.
+  
+
+  
+Name of the "group roles" table, which must contain columns
+named by the groupNameCol and roleNameCol
+attributes.
+  
+
+  
+Name of the "groups" table, which must contain columns named
+by the groupNameCol attribute.
+  
+
+  
+If this is set to true, then changes to the
+UserDatabase can be persisted to the
+DataSource by using the save method.
+The default value is false.
+  
+
+  
+Name of the column, in the "roles" and "groups" tables, that 
contains
+the description for the roles and groups.
+  
+
+  
+Name of the column, in the "roles", "user roles" and "group roles"
+tables, which contains a role name assigned to the corresponding
+user.
+  
+
+  
+Name of the "roles" table, which must contain columns named
+by the roleNameCol attribute.
+  
+
+  
+Name of the column, in the "users" table, which contains
+the user's credentials (i.e. password).  If a
+CredentialHandler is specified, this component
+will assume that the passwords have been encoded with the
+specified algorithm.  Otherwise, they will be assumed to be
+in clear text.
+  
+
+  
+Name of the "user groups" table, which must contain columns
+named by the userNameCol and groupNameCol
+attributes.
+  
+
+  
+Name of the column, in the "users", "user groups" and "user roles"
+   

[tomcat] 04/16: Add a UserDatabase implementation based on DataSourceRealm

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 346114b4d43bcf315ded509c2ed5ebd099c95d3c
Author: remm 
AuthorDate: Thu Aug 26 15:44:36 2021 +0200

Add a UserDatabase implementation based on DataSourceRealm

The goal is to showcase the UserDatabase somewhat more, and this can use
the minimal schema from the DataSourceRealm with reduced functionality.
The MBeans are different. The problem with the current behavior is that
the whole database ends up being registered as individual MBeans.
There's a new MBean that only uses operations. The MBeans from the
memory UserDatabase are still there, but they are only populated on
demand (however, guis often pull the attributes that populate them) and
they are unregistered when saving back.
Make related changes to the realm and its custom principal so that the
results are as dynamic as expected. Add an option for things to be more
static.
Will look into the ReentrantReadWriteLock that is used in the memory
UserDatabase.
The documentation itself will be straightforward.
---
 .../mbeans/DataSourceUserDatabaseMBean.java|  360 +
 .../apache/catalina/mbeans/LocalStrings.properties |1 +
 java/org/apache/catalina/mbeans/MBeanUtils.java|   30 +
 .../catalina/mbeans/SparseUserDatabaseMBean.java   |  369 +
 .../apache/catalina/realm/UserDatabaseRealm.java   |   63 +-
 .../catalina/users/DataSourceUserDatabase.java | 1405 
 .../users/DataSourceUserDatabaseFactory.java   |  163 +++
 java/org/apache/catalina/users/GenericGroup.java   |   10 +
 java/org/apache/catalina/users/GenericRole.java|   10 +
 java/org/apache/catalina/users/GenericUser.java|   10 +
 .../apache/catalina/users/LocalStrings.properties  |2 +
 .../apache/catalina/users/SparseUserDatabase.java  |   29 +
 .../apache/catalina/users/mbeans-descriptors.xml   |  346 +
 webapps/docs/changelog.xml |   10 +
 webapps/docs/config/realm.xml  |8 +
 15 files changed, 2813 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java 
b/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java
new file mode 100644
index 000..86f78ad
--- /dev/null
+++ b/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java
@@ -0,0 +1,360 @@
+/*
+ * 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.
+ */
+package org.apache.catalina.mbeans;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.catalina.Group;
+import org.apache.catalina.Role;
+import org.apache.catalina.User;
+import org.apache.catalina.UserDatabase;
+import org.apache.tomcat.util.modeler.BaseModelMBean;
+import org.apache.tomcat.util.modeler.ManagedBean;
+import org.apache.tomcat.util.modeler.Registry;
+
+/**
+ * A ModelMBean implementation for the
+ * org.apache.catalina.users.DataSourceUserDatabase component.
+ *
+ * @author Craig R. McClanahan
+ */
+public class DataSourceUserDatabaseMBean extends BaseModelMBean {
+
+// - Instance Variables
+
+/**
+ * The configuration information registry for our managed beans.
+ */
+protected final Registry registry = MBeanUtils.createRegistry();
+
+
+/**
+ * The ManagedBean information describing this MBean.
+ */
+protected final ManagedBean managed = 
registry.findManagedBean("DataSourceUserDatabase");
+
+
+// - Attributes
+
+/**
+ * @return the names of all groups defined in this database.
+ */
+public String[] getGroups() {
+UserDatabase database = (UserDatabase) this.resource;
+List results = new ArrayList<>();
+Iterator groups = database.getGroups();
+while (groups.hasNext()) {
+Group group = groups.next();
+results.add(group.getGroupname());
+}
+return results.toArray(new String[0]);
+}
+
+
+/**
+ 

[tomcat] 10/16: Add hashCode implementations that are aligned with existing equals()

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 5335d2562483ec4ffc20503723c952e801e204fb
Author: Mark Thomas 
AuthorDate: Tue Aug 31 18:16:03 2021 +0100

Add hashCode implementations that are aligned with existing equals()
---
 java/org/apache/catalina/users/GenericGroup.java | 8 
 java/org/apache/catalina/users/GenericRole.java  | 8 
 java/org/apache/catalina/users/GenericUser.java  | 8 
 3 files changed, 24 insertions(+)

diff --git a/java/org/apache/catalina/users/GenericGroup.java 
b/java/org/apache/catalina/users/GenericGroup.java
index 2439788..153f5e5 100644
--- a/java/org/apache/catalina/users/GenericGroup.java
+++ b/java/org/apache/catalina/users/GenericGroup.java
@@ -179,4 +179,12 @@ public class GenericGroup extends 
AbstractGroup {
 }
 
 
+@Override
+public int hashCode() {
+final int prime = 31;
+int result = 1;
+result = prime * result + ((database == null) ? 0 : 
database.hashCode());
+result = prime * result + ((groupname == null) ? 0 : 
groupname.hashCode());
+return result;
+}
 }
diff --git a/java/org/apache/catalina/users/GenericRole.java 
b/java/org/apache/catalina/users/GenericRole.java
index 4da7c4d..2103714 100644
--- a/java/org/apache/catalina/users/GenericRole.java
+++ b/java/org/apache/catalina/users/GenericRole.java
@@ -98,4 +98,12 @@ public class GenericRole extends 
AbstractRole {
 }
 
 
+@Override
+public int hashCode() {
+final int prime = 31;
+int result = 1;
+result = prime * result + ((database == null) ? 0 : 
database.hashCode());
+result = prime * result + ((rolename == null) ? 0 : 
rolename.hashCode());
+return result;
+}
 }
diff --git a/java/org/apache/catalina/users/GenericUser.java 
b/java/org/apache/catalina/users/GenericUser.java
index 8788cbd..a020acd 100644
--- a/java/org/apache/catalina/users/GenericUser.java
+++ b/java/org/apache/catalina/users/GenericUser.java
@@ -254,4 +254,12 @@ public class GenericUser extends 
AbstractUser {
 }
 
 
+@Override
+public int hashCode() {
+final int prime = 31;
+int result = 1;
+result = prime * result + ((database == null) ? 0 : 
database.hashCode());
+result = prime * result + ((username == null) ? 0 : 
username.hashCode());
+return result;
+}
 }

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/16: Improve the reusability of UserDatabase code

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 861b4658702c6d79a1ccdf34df1f5a8f47ea90f0
Author: remm 
AuthorDate: Tue Aug 17 14:56:24 2021 +0200

Improve the reusability of UserDatabase code

Add intermediate concrete implementation classes. Add hooks to allow
partail database updates on save. Will likely make alternate
implementations more realistic.
---
 java/org/apache/catalina/UserDatabase.java |  27 
 .../users/{MemoryGroup.java => GenericGroup.java}  |  60 
 .../users/{MemoryRole.java => GenericRole.java}|  44 +++---
 .../users/{MemoryUser.java => GenericUser.java}| 126 
 java/org/apache/catalina/users/MemoryGroup.java| 116 +--
 java/org/apache/catalina/users/MemoryRole.java |  36 +
 java/org/apache/catalina/users/MemoryUser.java | 158 +
 webapps/docs/changelog.xml |   5 +
 8 files changed, 138 insertions(+), 434 deletions(-)

diff --git a/java/org/apache/catalina/UserDatabase.java 
b/java/org/apache/catalina/UserDatabase.java
index 8bac810..9242170 100644
--- a/java/org/apache/catalina/UserDatabase.java
+++ b/java/org/apache/catalina/UserDatabase.java
@@ -156,6 +156,33 @@ public interface UserDatabase {
 
 
 /**
+ * Signal the specified {@link Group} from this user database has been
+ * modified.
+ *
+ * @param group The group that has been modified
+ */
+public default void modifiedGroup(Group group) {}
+
+
+/**
+ * Signal the specified {@link Role} from this user database has been
+ * modified.
+ *
+ * @param role The role that has been modified
+ */
+public default void modifiedRole(Role role) {}
+
+
+/**
+ * Signal the specified {@link User} from this user database has been
+ * modified.
+ *
+ * @param user The user that has been modified
+ */
+public default void modifiedUser(User user) {}
+
+
+/**
  * Save any updated information to the persistent storage location for this
  * user database.
  *
diff --git a/java/org/apache/catalina/users/MemoryGroup.java 
b/java/org/apache/catalina/users/GenericGroup.java
similarity index 73%
copy from java/org/apache/catalina/users/MemoryGroup.java
copy to java/org/apache/catalina/users/GenericGroup.java
index aad4180..d59e57d 100644
--- a/java/org/apache/catalina/users/MemoryGroup.java
+++ b/java/org/apache/catalina/users/GenericGroup.java
@@ -25,17 +25,15 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import org.apache.catalina.Role;
 import org.apache.catalina.User;
 import org.apache.catalina.UserDatabase;
-import org.apache.tomcat.util.buf.StringUtils;
 
 
 /**
- * Concrete implementation of {@link org.apache.catalina.Group} for the
- * {@link MemoryUserDatabase} implementation of {@link UserDatabase}.
+ * Concrete implementation of {@link org.apache.catalina.Group} for a
+ * {@link UserDatabase}.
  *
  * @author Craig R. McClanahan
- * @since 4.1
  */
-public class MemoryGroup extends AbstractGroup {
+public class GenericGroup extends AbstractGroup {
 
 
 // --- Constructors
@@ -43,19 +41,23 @@ public class MemoryGroup extends AbstractGroup {
 
 /**
  * Package-private constructor used by the factory method in
- * {@link MemoryUserDatabase}.
+ * {@link UserDatabase}.
  *
- * @param database The {@link MemoryUserDatabase} that owns this group
+ * @param database The {@link UserDatabase} that owns this group
  * @param groupname Group name of this group
  * @param description Description of this group
+ * @param roles The roles of this group
  */
-MemoryGroup(MemoryUserDatabase database,
-String groupname, String description) {
+GenericGroup(UD database,
+String groupname, String description, List roles) {
 
 super();
 this.database = database;
-setGroupname(groupname);
-setDescription(description);
+this.groupname = groupname;
+this.description = description;
+if (roles != null) {
+this.roles.addAll(roles);
+}
 
 }
 
@@ -64,9 +66,9 @@ public class MemoryGroup extends AbstractGroup {
 
 
 /**
- * The {@link MemoryUserDatabase} that owns this group.
+ * The {@link UserDatabase} that owns this group.
  */
-protected final MemoryUserDatabase database;
+protected final UD database;
 
 
 /**
@@ -123,7 +125,9 @@ public class MemoryGroup extends AbstractGroup {
  */
 @Override
 public void addRole(Role role) {
-roles.addIfAbsent(role);
+if (roles.addIfAbsent(role)) {
+database.modifiedGroup(this);
+}
 }
 
 
@@ -145,7 +149,9 @@ public class MemoryGroup extends AbstractGroup {
  */
 

[tomcat] branch 9.0.x updated (475e001 -> a63ed57)

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from 475e001  Update Commons Codec to 1.16-SNAPSHOT (2021-01-09)
 new 861b465  Improve the reusability of UserDatabase code
 new 75cdff2  Fix Javadoc warning
 new 1e50c19  Add available flag for UserDatabase
 new 346114b  Add a UserDatabase implementation based on DataSourceRealm
 new bbab0a6  Fix compile
 new 9eff810  Add lock use similar to the memory user database
 new 47b97e0  Add UserDatabase documentation
 new 2996ab0  Refactor to avoid NPE warnings in IDE
 new ce75358  Fix IDE warnings. Use <> where possible.
 new 5335d25  Add hashCode implementations that are aligned with existing 
equals()
 new 73b125b  Add Derby for the testsuite
 new a25cb20  Fix group roles not working
 new 7375b36  Add first pass at tests for the DataSource UserDatabase
 new e1d0a7d  Use Derby 10.14 for Java 8 compatibility
 new e3cf4ac  Checkstyle
 new a63ed57  Fix bad merge

The 16 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.properties.default   |   19 +
 build.xml  |   20 +
 java/org/apache/catalina/UserDatabase.java |   49 +
 .../mbeans/DataSourceUserDatabaseMBean.java|  360 +
 .../mbeans/GlobalResourcesLifecycleListener.java   |5 +
 .../apache/catalina/mbeans/LocalStrings.properties |1 +
 java/org/apache/catalina/mbeans/MBeanUtils.java|   30 +
 .../catalina/mbeans/MemoryUserDatabaseMBean.java   |  277 +---
 ...baseMBean.java => SparseUserDatabaseMBean.java} |   77 +-
 .../apache/catalina/realm/UserDatabaseRealm.java   |   69 +-
 .../catalina/users/DataSourceUserDatabase.java | 1507 
 ...ory.java => DataSourceUserDatabaseFactory.java} |   86 +-
 .../users/{MemoryGroup.java => GenericGroup.java}  |   74 +-
 .../users/{MemoryRole.java => GenericRole.java}|   62 +-
 .../users/{MemoryUser.java => GenericUser.java}|  144 +-
 .../apache/catalina/users/LocalStrings.properties  |2 +
 java/org/apache/catalina/users/MemoryGroup.java|  116 +-
 java/org/apache/catalina/users/MemoryRole.java |   36 +-
 java/org/apache/catalina/users/MemoryUser.java |  158 +-
 .../apache/catalina/users/SparseUserDatabase.java  |   13 +-
 .../apache/catalina/users/mbeans-descriptors.xml   |  346 +
 .../users/DataSourceUserDatabaseTests.java |  228 +++
 webapps/docs/changelog.xml |   19 +
 webapps/docs/config/realm.xml  |8 +
 webapps/docs/jndi-resources-howto.xml  |  204 ++-
 25 files changed, 3169 insertions(+), 741 deletions(-)
 create mode 100644 
java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java
 copy java/org/apache/catalina/mbeans/{MemoryUserDatabaseMBean.java => 
SparseUserDatabaseMBean.java} (79%)
 create mode 100644 java/org/apache/catalina/users/DataSourceUserDatabase.java
 copy java/org/apache/catalina/users/{MemoryUserDatabaseFactory.java => 
DataSourceUserDatabaseFactory.java} (57%)
 copy java/org/apache/catalina/users/{MemoryGroup.java => GenericGroup.java} 
(69%)
 copy java/org/apache/catalina/users/{MemoryRole.java => GenericRole.java} (57%)
 copy java/org/apache/catalina/users/{MemoryUser.java => GenericUser.java} (62%)
 copy test/org/apache/catalina/loader/TesterNeverWeavedClass.java => 
java/org/apache/catalina/users/SparseUserDatabase.java (79%)
 create mode 100644 
test/org/apache/catalina/users/DataSourceUserDatabaseTests.java

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 13/13: Use Derby 10.14 for Java 8 compatibility

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit d7b6adb64462ce3f3b5f4697a88563306ab34754
Author: remm 
AuthorDate: Wed Sep 1 13:00:49 2021 +0200

Use Derby 10.14 for Java 8 compatibility
---
 build.properties.default   | 13 -
 build.xml  | 10 --
 webapps/docs/changelog.xml |  2 +-
 3 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index a5e25b2..0dddea9 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -335,24 +335,19 @@ jsign.jar=${jsign.home}/jsign-${jsign.version}.jar
 
jsign.loc=${base-maven.loc}/net/jsign/jsign/${jsign.version}/jsign-${jsign.version}.jar
 
 # - Derby, used by unit tests -
-derby.version=10.15.2.0
+derby.version=10.14.2.0
 
-# checksums for Derby 10.15.2.0
+# checksums for Derby 10.14.2.0
 derby.checksum.enabled=true
 derby.checksum.algorithm=MD5|SHA-1
-derby.checksum.value=abff01351b19bc62a188bac08a8bb58b|b64da6681994f33ba5783ffae55cdb44885b9e70
-derby-shared.checksum.enabled=true
-derby-shared.checksum.algorithm=MD5|SHA-1
-derby-shared.checksum.value=2cb9ab8b9cfb06c2da5a1d3825d04344|ff2dfb3e2a92d593cf111baad242d156947abbc1
+derby.checksum.value=3ddcc1d435344d39d0122dbc2f39a746|7efad40ef52fbb1f08142f07a83b42d29e47d8ce
 derby-tools.checksum.enabled=true
 derby-tools.checksum.algorithm=MD5|SHA-1
-derby-tools.checksum.value=d41578eeb336b0e479be8f30bfd9ab9b|d63722381e0e893d797e4d531e219e2917898364
+derby-tools.checksum.value=3189a1d586f98f0d203fb5f3e5d88fbe|338d5a54b4089c80414fe0ecb3899d521da69b26
 
 derby.home=${base.path}/derby-${derby.version}
 derby.jar=${derby.home}/derby-${derby.version}.jar
 
derby.loc=${base-maven.loc}/org/apache/derby/derby/${derby.version}/derby-${derby.version}.jar
-derby-shared.jar=${derby.home}/derby-shared-${derby.version}.jar
-derby-shared.loc=${base-maven.loc}/org/apache/derby/derbyshared/${derby.version}/derbyshared-${derby.version}.jar
 derby-tools.jar=${derby.home}/derby-tools-${derby.version}.jar
 
derby-tools.loc=${base-maven.loc}/org/apache/derby/derbytools/${derby.version}/derbytools-${derby.version}.jar
 
diff --git a/build.xml b/build.xml
index 172e923..a98f4e1 100644
--- a/build.xml
+++ b/build.xml
@@ -262,7 +262,6 @@
 
 
 
-
 
 
 
@@ -3288,15 +3287,6 @@ skip.installer property in build.properties" />
 
 
 
-  
-  
-  
-  
-  
-  
-
-
-
   
   
   
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6c98caf..1fef3d3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -200,7 +200,7 @@
 the installation of additional client tools. (markt)
   
   
-Add Apache Derby 10.15.2.0 to the testsuite dependencies, for JDBC
+Add Apache Derby 10.14.2.0 to the testsuite dependencies, for JDBC
 and DataSource testing. (remm)
   
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 09/13: Add hashCode implementations that are aligned with existing equals()

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit a20f224b355e41bbd02128553ef4e8b1b5a3ff20
Author: Mark Thomas 
AuthorDate: Tue Aug 31 18:16:03 2021 +0100

Add hashCode implementations that are aligned with existing equals()
---
 java/org/apache/catalina/users/GenericGroup.java | 8 
 java/org/apache/catalina/users/GenericRole.java  | 8 
 java/org/apache/catalina/users/GenericUser.java  | 8 
 3 files changed, 24 insertions(+)

diff --git a/java/org/apache/catalina/users/GenericGroup.java 
b/java/org/apache/catalina/users/GenericGroup.java
index 2439788..153f5e5 100644
--- a/java/org/apache/catalina/users/GenericGroup.java
+++ b/java/org/apache/catalina/users/GenericGroup.java
@@ -179,4 +179,12 @@ public class GenericGroup extends 
AbstractGroup {
 }
 
 
+@Override
+public int hashCode() {
+final int prime = 31;
+int result = 1;
+result = prime * result + ((database == null) ? 0 : 
database.hashCode());
+result = prime * result + ((groupname == null) ? 0 : 
groupname.hashCode());
+return result;
+}
 }
diff --git a/java/org/apache/catalina/users/GenericRole.java 
b/java/org/apache/catalina/users/GenericRole.java
index 4da7c4d..2103714 100644
--- a/java/org/apache/catalina/users/GenericRole.java
+++ b/java/org/apache/catalina/users/GenericRole.java
@@ -98,4 +98,12 @@ public class GenericRole extends 
AbstractRole {
 }
 
 
+@Override
+public int hashCode() {
+final int prime = 31;
+int result = 1;
+result = prime * result + ((database == null) ? 0 : 
database.hashCode());
+result = prime * result + ((rolename == null) ? 0 : 
rolename.hashCode());
+return result;
+}
 }
diff --git a/java/org/apache/catalina/users/GenericUser.java 
b/java/org/apache/catalina/users/GenericUser.java
index 8788cbd..a020acd 100644
--- a/java/org/apache/catalina/users/GenericUser.java
+++ b/java/org/apache/catalina/users/GenericUser.java
@@ -254,4 +254,12 @@ public class GenericUser extends 
AbstractUser {
 }
 
 
+@Override
+public int hashCode() {
+final int prime = 31;
+int result = 1;
+result = prime * result + ((database == null) ? 0 : 
database.hashCode());
+result = prime * result + ((username == null) ? 0 : 
username.hashCode());
+return result;
+}
 }

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 08/13: Fix IDE warnings. Use <> where possible.

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit bb21272b056b78ad97c1ca9ddbd78738aa2007a6
Author: Mark Thomas 
AuthorDate: Tue Aug 31 18:03:42 2021 +0100

Fix IDE warnings. Use <> where possible.
---
 java/org/apache/catalina/users/DataSourceUserDatabase.java | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index dbe1a69..a5bff3a 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -559,7 +559,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 public Group createGroup(String groupname, String description) {
 readLock.lock();
 try {
-Group group = new GenericGroup(this, 
groupname, description, null);
+Group group = new GenericGroup<>(this, groupname, description, 
null);
 createdGroups.put(groupname, group);
 modifiedGroups.remove(groupname);
 removedGroups.remove(groupname);
@@ -573,7 +573,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 public Role createRole(String rolename, String description) {
 readLock.lock();
 try {
-Role role = new GenericRole(this, 
rolename, description);
+Role role = new GenericRole<>(this, rolename, description);
 createdRoles.put(rolename, role);
 modifiedRoles.remove(rolename);
 removedRoles.remove(rolename);
@@ -587,7 +587,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 public User createUser(String username, String password, String fullName) {
 readLock.lock();
 try {
-User user = new GenericUser(this, 
username, password, fullName, null, null);
+User user = new GenericUser<>(this, username, password, fullName, 
null, null);
 createdUsers.put(username, user);
 modifiedUsers.remove(username);
 removedUsers.remove(username);
@@ -657,7 +657,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
 }
 }
-group = new GenericGroup(this, 
groupName, description, groupRoles);
+group = new GenericGroup<>(this, groupName, 
description, groupRoles);
 }
 }
 }
@@ -707,7 +707,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 if (rs.next()) {
 if (rs.getString(1) != null) {
 String description = (roleAndGroupDescriptionCol != 
null) ? rs.getString(2) : null;
-role = new GenericRole(this, 
roleName, description);
+role = new GenericRole<>(this, roleName, description);
 }
 }
 }
@@ -811,8 +811,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 }
 }
 
-User user = new GenericUser(this, userName, 
dbCredentials,
-fullName, groups, roles);
+User user = new GenericUser<>(this, userName, dbCredentials, fullName, 
groups, roles);
 return user;
 }
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 07/13: Refactor to avoid NPE warnings in IDE

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 785e07613175dc5bfcd5dffd34eb705fa907621d
Author: Mark Thomas 
AuthorDate: Tue Aug 31 18:02:36 2021 +0100

Refactor to avoid NPE warnings in IDE
---
 java/org/apache/catalina/users/DataSourceUserDatabase.java | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index f90d1b0..dbe1a69 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -1092,11 +1092,13 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 tempRelationDelete2.append(roleNameCol);
 tempRelationDelete2.append(" = ?");
 for (Role role : removedRoles.values()) {
-try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete.toString())) {
-stmt.setString(1, role.getRolename());
-stmt.executeUpdate();
-} catch (SQLException e) {
-
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+if (tempRelationDelete != null) {
+try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete.toString())) {
+stmt.setString(1, role.getRolename());
+stmt.executeUpdate();
+} catch (SQLException e) {
+
log.error(sm.getString("dataSourceUserDatabase.exception"), e);
+}
 }
 try (PreparedStatement stmt = 
dbConnection.prepareStatement(tempRelationDelete2.toString())) {
 stmt.setString(1, role.getRolename());
@@ -1180,7 +1182,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(" = ?");
 }
 for (Group group : modifiedGroups.values()) {
-if (roleAndGroupDescriptionCol != null) {
+if (temp != null) {
 try (PreparedStatement stmt = 
dbConnection.prepareStatement(temp.toString())) {
 stmt.setString(1, group.getDescription());
 stmt.setString(2, group.getGroupname());

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 05/13: Add lock use similar to the memory user database

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 43c379104db4c30d80df32c6beb8581e25e98735
Author: remm 
AuthorDate: Thu Aug 26 16:40:44 2021 +0200

Add lock use similar to the memory user database

Remove duplicated code, I verified the memory MBean works fine.
---
 .../catalina/mbeans/MemoryUserDatabaseMBean.java   | 277 +--
 .../catalina/mbeans/SparseUserDatabaseMBean.java   |  59 +--
 .../apache/catalina/realm/UserDatabaseRealm.java   |   2 +-
 .../catalina/users/DataSourceUserDatabase.java | 553 -
 4 files changed, 354 insertions(+), 537 deletions(-)

diff --git a/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java 
b/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
index b8fc248..7105cf8 100644
--- a/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
+++ b/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
@@ -16,21 +16,7 @@
  */
 package org.apache.catalina.mbeans;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.catalina.Group;
-import org.apache.catalina.Role;
-import org.apache.catalina.User;
-import org.apache.catalina.UserDatabase;
-import org.apache.tomcat.util.modeler.BaseModelMBean;
 import org.apache.tomcat.util.modeler.ManagedBean;
-import org.apache.tomcat.util.modeler.Registry;
-import org.apache.tomcat.util.res.StringManager;
 
 /**
  * A ModelMBean implementation for the
@@ -38,272 +24,11 @@ import org.apache.tomcat.util.res.StringManager;
  *
  * @author Craig R. McClanahan
  */
-public class MemoryUserDatabaseMBean extends BaseModelMBean {
-
-private static final StringManager sm = 
StringManager.getManager(MemoryUserDatabaseMBean.class);
-
-// - Instance Variables
-
-/**
- * The configuration information registry for our managed beans.
- */
-protected final Registry registry = MBeanUtils.createRegistry();
-
+public class MemoryUserDatabaseMBean extends SparseUserDatabaseMBean {
 
 /**
  * The ManagedBean information describing this MBean.
  */
 protected final ManagedBean managed = 
registry.findManagedBean("MemoryUserDatabase");
 
-
-/**
- * The ManagedBean information describing Group MBeans.
- */
-protected final ManagedBean managedGroup = 
registry.findManagedBean("Group");
-
-
-/**
- * The ManagedBean information describing Group MBeans.
- */
-protected final ManagedBean managedRole = registry.findManagedBean("Role");
-
-
-/**
- * The ManagedBean information describing User MBeans.
- */
-protected final ManagedBean managedUser = registry.findManagedBean("User");
-
-
-// - Attributes
-
-/**
- * @return the MBean Names of all groups defined in this database.
- */
-public String[] getGroups() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator groups = database.getGroups();
-while (groups.hasNext()) {
-Group group = groups.next();
-results.add(findGroup(group.getGroupname()));
-}
-return results.toArray(new String[0]);
-}
-
-
-/**
- * @return the MBean Names of all roles defined in this database.
- */
-public String[] getRoles() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator roles = database.getRoles();
-while (roles.hasNext()) {
-Role role = roles.next();
-results.add(findRole(role.getRolename()));
-}
-return results.toArray(new String[0]);
-}
-
-
-/**
- * @return the MBean Names of all users defined in this database.
- */
-public String[] getUsers() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator users = database.getUsers();
-while (users.hasNext()) {
-User user = users.next();
-results.add(findUser(user.getUsername()));
-}
-return results.toArray(new String[0]);
-}
-
-
-// - Operations
-
-/**
- * Create a new Group and return the corresponding MBean Name.
- *
- * @param groupname Group name of the new group
- * @param description Description of the new group
- * @return the new group object name
- */
-public String createGroup(String groupname, String description) {
-UserDatabase database = (UserDatabase) this.resource;
-   

[tomcat] 11/13: Fix group roles not working

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 6d2b63f72a8c7e20148c01667d198760ec8edcda
Author: remm 
AuthorDate: Tue Aug 31 21:34:41 2021 +0200

Fix group roles not working

Also for a simple schema, the roles didn't work properly. Now when
there's no role table, roles exist when they are assigned to a user.
---
 .../catalina/users/DataSourceUserDatabase.java | 26 +++---
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index a5bff3a..2c6eb5e 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -128,7 +128,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the groups PreparedStatement
  */
-private String preparedGroupsR = null;
+private String preparedGroupRoles = null;
 
 
 /**
@@ -640,7 +640,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 ArrayList groupRoles = new ArrayList<>();
 if (groupName != null) {
 groupName = groupName.trim();
-try (PreparedStatement stmt2 = 
dbConnection.prepareStatement(preparedGroupsR)) {
+try (PreparedStatement stmt2 = 
dbConnection.prepareStatement(preparedGroupRoles)) {
 stmt2.setString(1, groupName);
 try (ResultSet rs2 = stmt2.executeQuery()) {
 while (rs2.next()) {
@@ -869,7 +869,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(" = ?");
 preparedRoles = temp.toString();
 
-if (userGroupTable != null && userGroupTable.length() > 0) {
+if (userGroupTable != null) {
 temp = new StringBuilder("SELECT ");
 temp.append(groupNameCol);
 temp.append(" FROM ");
@@ -880,15 +880,15 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 preparedGroups = temp.toString();
 }
 
-if (groupRoleTable != null && groupRoleTable.length() > 0) {
+if (groupRoleTable != null) {
 temp = new StringBuilder("SELECT ");
-temp.append(groupNameCol);
+temp.append(roleNameCol);
 temp.append(" FROM ");
 temp.append(groupRoleTable);
 temp.append(" WHERE ");
 temp.append(groupNameCol);
 temp.append(" = ?");
-preparedGroupsR = temp.toString();
+preparedGroupRoles = temp.toString();
 }
 
 temp = new StringBuilder("SELECT ");
@@ -909,7 +909,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(userTable);
 preparedAllUsers = temp.toString();
 
-if (groupTable != null && groupTable.length() > 0) {
+if (groupTable != null) {
 temp = new StringBuilder("SELECT ");
 temp.append(groupNameCol);
 if (roleAndGroupDescriptionCol != null) {
@@ -929,7 +929,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 preparedAllGroups = temp.toString();
 }
 
-if (roleTable != null && roleTable.length() > 0) {
+if (roleTable != null) {
 // Create the role PreparedStatement string
 temp = new StringBuilder("SELECT ");
 temp.append(roleNameCol);
@@ -948,6 +948,16 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(" FROM ");
 temp.append(roleTable);
 preparedAllRoles = temp.toString();
+} else {
+// Validate roles existence from the user <-> roles table
+temp = new StringBuilder("SELECT ");
+temp.append(roleNameCol);
+temp.append(" FROM ");
+temp.append(userRoleTable);
+temp.append(" WHERE ");
+temp.append(roleNameCol);
+temp.append(" = ?");
+preparedRole = temp.toString();
 }
 
 } finally {

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 12/13: Add first pass at tests for the DataSource UserDatabase

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit e9945ac5892088bd1c463ff4c68b64842b60b9cd
Author: remm 
AuthorDate: Tue Aug 31 21:37:47 2021 +0200

Add first pass at tests for the DataSource UserDatabase

Use a shortcut to allow independent testing without a real DataSource.
Test both the DataSourceRealm schema as well as the full schema with
groups.
Only glitch is that Derby leaves a derby.log, I haven't found how to
configure it away.
---
 .../users/DataSourceUserDatabaseTests.java | 228 +
 1 file changed, 228 insertions(+)

diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
new file mode 100644
index 000..5529917
--- /dev/null
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -0,0 +1,228 @@
+/*
+ *  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.
+ */
+package org.apache.catalina.users;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.Iterator;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.catalina.Group;
+import org.apache.catalina.Role;
+import org.apache.catalina.User;
+import org.apache.catalina.startup.LoggingBaseTest;
+
+public class DataSourceUserDatabaseTests extends LoggingBaseTest {
+
+public static final String SIMPLE_SCHEMA =
+"create table users (\n"
++ "  user_name varchar(15) not null primary key,\n"
++ "  user_pass varchar(15) not null\n"
++ ");\n"
++ "create table user_roles (\n"
++ "  user_name varchar(15) not null,\n"
++ "  role_name varchar(15) not null,\n"
++ "  primary key (user_name, role_name)\n"
++ ");";
+
+public static final String FULL_SCHEMA =
+"create table users (\n"
++ "  user_name varchar(15) not null primary key,\n"
++ "  user_pass varchar(15) not null,\n"
++ "  user_fullname varchar(128)\n"
++ "  -- Add more attributes as needed\n"
++ ");\n"
++ "create table roles (\n"
++ "  role_name varchar(15) not null primary key,\n"
++ "  role_description  varchar(128)\n"
++ ");\n"
++ "create table groups (\n"
++ "  group_namevarchar(15) not null primary key,\n"
++ "  group_description varchar(128)\n"
++ ");\n"
++ "create table user_roles (\n"
++ "  user_name varchar(15) references users(user_name),\n"
++ "  role_name varchar(15) references roles(role_name),\n"
++ "  primary key (user_name, role_name)\n"
++ ");\n"
++ "create table user_groups (\n"
++ "  user_name varchar(15) references users(user_name),\n"
++ "  group_namevarchar(15) references 
groups(group_name),\n"
++ "  primary key (user_name, group_name)\n"
++ ");\n"
++ "create table group_roles (\n"
++ "  group_namevarchar(15) references 
groups(group_name),\n"
++ "  role_name varchar(15) references roles(role_name),\n"
++ "  primary key (group_name, role_name)\n"
++ ");";
+
+protected class DerbyUserDatabase extends DataSourceUserDatabase {
+protected final String name;
+protected Connection connection = null;
+public DerbyUserDatabase(String name) {
+super(null, "tomcat");

[tomcat] 10/13: Add Derby for the testsuite

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 86177f083963cdd89b94ab0e396ec6434e918e5d
Author: remm 
AuthorDate: Tue Aug 31 21:32:10 2021 +0200

Add Derby for the testsuite

It can be used for JDBC testing. Also for DataSource with our pools.
---
 build.properties.default   | 24 
 build.xml  | 30 ++
 webapps/docs/changelog.xml |  4 
 3 files changed, 58 insertions(+)

diff --git a/build.properties.default b/build.properties.default
index 206a2a9..a5e25b2 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -333,3 +333,27 @@ 
jsign.checksum.value=50982facf864df4f08a051b43f7d2e42|3d203fbffdc45e837f98b7c9c5
 jsign.home=${base.path}/jsign-${jsign.version}
 jsign.jar=${jsign.home}/jsign-${jsign.version}.jar
 
jsign.loc=${base-maven.loc}/net/jsign/jsign/${jsign.version}/jsign-${jsign.version}.jar
+
+# - Derby, used by unit tests -
+derby.version=10.15.2.0
+
+# checksums for Derby 10.15.2.0
+derby.checksum.enabled=true
+derby.checksum.algorithm=MD5|SHA-1
+derby.checksum.value=abff01351b19bc62a188bac08a8bb58b|b64da6681994f33ba5783ffae55cdb44885b9e70
+derby-shared.checksum.enabled=true
+derby-shared.checksum.algorithm=MD5|SHA-1
+derby-shared.checksum.value=2cb9ab8b9cfb06c2da5a1d3825d04344|ff2dfb3e2a92d593cf111baad242d156947abbc1
+derby-tools.checksum.enabled=true
+derby-tools.checksum.algorithm=MD5|SHA-1
+derby-tools.checksum.value=d41578eeb336b0e479be8f30bfd9ab9b|d63722381e0e893d797e4d531e219e2917898364
+
+derby.home=${base.path}/derby-${derby.version}
+derby.jar=${derby.home}/derby-${derby.version}.jar
+derby.loc=${base-maven.loc}/org/apache/derby/derby/${derby.version}/derby-${derby.version}.jar
+derby-shared.jar=${derby.home}/derby-shared-${derby.version}.jar
+derby-shared.loc=${base-maven.loc}/org/apache/derby/derbyshared/${derby.version}/derbyshared-${derby.version}.jar
+derby-tools.jar=${derby.home}/derby-tools-${derby.version}.jar
+derby-tools.loc=${base-maven.loc}/org/apache/derby/derbytools/${derby.version}/derbytools-${derby.version}.jar
+
+
diff --git a/build.xml b/build.xml
index de0272b..172e923 100644
--- a/build.xml
+++ b/build.xml
@@ -261,6 +261,9 @@
 
 
 
+
+
+
 
 
   
@@ -3275,6 +3278,33 @@ skip.installer property in build.properties" />
   
 
 
+
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+
+
   
 
   
+  
+Add Apache Derby 10.15.2.0 to the testsuite dependencies, for JDBC
+and DataSource testing. (remm)
+  
 
   
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 04/13: Add a UserDatabase implementation based on DataSourceRealm

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 52f0a2fcffeba3054ab2494285b829a35eaff70c
Author: remm 
AuthorDate: Thu Aug 26 15:44:36 2021 +0200

Add a UserDatabase implementation based on DataSourceRealm

The goal is to showcase the UserDatabase somewhat more, and this can use
the minimal schema from the DataSourceRealm with reduced functionality.
The MBeans are different. The problem with the current behavior is that
the whole database ends up being registered as individual MBeans.
There's a new MBean that only uses operations. The MBeans from the
memory UserDatabase are still there, but they are only populated on
demand (however, guis often pull the attributes that populate them) and
they are unregistered when saving back.
Make related changes to the realm and its custom principal so that the
results are as dynamic as expected. Add an option for things to be more
static.
Will look into the ReentrantReadWriteLock that is used in the memory
UserDatabase.
The documentation itself will be straightforward.
---
 .../mbeans/DataSourceUserDatabaseMBean.java|  360 +
 .../apache/catalina/mbeans/LocalStrings.properties |1 +
 java/org/apache/catalina/mbeans/MBeanUtils.java|   30 +
 .../catalina/mbeans/SparseUserDatabaseMBean.java   |  369 +
 .../apache/catalina/realm/UserDatabaseRealm.java   |   63 +-
 .../catalina/users/DataSourceUserDatabase.java | 1405 
 .../users/DataSourceUserDatabaseFactory.java   |  163 +++
 java/org/apache/catalina/users/GenericGroup.java   |   10 +
 java/org/apache/catalina/users/GenericRole.java|   10 +
 java/org/apache/catalina/users/GenericUser.java|   10 +
 .../apache/catalina/users/LocalStrings.properties  |2 +
 .../apache/catalina/users/SparseUserDatabase.java  |   29 +
 .../apache/catalina/users/mbeans-descriptors.xml   |  346 +
 webapps/docs/changelog.xml |   10 +
 webapps/docs/config/realm.xml  |8 +
 15 files changed, 2813 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java 
b/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java
new file mode 100644
index 000..86f78ad
--- /dev/null
+++ b/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java
@@ -0,0 +1,360 @@
+/*
+ * 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.
+ */
+package org.apache.catalina.mbeans;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.catalina.Group;
+import org.apache.catalina.Role;
+import org.apache.catalina.User;
+import org.apache.catalina.UserDatabase;
+import org.apache.tomcat.util.modeler.BaseModelMBean;
+import org.apache.tomcat.util.modeler.ManagedBean;
+import org.apache.tomcat.util.modeler.Registry;
+
+/**
+ * A ModelMBean implementation for the
+ * org.apache.catalina.users.DataSourceUserDatabase component.
+ *
+ * @author Craig R. McClanahan
+ */
+public class DataSourceUserDatabaseMBean extends BaseModelMBean {
+
+// - Instance Variables
+
+/**
+ * The configuration information registry for our managed beans.
+ */
+protected final Registry registry = MBeanUtils.createRegistry();
+
+
+/**
+ * The ManagedBean information describing this MBean.
+ */
+protected final ManagedBean managed = 
registry.findManagedBean("DataSourceUserDatabase");
+
+
+// - Attributes
+
+/**
+ * @return the names of all groups defined in this database.
+ */
+public String[] getGroups() {
+UserDatabase database = (UserDatabase) this.resource;
+List results = new ArrayList<>();
+Iterator groups = database.getGroups();
+while (groups.hasNext()) {
+Group group = groups.next();
+results.add(group.getGroupname());
+}
+return results.toArray(new String[0]);
+}
+
+
+

[tomcat] 06/13: Add UserDatabase documentation

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 4457530e6ca84834d3d99813ebd4e8a3ce46e167
Author: remm 
AuthorDate: Fri Aug 27 09:56:32 2021 +0200

Add UserDatabase documentation
---
 webapps/docs/jndi-resources-howto.xml | 204 +-
 1 file changed, 202 insertions(+), 2 deletions(-)

diff --git a/webapps/docs/jndi-resources-howto.xml 
b/webapps/docs/jndi-resources-howto.xml
index 3888eaa..c3574c7 100644
--- a/webapps/docs/jndi-resources-howto.xml
+++ b/webapps/docs/jndi-resources-howto.xml
@@ -427,14 +427,14 @@ public class MyBean2 {
   
 
 
-  
+  
 
 0.  Introduction
 
 UserDatabase resources are typically configured as global resources for
 use by a UserDatabase realm. Tomcat includes a UserDatabaseFactory that
 creates UserDatabase resources backed by an XML file - usually
-tomcat-users.xml
+tomcat-users.xml.
 
 The steps required to set up a global UserDatabase resource are 
described
 below.
@@ -495,6 +495,206 @@ public class MyBean2 {
   
 
 
+  
+
+0.  Introduction
+
+Tomcat also include a UserDatabase that uses a
+DataSource resource as the backend. The backend resource
+must be declared in the same JNDI context as the user database that will 
use
+it.
+
+The steps required to set up a global UserDatabase resource are 
described
+below.
+
+1. Database schema
+
+The database shema for the user database is flexible. It can be the same
+as the schema used for the DataSourceRealm, with only a table
+for users (user name, password), and another one listing the roles
+associated with each user. To support the full UserDatabase
+features, it must include additional tables for groups, and is
+compatible with referential integrity between users, groups and roles.
+
+The full featured schema with groups and referential integrity
+could be:
+
+
+
+The minimal schema without the ability to use groups will be
+(it is the same as for the DataSourceRealm):
+
+
+
+2.  Declare Your Resource
+
+Next, modify $CATALINA_BASE/conf/server.xml to create the
+UserDatabase resource based on your DataSource and its schema.
+It should look something like this:
+
+
+
+The dataSourceName attribute is the JNDI name of the
+DataSource that will be the backend for the
+UserDatabase. It must be declared in the same JNDI
+Context as the UserDatabase. Please refer to the
+DataSource resources
+documentation for further instructions.
+
+The readonly attribute is optional and defaults to
+true if not supplied. If the database is writeable then 
changes
+made through the Tomcat management to the UserDatabase can
+be persisted to the database using the save operation.
+
+Alternately, changes can also be made directly to the backend database.
+
+
+3.  Resource configuration
+
+
+
+  
+The name of the JNDI JDBC DataSource for this UserDatabase.
+  
+
+  
+Name of the column, in the "groups", "group roles" and "user groups"
+tables, that contains the group's name.
+  
+
+  
+Name of the "group roles" table, which must contain columns
+named by the groupNameCol and roleNameCol
+attributes.
+  
+
+  
+Name of the "groups" table, which must contain columns named
+by the groupNameCol attribute.
+  
+
+  
+If this is set to true, then changes to the
+UserDatabase can be persisted to the
+DataSource by using the save method.
+The default value is false.
+  
+
+  
+Name of the column, in the "roles" and "groups" tables, that 
contains
+the description for the roles and groups.
+  
+
+  
+Name of the column, in the "roles", "user roles" and "group roles"
+tables, which contains a role name assigned to the corresponding
+user.
+  
+
+  
+Name of the "roles" table, which must contain columns named
+by the roleNameCol attribute.
+  
+
+  
+Name of the column, in the "users" table, which contains
+the user's credentials (i.e. password).  If a
+CredentialHandler is specified, this component
+will assume that the passwords have been encoded with the
+specified algorithm.  Otherwise, they will be assumed to be
+in clear text.
+  
+
+  
+Name of the "user groups" table, which must contain columns
+named by the userNameCol and groupNameCol
+attributes.
+  
+
+  
+Name of the column, in the "users", "user groups" and "user roles"
+   

[tomcat] 03/13: Add available flag for UserDatabase

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 75ef0585ff9c7ea4c72ab9044c499ae94818f28d
Author: remm 
AuthorDate: Wed Aug 25 22:36:17 2021 +0200

Add available flag for UserDatabase

Also avoid loading the whole database as MBeans, the behavior is fancy
but only makes sense for a memory user database.
---
 java/org/apache/catalina/UserDatabase.java | 22 ++
 .../mbeans/GlobalResourcesLifecycleListener.java   |  5 +
 .../apache/catalina/realm/UserDatabaseRealm.java   |  6 ++
 3 files changed, 33 insertions(+)

diff --git a/java/org/apache/catalina/UserDatabase.java 
b/java/org/apache/catalina/UserDatabase.java
index 9242170..713cc1d 100644
--- a/java/org/apache/catalina/UserDatabase.java
+++ b/java/org/apache/catalina/UserDatabase.java
@@ -198,4 +198,26 @@ public interface UserDatabase {
 public default void backgroundProcess() {
 // NO-OP by default
 }
+
+
+/**
+ * Is the database available.
+ *
+ * @return true
+ */
+public default boolean isAvailable() {
+return true;
+}
+
+
+/**
+ * Is the database data loaded on demand. This is used to avoid eager
+ * loading of the full database data, for example for JMX registration of
+ * all objects.
+ *
+ * @return false
+ */
+public default boolean isSparse() {
+return false;
+}
 }
diff --git 
a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java 
b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
index a86b486..bca1ed7 100644
--- a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
+++ b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
@@ -168,6 +168,11 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
 throw new 
IllegalArgumentException(sm.getString("globalResources.createError.userDatabase",
 name), e);
 }
 
+if (database.isSparse()) {
+// Avoid loading all the database as mbeans
+return;
+}
+
 // Create the MBeans for each defined Role
 Iterator roles = database.getRoles();
 while (roles.hasNext()) {
diff --git a/java/org/apache/catalina/realm/UserDatabaseRealm.java 
b/java/org/apache/catalina/realm/UserDatabaseRealm.java
index c13b706..477be7f 100644
--- a/java/org/apache/catalina/realm/UserDatabaseRealm.java
+++ b/java/org/apache/catalina/realm/UserDatabaseRealm.java
@@ -231,6 +231,12 @@ public class UserDatabaseRealm extends RealmBase {
 }
 
 
+@Override
+public boolean isAvailable() {
+return (database == null) ? false : database.isAvailable();
+}
+
+
 public static final class UserDatabasePrincipal extends GenericPrincipal {
 private static final long serialVersionUID = 1L;
 private final transient User user;

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 02/13: Fix Javadoc warning

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 4ccb9be92dcf4c5e4080a73d5f38e1aaee1d2e74
Author: Mark Thomas 
AuthorDate: Tue Aug 17 15:54:42 2021 +0100

Fix Javadoc warning
---
 java/org/apache/catalina/users/GenericGroup.java | 2 ++
 java/org/apache/catalina/users/GenericRole.java  | 2 ++
 java/org/apache/catalina/users/GenericUser.java  | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/java/org/apache/catalina/users/GenericGroup.java 
b/java/org/apache/catalina/users/GenericGroup.java
index d59e57d..986c9f7 100644
--- a/java/org/apache/catalina/users/GenericGroup.java
+++ b/java/org/apache/catalina/users/GenericGroup.java
@@ -31,6 +31,8 @@ import org.apache.catalina.UserDatabase;
  * Concrete implementation of {@link org.apache.catalina.Group} for a
  * {@link UserDatabase}.
  *
+ * @param  The specific type of UserDase with which this group is 
associated
+ *
  * @author Craig R. McClanahan
  */
 public class GenericGroup extends AbstractGroup {
diff --git a/java/org/apache/catalina/users/GenericRole.java 
b/java/org/apache/catalina/users/GenericRole.java
index c6b0eba..2957280 100644
--- a/java/org/apache/catalina/users/GenericRole.java
+++ b/java/org/apache/catalina/users/GenericRole.java
@@ -24,6 +24,8 @@ import org.apache.catalina.UserDatabase;
  * Concrete implementation of {@link org.apache.catalina.Role} for a
  * {@link UserDatabase}.
  *
+ * @param  The specific type of UserDase with which this role is associated
+ *
  * @author Craig R. McClanahan
  */
 public class GenericRole extends AbstractRole {
diff --git a/java/org/apache/catalina/users/GenericUser.java 
b/java/org/apache/catalina/users/GenericUser.java
index 77b70b4..7d69360 100644
--- a/java/org/apache/catalina/users/GenericUser.java
+++ b/java/org/apache/catalina/users/GenericUser.java
@@ -29,6 +29,8 @@ import org.apache.catalina.UserDatabase;
  * Concrete implementation of {@link org.apache.catalina.User} for a
  * {@link UserDatabase}.
  *
+ * @param  The specific type of UserDase with which this role is associated
+ *
  * @author Craig R. McClanahan
  */
 public class GenericUser extends AbstractUser {

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated (a700957 -> d7b6adb)

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a change to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


from a700957  Fix JSP API Javadoc warnings for Java 16
 new 6d95a7f  Improve the reusability of UserDatabase code
 new 4ccb9be  Fix Javadoc warning
 new 75ef058  Add available flag for UserDatabase
 new 52f0a2f  Add a UserDatabase implementation based on DataSourceRealm
 new 43c3791  Add lock use similar to the memory user database
 new 4457530  Add UserDatabase documentation
 new 785e076  Refactor to avoid NPE warnings in IDE
 new bb21272  Fix IDE warnings. Use <> where possible.
 new a20f224  Add hashCode implementations that are aligned with existing 
equals()
 new 86177f0  Add Derby for the testsuite
 new 6d2b63f  Fix group roles not working
 new e9945ac  Add first pass at tests for the DataSource UserDatabase
 new d7b6adb  Use Derby 10.14 for Java 8 compatibility

The 13 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.properties.default   |   19 +
 build.xml  |   20 +
 java/org/apache/catalina/UserDatabase.java |   49 +
 .../mbeans/DataSourceUserDatabaseMBean.java|  360 +
 .../mbeans/GlobalResourcesLifecycleListener.java   |5 +
 .../apache/catalina/mbeans/LocalStrings.properties |1 +
 java/org/apache/catalina/mbeans/MBeanUtils.java|   30 +
 .../catalina/mbeans/MemoryUserDatabaseMBean.java   |  277 +---
 ...baseMBean.java => SparseUserDatabaseMBean.java} |   77 +-
 .../apache/catalina/realm/UserDatabaseRealm.java   |   69 +-
 .../catalina/users/DataSourceUserDatabase.java | 1507 
 ...ory.java => DataSourceUserDatabaseFactory.java} |   86 +-
 .../users/{MemoryGroup.java => GenericGroup.java}  |   74 +-
 .../users/{MemoryRole.java => GenericRole.java}|   62 +-
 .../users/{MemoryUser.java => GenericUser.java}|  144 +-
 .../apache/catalina/users/LocalStrings.properties  |2 +
 java/org/apache/catalina/users/MemoryGroup.java|  116 +-
 java/org/apache/catalina/users/MemoryRole.java |   36 +-
 java/org/apache/catalina/users/MemoryUser.java |  158 +-
 .../apache/catalina/users/SparseUserDatabase.java  |   13 +-
 .../apache/catalina/users/mbeans-descriptors.xml   |  346 +
 .../users/DataSourceUserDatabaseTests.java |  228 +++
 webapps/docs/changelog.xml |   19 +
 webapps/docs/config/realm.xml  |8 +
 webapps/docs/jndi-resources-howto.xml  |  204 ++-
 25 files changed, 3169 insertions(+), 741 deletions(-)
 create mode 100644 
java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java
 copy java/org/apache/catalina/mbeans/{MemoryUserDatabaseMBean.java => 
SparseUserDatabaseMBean.java} (79%)
 create mode 100644 java/org/apache/catalina/users/DataSourceUserDatabase.java
 copy java/org/apache/catalina/users/{MemoryUserDatabaseFactory.java => 
DataSourceUserDatabaseFactory.java} (57%)
 copy java/org/apache/catalina/users/{MemoryGroup.java => GenericGroup.java} 
(69%)
 copy java/org/apache/catalina/users/{MemoryRole.java => GenericRole.java} (57%)
 copy java/org/apache/catalina/users/{MemoryUser.java => GenericUser.java} (62%)
 copy test/org/apache/catalina/loader/TesterNeverWeavedClass.java => 
java/org/apache/catalina/users/SparseUserDatabase.java (79%)
 create mode 100644 
test/org/apache/catalina/users/DataSourceUserDatabaseTests.java

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] 01/13: Improve the reusability of UserDatabase code

2021-09-01 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 6d95a7f8016aeb08155f26cea29125aef8e86616
Author: remm 
AuthorDate: Tue Aug 17 14:56:24 2021 +0200

Improve the reusability of UserDatabase code

Add intermediate concrete implementation classes. Add hooks to allow
partail database updates on save. Will likely make alternate
implementations more realistic.
---
 java/org/apache/catalina/UserDatabase.java |  27 
 .../users/{MemoryGroup.java => GenericGroup.java}  |  60 
 .../users/{MemoryRole.java => GenericRole.java}|  44 +++---
 .../users/{MemoryUser.java => GenericUser.java}| 126 
 java/org/apache/catalina/users/MemoryGroup.java| 116 +--
 java/org/apache/catalina/users/MemoryRole.java |  36 +
 java/org/apache/catalina/users/MemoryUser.java | 158 +
 webapps/docs/changelog.xml |   5 +
 8 files changed, 138 insertions(+), 434 deletions(-)

diff --git a/java/org/apache/catalina/UserDatabase.java 
b/java/org/apache/catalina/UserDatabase.java
index 8bac810..9242170 100644
--- a/java/org/apache/catalina/UserDatabase.java
+++ b/java/org/apache/catalina/UserDatabase.java
@@ -156,6 +156,33 @@ public interface UserDatabase {
 
 
 /**
+ * Signal the specified {@link Group} from this user database has been
+ * modified.
+ *
+ * @param group The group that has been modified
+ */
+public default void modifiedGroup(Group group) {}
+
+
+/**
+ * Signal the specified {@link Role} from this user database has been
+ * modified.
+ *
+ * @param role The role that has been modified
+ */
+public default void modifiedRole(Role role) {}
+
+
+/**
+ * Signal the specified {@link User} from this user database has been
+ * modified.
+ *
+ * @param user The user that has been modified
+ */
+public default void modifiedUser(User user) {}
+
+
+/**
  * Save any updated information to the persistent storage location for this
  * user database.
  *
diff --git a/java/org/apache/catalina/users/MemoryGroup.java 
b/java/org/apache/catalina/users/GenericGroup.java
similarity index 73%
copy from java/org/apache/catalina/users/MemoryGroup.java
copy to java/org/apache/catalina/users/GenericGroup.java
index aad4180..d59e57d 100644
--- a/java/org/apache/catalina/users/MemoryGroup.java
+++ b/java/org/apache/catalina/users/GenericGroup.java
@@ -25,17 +25,15 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import org.apache.catalina.Role;
 import org.apache.catalina.User;
 import org.apache.catalina.UserDatabase;
-import org.apache.tomcat.util.buf.StringUtils;
 
 
 /**
- * Concrete implementation of {@link org.apache.catalina.Group} for the
- * {@link MemoryUserDatabase} implementation of {@link UserDatabase}.
+ * Concrete implementation of {@link org.apache.catalina.Group} for a
+ * {@link UserDatabase}.
  *
  * @author Craig R. McClanahan
- * @since 4.1
  */
-public class MemoryGroup extends AbstractGroup {
+public class GenericGroup extends AbstractGroup {
 
 
 // --- Constructors
@@ -43,19 +41,23 @@ public class MemoryGroup extends AbstractGroup {
 
 /**
  * Package-private constructor used by the factory method in
- * {@link MemoryUserDatabase}.
+ * {@link UserDatabase}.
  *
- * @param database The {@link MemoryUserDatabase} that owns this group
+ * @param database The {@link UserDatabase} that owns this group
  * @param groupname Group name of this group
  * @param description Description of this group
+ * @param roles The roles of this group
  */
-MemoryGroup(MemoryUserDatabase database,
-String groupname, String description) {
+GenericGroup(UD database,
+String groupname, String description, List roles) {
 
 super();
 this.database = database;
-setGroupname(groupname);
-setDescription(description);
+this.groupname = groupname;
+this.description = description;
+if (roles != null) {
+this.roles.addAll(roles);
+}
 
 }
 
@@ -64,9 +66,9 @@ public class MemoryGroup extends AbstractGroup {
 
 
 /**
- * The {@link MemoryUserDatabase} that owns this group.
+ * The {@link UserDatabase} that owns this group.
  */
-protected final MemoryUserDatabase database;
+protected final UD database;
 
 
 /**
@@ -123,7 +125,9 @@ public class MemoryGroup extends AbstractGroup {
  */
 @Override
 public void addRole(Role role) {
-roles.addIfAbsent(role);
+if (roles.addIfAbsent(role)) {
+database.modifiedGroup(this);
+}
 }
 
 
@@ -145,7 +149,9 @@ public class MemoryGroup extends Abst

[tomcat] branch main updated: Add first pass at tests for the DataSource UserDatabase

2021-08-31 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 2da9e18  Add first pass at tests for the DataSource UserDatabase
2da9e18 is described below

commit 2da9e181f8251547425c9fe44b925dbb2f86b2a8
Author: remm 
AuthorDate: Tue Aug 31 21:37:47 2021 +0200

Add first pass at tests for the DataSource UserDatabase

Use a shortcut to allow independent testing without a real DataSource.
Test both the DataSourceRealm schema as well as the full schema with
groups.
Only glitch is that Derby leaves a derby.log, I haven't found how to
configure it away.
---
 .../users/DataSourceUserDatabaseTests.java | 228 +
 1 file changed, 228 insertions(+)

diff --git a/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java 
b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
new file mode 100644
index 000..5529917
--- /dev/null
+++ b/test/org/apache/catalina/users/DataSourceUserDatabaseTests.java
@@ -0,0 +1,228 @@
+/*
+ *  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.
+ */
+package org.apache.catalina.users;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.Iterator;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.catalina.Group;
+import org.apache.catalina.Role;
+import org.apache.catalina.User;
+import org.apache.catalina.startup.LoggingBaseTest;
+
+public class DataSourceUserDatabaseTests extends LoggingBaseTest {
+
+public static final String SIMPLE_SCHEMA =
+"create table users (\n"
++ "  user_name varchar(15) not null primary key,\n"
++ "  user_pass varchar(15) not null\n"
++ ");\n"
++ "create table user_roles (\n"
++ "  user_name varchar(15) not null,\n"
++ "  role_name varchar(15) not null,\n"
++ "  primary key (user_name, role_name)\n"
++ ");";
+
+public static final String FULL_SCHEMA =
+"create table users (\n"
++ "  user_name varchar(15) not null primary key,\n"
++ "  user_pass varchar(15) not null,\n"
++ "  user_fullname varchar(128)\n"
++ "  -- Add more attributes as needed\n"
++ ");\n"
++ "create table roles (\n"
++ "  role_name varchar(15) not null primary key,\n"
++ "  role_description  varchar(128)\n"
++ ");\n"
++ "create table groups (\n"
++ "  group_namevarchar(15) not null primary key,\n"
++ "  group_description varchar(128)\n"
++ ");\n"
++ "create table user_roles (\n"
++ "  user_name varchar(15) references users(user_name),\n"
++ "  role_name varchar(15) references roles(role_name),\n"
++ "  primary key (user_name, role_name)\n"
++ ");\n"
++ "create table user_groups (\n"
++ "  user_name varchar(15) references users(user_name),\n"
++ "  group_namevarchar(15) references 
groups(group_name),\n"
++ "  primary key (user_name, group_name)\n"
++ ");\n"
++ "create table group_roles (\n"
++ "  group_namevarchar(15) references 
groups(group_name),\n"
++ "  role_name varchar(15) references roles(role_name),\n"
++ "  primary key (group_name, role_name)\n"
++ ");";
+
+protected class DerbyUserDatabase extends DataSourceUserDatabase {
+  

[tomcat] branch main updated: Fix group roles not working

2021-08-31 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 5907d8f  Fix group roles not working
5907d8f is described below

commit 5907d8f284aa50cc970b43dd6352da143c95cd31
Author: remm 
AuthorDate: Tue Aug 31 21:34:41 2021 +0200

Fix group roles not working

Also for a simple schema, the roles didn't work properly. Now when
there's no role table, roles exist when they are assigned to a user.
---
 .../catalina/users/DataSourceUserDatabase.java | 26 +++---
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/java/org/apache/catalina/users/DataSourceUserDatabase.java 
b/java/org/apache/catalina/users/DataSourceUserDatabase.java
index a5bff3a..2c6eb5e 100644
--- a/java/org/apache/catalina/users/DataSourceUserDatabase.java
+++ b/java/org/apache/catalina/users/DataSourceUserDatabase.java
@@ -128,7 +128,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 /**
  * The generated string for the groups PreparedStatement
  */
-private String preparedGroupsR = null;
+private String preparedGroupRoles = null;
 
 
 /**
@@ -640,7 +640,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 ArrayList groupRoles = new ArrayList<>();
 if (groupName != null) {
 groupName = groupName.trim();
-try (PreparedStatement stmt2 = 
dbConnection.prepareStatement(preparedGroupsR)) {
+try (PreparedStatement stmt2 = 
dbConnection.prepareStatement(preparedGroupRoles)) {
 stmt2.setString(1, groupName);
 try (ResultSet rs2 = stmt2.executeQuery()) {
 while (rs2.next()) {
@@ -869,7 +869,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(" = ?");
 preparedRoles = temp.toString();
 
-if (userGroupTable != null && userGroupTable.length() > 0) {
+if (userGroupTable != null) {
 temp = new StringBuilder("SELECT ");
 temp.append(groupNameCol);
 temp.append(" FROM ");
@@ -880,15 +880,15 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 preparedGroups = temp.toString();
 }
 
-if (groupRoleTable != null && groupRoleTable.length() > 0) {
+if (groupRoleTable != null) {
 temp = new StringBuilder("SELECT ");
-temp.append(groupNameCol);
+temp.append(roleNameCol);
 temp.append(" FROM ");
 temp.append(groupRoleTable);
 temp.append(" WHERE ");
 temp.append(groupNameCol);
 temp.append(" = ?");
-preparedGroupsR = temp.toString();
+preparedGroupRoles = temp.toString();
 }
 
 temp = new StringBuilder("SELECT ");
@@ -909,7 +909,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(userTable);
 preparedAllUsers = temp.toString();
 
-if (groupTable != null && groupTable.length() > 0) {
+if (groupTable != null) {
 temp = new StringBuilder("SELECT ");
 temp.append(groupNameCol);
 if (roleAndGroupDescriptionCol != null) {
@@ -929,7 +929,7 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 preparedAllGroups = temp.toString();
 }
 
-if (roleTable != null && roleTable.length() > 0) {
+if (roleTable != null) {
 // Create the role PreparedStatement string
 temp = new StringBuilder("SELECT ");
 temp.append(roleNameCol);
@@ -948,6 +948,16 @@ public class DataSourceUserDatabase extends 
SparseUserDatabase {
 temp.append(" FROM ");
 temp.append(roleTable);
 preparedAllRoles = temp.toString();
+} else {
+// Validate roles existence from the user <-> roles table
+temp = new StringBuilder("SELECT ");
+temp.append(roleNameCol);
+temp.append(" FROM ");
+temp.append(userRoleTable);
+temp.append(" WHERE ");
+temp.append(roleNameCol);
+temp.append(" = ?");
+preparedRole = temp.toString();
 }
 
 } finally {

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Add Derby for the testsuite

2021-08-31 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 7a82963  Add Derby for the testsuite
7a82963 is described below

commit 7a82963a78a8242b3c8c276de2382594f8a74f42
Author: remm 
AuthorDate: Tue Aug 31 21:32:10 2021 +0200

Add Derby for the testsuite

It can be used for JDBC testing. Also for DataSource with our pools.
---
 build.properties.default   | 24 
 build.xml  | 30 ++
 webapps/docs/changelog.xml |  4 
 3 files changed, 58 insertions(+)

diff --git a/build.properties.default b/build.properties.default
index 4032660..53fe36e 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -331,3 +331,27 @@ 
jsign.checksum.value=50982facf864df4f08a051b43f7d2e42|3d203fbffdc45e837f98b7c9c5
 jsign.home=${base.path}/jsign-${jsign.version}
 jsign.jar=${jsign.home}/jsign-${jsign.version}.jar
 
jsign.loc=${base-maven.loc}/net/jsign/jsign/${jsign.version}/jsign-${jsign.version}.jar
+
+# - Derby, used by unit tests -
+derby.version=10.15.2.0
+
+# checksums for Derby 10.15.2.0
+derby.checksum.enabled=true
+derby.checksum.algorithm=MD5|SHA-1
+derby.checksum.value=abff01351b19bc62a188bac08a8bb58b|b64da6681994f33ba5783ffae55cdb44885b9e70
+derby-shared.checksum.enabled=true
+derby-shared.checksum.algorithm=MD5|SHA-1
+derby-shared.checksum.value=2cb9ab8b9cfb06c2da5a1d3825d04344|ff2dfb3e2a92d593cf111baad242d156947abbc1
+derby-tools.checksum.enabled=true
+derby-tools.checksum.algorithm=MD5|SHA-1
+derby-tools.checksum.value=d41578eeb336b0e479be8f30bfd9ab9b|d63722381e0e893d797e4d531e219e2917898364
+
+derby.home=${base.path}/derby-${derby.version}
+derby.jar=${derby.home}/derby-${derby.version}.jar
+derby.loc=${base-maven.loc}/org/apache/derby/derby/${derby.version}/derby-${derby.version}.jar
+derby-shared.jar=${derby.home}/derby-shared-${derby.version}.jar
+derby-shared.loc=${base-maven.loc}/org/apache/derby/derbyshared/${derby.version}/derbyshared-${derby.version}.jar
+derby-tools.jar=${derby.home}/derby-tools-${derby.version}.jar
+derby-tools.loc=${base-maven.loc}/org/apache/derby/derbytools/${derby.version}/derbytools-${derby.version}.jar
+
+
diff --git a/build.xml b/build.xml
index 330bcd7..2459234 100644
--- a/build.xml
+++ b/build.xml
@@ -234,6 +234,9 @@
 
 
 
+
+
+
 
 
   
@@ -3230,6 +3233,33 @@ skip.installer property in build.properties" />
   
 
 
+
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+
+
+
+  
+  
+  
+  
+  
+  
+
+
   
 
   
+  
+Add Apache Derby 10.15.2.0 to the testsuite dependencies, for JDBC
+and DataSource testing. (remm)
+  
 
   
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Add UserDatabase documentation

2021-08-27 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 0c1915d  Add UserDatabase documentation
0c1915d is described below

commit 0c1915dd188bc0180cbc918cdc3cba8d40fa7e6d
Author: remm 
AuthorDate: Fri Aug 27 09:56:32 2021 +0200

Add UserDatabase documentation
---
 webapps/docs/jndi-resources-howto.xml | 204 +-
 1 file changed, 202 insertions(+), 2 deletions(-)

diff --git a/webapps/docs/jndi-resources-howto.xml 
b/webapps/docs/jndi-resources-howto.xml
index 3888eaa..c3574c7 100644
--- a/webapps/docs/jndi-resources-howto.xml
+++ b/webapps/docs/jndi-resources-howto.xml
@@ -427,14 +427,14 @@ public class MyBean2 {
   
 
 
-  
+  
 
 0.  Introduction
 
 UserDatabase resources are typically configured as global resources for
 use by a UserDatabase realm. Tomcat includes a UserDatabaseFactory that
 creates UserDatabase resources backed by an XML file - usually
-tomcat-users.xml
+tomcat-users.xml.
 
 The steps required to set up a global UserDatabase resource are 
described
 below.
@@ -495,6 +495,206 @@ public class MyBean2 {
   
 
 
+  
+
+0.  Introduction
+
+Tomcat also include a UserDatabase that uses a
+DataSource resource as the backend. The backend resource
+must be declared in the same JNDI context as the user database that will 
use
+it.
+
+The steps required to set up a global UserDatabase resource are 
described
+below.
+
+1. Database schema
+
+The database shema for the user database is flexible. It can be the same
+as the schema used for the DataSourceRealm, with only a table
+for users (user name, password), and another one listing the roles
+associated with each user. To support the full UserDatabase
+features, it must include additional tables for groups, and is
+compatible with referential integrity between users, groups and roles.
+
+The full featured schema with groups and referential integrity
+could be:
+
+
+
+The minimal schema without the ability to use groups will be
+(it is the same as for the DataSourceRealm):
+
+
+
+2.  Declare Your Resource
+
+Next, modify $CATALINA_BASE/conf/server.xml to create the
+UserDatabase resource based on your DataSource and its schema.
+It should look something like this:
+
+
+
+The dataSourceName attribute is the JNDI name of the
+DataSource that will be the backend for the
+UserDatabase. It must be declared in the same JNDI
+Context as the UserDatabase. Please refer to the
+DataSource resources
+documentation for further instructions.
+
+The readonly attribute is optional and defaults to
+true if not supplied. If the database is writeable then 
changes
+made through the Tomcat management to the UserDatabase can
+be persisted to the database using the save operation.
+
+Alternately, changes can also be made directly to the backend database.
+
+
+3.  Resource configuration
+
+
+
+  
+The name of the JNDI JDBC DataSource for this UserDatabase.
+  
+
+  
+Name of the column, in the "groups", "group roles" and "user groups"
+tables, that contains the group's name.
+  
+
+  
+Name of the "group roles" table, which must contain columns
+named by the groupNameCol and roleNameCol
+attributes.
+  
+
+  
+Name of the "groups" table, which must contain columns named
+by the groupNameCol attribute.
+  
+
+  
+If this is set to true, then changes to the
+UserDatabase can be persisted to the
+DataSource by using the save method.
+The default value is false.
+  
+
+  
+Name of the column, in the "roles" and "groups" tables, that 
contains
+the description for the roles and groups.
+  
+
+  
+Name of the column, in the "roles", "user roles" and "group roles"
+tables, which contains a role name assigned to the corresponding
+user.
+  
+
+  
+Name of the "roles" table, which must contain columns named
+by the roleNameCol attribute.
+  
+
+  
+Name of the column, in the "users" table, which contains
+the user's credentials (i.e. password).  If a
+CredentialHandler is specified, this component
+will assume that the passwords have been encoded with the
+specified algorithm.  Otherwise, they will be assumed to be
+in clear text.
+  
+
+  
+Name of the "user groups" table, which must contain columns
+named by the userNameCol and groupNameCol
+attributes.
+

[tomcat] branch main updated: Add lock use similar to the memory user database

2021-08-26 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 6382197  Add lock use similar to the memory user database
6382197 is described below

commit 6382197ad57738dc06209845541c728e584f7c5a
Author: remm 
AuthorDate: Thu Aug 26 16:40:44 2021 +0200

Add lock use similar to the memory user database

Remove duplicated code, I verified the memory MBean works fine.
---
 .../catalina/mbeans/MemoryUserDatabaseMBean.java   | 277 +--
 .../catalina/mbeans/SparseUserDatabaseMBean.java   |  59 +--
 .../apache/catalina/realm/UserDatabaseRealm.java   |   2 +-
 .../catalina/users/DataSourceUserDatabase.java | 553 -
 4 files changed, 354 insertions(+), 537 deletions(-)

diff --git a/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java 
b/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
index b8fc248..7105cf8 100644
--- a/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
+++ b/java/org/apache/catalina/mbeans/MemoryUserDatabaseMBean.java
@@ -16,21 +16,7 @@
  */
 package org.apache.catalina.mbeans;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.apache.catalina.Group;
-import org.apache.catalina.Role;
-import org.apache.catalina.User;
-import org.apache.catalina.UserDatabase;
-import org.apache.tomcat.util.modeler.BaseModelMBean;
 import org.apache.tomcat.util.modeler.ManagedBean;
-import org.apache.tomcat.util.modeler.Registry;
-import org.apache.tomcat.util.res.StringManager;
 
 /**
  * A ModelMBean implementation for the
@@ -38,272 +24,11 @@ import org.apache.tomcat.util.res.StringManager;
  *
  * @author Craig R. McClanahan
  */
-public class MemoryUserDatabaseMBean extends BaseModelMBean {
-
-private static final StringManager sm = 
StringManager.getManager(MemoryUserDatabaseMBean.class);
-
-// - Instance Variables
-
-/**
- * The configuration information registry for our managed beans.
- */
-protected final Registry registry = MBeanUtils.createRegistry();
-
+public class MemoryUserDatabaseMBean extends SparseUserDatabaseMBean {
 
 /**
  * The ManagedBean information describing this MBean.
  */
 protected final ManagedBean managed = 
registry.findManagedBean("MemoryUserDatabase");
 
-
-/**
- * The ManagedBean information describing Group MBeans.
- */
-protected final ManagedBean managedGroup = 
registry.findManagedBean("Group");
-
-
-/**
- * The ManagedBean information describing Group MBeans.
- */
-protected final ManagedBean managedRole = registry.findManagedBean("Role");
-
-
-/**
- * The ManagedBean information describing User MBeans.
- */
-protected final ManagedBean managedUser = registry.findManagedBean("User");
-
-
-// - Attributes
-
-/**
- * @return the MBean Names of all groups defined in this database.
- */
-public String[] getGroups() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator groups = database.getGroups();
-while (groups.hasNext()) {
-Group group = groups.next();
-results.add(findGroup(group.getGroupname()));
-}
-return results.toArray(new String[0]);
-}
-
-
-/**
- * @return the MBean Names of all roles defined in this database.
- */
-public String[] getRoles() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator roles = database.getRoles();
-while (roles.hasNext()) {
-Role role = roles.next();
-results.add(findRole(role.getRolename()));
-}
-return results.toArray(new String[0]);
-}
-
-
-/**
- * @return the MBean Names of all users defined in this database.
- */
-public String[] getUsers() {
-UserDatabase database = (UserDatabase) this.resource;
-List results = new ArrayList<>();
-Iterator users = database.getUsers();
-while (users.hasNext()) {
-User user = users.next();
-results.add(findUser(user.getUsername()));
-}
-return results.toArray(new String[0]);
-}
-
-
-// - Operations
-
-/**
- * Create a new Group and return the corresponding MBean Name.
- *
- * @param groupname Group name of the new group
- * @param description Description of the new group
- * @return the new group object nam

[tomcat] branch main updated: Add a UserDatabase implementation based on DataSourceRealm

2021-08-26 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 299d061  Add a UserDatabase implementation based on DataSourceRealm
299d061 is described below

commit 299d061080774d3a898335d11bc981b23caa859d
Author: remm 
AuthorDate: Thu Aug 26 15:44:36 2021 +0200

Add a UserDatabase implementation based on DataSourceRealm

The goal is to showcase the UserDatabase somewhat more, and this can use
the minimal schema from the DataSourceRealm with reduced functionality.
The MBeans are different. The problem with the current behavior is that
the whole database ends up being registered as individual MBeans.
There's a new MBean that only uses operations. The MBeans from the
memory UserDatabase are still there, but they are only populated on
demand (however, guis often pull the attributes that populate them) and
they are unregistered when saving back.
Make related changes to the realm and its custom principal so that the
results are as dynamic as expected. Add an option for things to be more
static.
Will look into the ReentrantReadWriteLock that is used in the memory
UserDatabase.
The documentation itself will be straightforward.
---
 .../mbeans/DataSourceUserDatabaseMBean.java|  360 +
 .../apache/catalina/mbeans/LocalStrings.properties |1 +
 java/org/apache/catalina/mbeans/MBeanUtils.java|   30 +
 .../catalina/mbeans/SparseUserDatabaseMBean.java   |  369 +
 .../apache/catalina/realm/UserDatabaseRealm.java   |   63 +-
 .../catalina/users/DataSourceUserDatabase.java | 1405 
 .../users/DataSourceUserDatabaseFactory.java   |  163 +++
 java/org/apache/catalina/users/GenericGroup.java   |   10 +
 java/org/apache/catalina/users/GenericRole.java|   10 +
 java/org/apache/catalina/users/GenericUser.java|   10 +
 .../apache/catalina/users/LocalStrings.properties  |2 +
 .../apache/catalina/users/SparseUserDatabase.java  |   29 +
 .../apache/catalina/users/mbeans-descriptors.xml   |  346 +
 webapps/docs/changelog.xml |   10 +
 webapps/docs/config/realm.xml  |8 +
 15 files changed, 2813 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java 
b/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java
new file mode 100644
index 000..86f78ad
--- /dev/null
+++ b/java/org/apache/catalina/mbeans/DataSourceUserDatabaseMBean.java
@@ -0,0 +1,360 @@
+/*
+ * 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.
+ */
+package org.apache.catalina.mbeans;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.catalina.Group;
+import org.apache.catalina.Role;
+import org.apache.catalina.User;
+import org.apache.catalina.UserDatabase;
+import org.apache.tomcat.util.modeler.BaseModelMBean;
+import org.apache.tomcat.util.modeler.ManagedBean;
+import org.apache.tomcat.util.modeler.Registry;
+
+/**
+ * A ModelMBean implementation for the
+ * org.apache.catalina.users.DataSourceUserDatabase component.
+ *
+ * @author Craig R. McClanahan
+ */
+public class DataSourceUserDatabaseMBean extends BaseModelMBean {
+
+// - Instance Variables
+
+/**
+ * The configuration information registry for our managed beans.
+ */
+protected final Registry registry = MBeanUtils.createRegistry();
+
+
+/**
+ * The ManagedBean information describing this MBean.
+ */
+protected final ManagedBean managed = 
registry.findManagedBean("DataSourceUserDatabase");
+
+
+// - Attributes
+
+/**
+ * @return the names of all groups defined in this database.
+ */
+public String[] getGroups() {
+UserDatabase database = (UserDatabase) this.resource;
+List results = new ArrayList<>();
+Iterator groups = database.getGroups();
+while (groups.h

[tomcat] branch main updated: Add available flag for UserDatabase

2021-08-25 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 459cbf6  Add available flag for UserDatabase
459cbf6 is described below

commit 459cbf6bd96a0488f205f090efba34520186066e
Author: remm 
AuthorDate: Wed Aug 25 22:36:17 2021 +0200

Add available flag for UserDatabase

Also avoid loading the whole database as MBeans, the behavior is fancy
but only makes sense for a memory user database.
---
 java/org/apache/catalina/UserDatabase.java | 22 ++
 .../mbeans/GlobalResourcesLifecycleListener.java   |  5 +
 .../apache/catalina/realm/UserDatabaseRealm.java   |  6 ++
 3 files changed, 33 insertions(+)

diff --git a/java/org/apache/catalina/UserDatabase.java 
b/java/org/apache/catalina/UserDatabase.java
index 9242170..713cc1d 100644
--- a/java/org/apache/catalina/UserDatabase.java
+++ b/java/org/apache/catalina/UserDatabase.java
@@ -198,4 +198,26 @@ public interface UserDatabase {
 public default void backgroundProcess() {
 // NO-OP by default
 }
+
+
+/**
+ * Is the database available.
+ *
+ * @return true
+ */
+public default boolean isAvailable() {
+return true;
+}
+
+
+/**
+ * Is the database data loaded on demand. This is used to avoid eager
+ * loading of the full database data, for example for JMX registration of
+ * all objects.
+ *
+ * @return false
+ */
+public default boolean isSparse() {
+return false;
+}
 }
diff --git 
a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java 
b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
index a86b486..bca1ed7 100644
--- a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
+++ b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
@@ -168,6 +168,11 @@ public class GlobalResourcesLifecycleListener implements 
LifecycleListener {
 throw new 
IllegalArgumentException(sm.getString("globalResources.createError.userDatabase",
 name), e);
 }
 
+if (database.isSparse()) {
+// Avoid loading all the database as mbeans
+return;
+}
+
 // Create the MBeans for each defined Role
 Iterator roles = database.getRoles();
 while (roles.hasNext()) {
diff --git a/java/org/apache/catalina/realm/UserDatabaseRealm.java 
b/java/org/apache/catalina/realm/UserDatabaseRealm.java
index c13b706..477be7f 100644
--- a/java/org/apache/catalina/realm/UserDatabaseRealm.java
+++ b/java/org/apache/catalina/realm/UserDatabaseRealm.java
@@ -231,6 +231,12 @@ public class UserDatabaseRealm extends RealmBase {
 }
 
 
+@Override
+public boolean isAvailable() {
+return (database == null) ? false : database.isAvailable();
+}
+
+
 public static final class UserDatabasePrincipal extends GenericPrincipal {
 private static final long serialVersionUID = 1L;
 private final transient User user;

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Add release date

2021-08-24 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 5f0840e  Add release date
5f0840e is described below

commit 5f0840ea62b315b9df9db0e1084923f5a089b6e0
Author: remm 
AuthorDate: Tue Aug 24 10:01:58 2021 +0200

Add release date

Forgot to update this.
---
 webapps/docs/changelog.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4e0b747..cfe94d9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -183,7 +183,7 @@
 
   
 
-
+
   
 
   

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Cleanup javadoc on finalize

2021-08-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new e71d7d0  Cleanup javadoc on finalize
e71d7d0 is described below

commit e71d7d0379d0e53b2d3a089d79e9e96f78695bfa
Author: remm 
AuthorDate: Mon Aug 23 14:28:38 2021 +0200

Cleanup javadoc on finalize

Probably not the best advice anyway.
---
 java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java | 2 +-
 java/org/apache/catalina/tribes/tipis/ReplicatedMap.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java 
b/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
index d0a6cff..9e629d6 100644
--- a/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
@@ -57,7 +57,7 @@ import org.apache.juli.logging.LogFactory;
  * each time the object gets replicated the entire object gets serialized, 
hence a call to replicate(true)
  * will replicate all objects in this map that are using this node as primary.
  *
- * REMEMBER TO CALL breakdown() or 
finalize() when you are done with the map to
+ * REMEMBER TO CALL breakdown() when you are done 
with the map to
  * avoid memory leaks.
  * TODO implement periodic sync/transfer thread
  *
diff --git a/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java 
b/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
index cc01312..26d1c00 100644
--- a/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
@@ -44,7 +44,7 @@ import org.apache.juli.logging.LogFactory;
  * each time the object gets replicated the entire object gets serialized, 
hence a call to replicate(true)
  * will replicate all objects in this map that are using this node as primary.
  *
- * REMEMBER TO CALL breakdown() or 
finalize()
+ * REMEMBER TO CALL breakdown()
  * when you are done with the map to avoid memory leaks.
  * TODO implement periodic sync/transfer thread
  * TODO memberDisappeared, should do nothing except change map membership

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Cleanup javadoc on finalize

2021-08-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 1b532da  Cleanup javadoc on finalize
1b532da is described below

commit 1b532dac12f2139c8380c882ac7d2b2486409d3a
Author: remm 
AuthorDate: Mon Aug 23 14:28:38 2021 +0200

Cleanup javadoc on finalize

Probably not the best advice anyway.
---
 java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java | 2 +-
 java/org/apache/catalina/tribes/tipis/ReplicatedMap.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java 
b/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
index 72d2ba8..97e0586 100644
--- a/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
@@ -57,7 +57,7 @@ import org.apache.juli.logging.LogFactory;
  * each time the object gets replicated the entire object gets serialized, 
hence a call to replicate(true)
  * will replicate all objects in this map that are using this node as primary.
  *
- * REMEMBER TO CALL breakdown() or 
finalize() when you are done with the map to
+ * REMEMBER TO CALL breakdown() when you are done 
with the map to
  * avoid memory leaks.
  * TODO implement periodic sync/transfer thread
  *
diff --git a/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java 
b/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
index 4f2f0f8..5d6d758 100644
--- a/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
@@ -44,7 +44,7 @@ import org.apache.juli.logging.LogFactory;
  * each time the object gets replicated the entire object gets serialized, 
hence a call to replicate(true)
  * will replicate all objects in this map that are using this node as primary.
  *
- * REMEMBER TO CALL breakdown() or 
finalize()
+ * REMEMBER TO CALL breakdown()
  * when you are done with the map to avoid memory leaks.
  * TODO implement periodic sync/transfer thread
  * TODO memberDisappeared, should do nothing except change map membership

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Cleanup javadoc on finalize

2021-08-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new 6e21720  Cleanup javadoc on finalize
6e21720 is described below

commit 6e21720f8efc4ff969d36d41c87e9e33ecac96f7
Author: remm 
AuthorDate: Mon Aug 23 14:28:38 2021 +0200

Cleanup javadoc on finalize

Probably not the best advice anyway.
---
 java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java | 2 +-
 java/org/apache/catalina/tribes/tipis/ReplicatedMap.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java 
b/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
index 72d2ba8..97e0586 100644
--- a/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
@@ -57,7 +57,7 @@ import org.apache.juli.logging.LogFactory;
  * each time the object gets replicated the entire object gets serialized, 
hence a call to replicate(true)
  * will replicate all objects in this map that are using this node as primary.
  *
- * REMEMBER TO CALL breakdown() or 
finalize() when you are done with the map to
+ * REMEMBER TO CALL breakdown() when you are done 
with the map to
  * avoid memory leaks.
  * TODO implement periodic sync/transfer thread
  *
diff --git a/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java 
b/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
index 4f2f0f8..5d6d758 100644
--- a/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
@@ -44,7 +44,7 @@ import org.apache.juli.logging.LogFactory;
  * each time the object gets replicated the entire object gets serialized, 
hence a call to replicate(true)
  * will replicate all objects in this map that are using this node as primary.
  *
- * REMEMBER TO CALL breakdown() or 
finalize()
+ * REMEMBER TO CALL breakdown()
  * when you are done with the map to avoid memory leaks.
  * TODO implement periodic sync/transfer thread
  * TODO memberDisappeared, should do nothing except change map membership

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Cleanup javadoc on finalize

2021-08-23 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new de1b5ec  Cleanup javadoc on finalize
de1b5ec is described below

commit de1b5ecaa1a3c54e3f5e0c067ff3bd0b412c2600
Author: remm 
AuthorDate: Mon Aug 23 14:28:38 2021 +0200

Cleanup javadoc on finalize

Probably not the best advice anyway.
---
 java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java | 2 +-
 java/org/apache/catalina/tribes/tipis/ReplicatedMap.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java 
b/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
index 72d2ba8..97e0586 100644
--- a/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
@@ -57,7 +57,7 @@ import org.apache.juli.logging.LogFactory;
  * each time the object gets replicated the entire object gets serialized, 
hence a call to replicate(true)
  * will replicate all objects in this map that are using this node as primary.
  *
- * REMEMBER TO CALL breakdown() or 
finalize() when you are done with the map to
+ * REMEMBER TO CALL breakdown() when you are done 
with the map to
  * avoid memory leaks.
  * TODO implement periodic sync/transfer thread
  *
diff --git a/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java 
b/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
index 4f2f0f8..5d6d758 100644
--- a/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
+++ b/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
@@ -44,7 +44,7 @@ import org.apache.juli.logging.LogFactory;
  * each time the object gets replicated the entire object gets serialized, 
hence a call to replicate(true)
  * will replicate all objects in this map that are using this node as primary.
  *
- * REMEMBER TO CALL breakdown() or 
finalize()
+ * REMEMBER TO CALL breakdown()
  * when you are done with the map to avoid memory leaks.
  * TODO implement periodic sync/transfer thread
  * TODO memberDisappeared, should do nothing except change map membership

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Fix validate

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 79f81bf  Fix validate
79f81bf is described below

commit 79f81bf8a55b62b470d526a4d887ee025c451d53
Author: remm 
AuthorDate: Wed Aug 18 16:59:47 2021 +0200

Fix validate
---
 BUILDING.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BUILDING.txt b/BUILDING.txt
index 403c55d..5bb6184 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -256,7 +256,7 @@ You can build them by using the following commands:
 environment, the build scripts assume that Wine is available. If this is 
not
 the case, the skip.installer property may be set to skip the creation of 
the
 Windows installer.
-
+
 Provided that Wine is available on non-Windows platforms, a full release
 build may be made on Windows, Linux or MacOS.
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Fix validate

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 81ff9ca  Fix validate
81ff9ca is described below

commit 81ff9ca5776577e39fc95aa805326181bb07a5d0
Author: remm 
AuthorDate: Wed Aug 18 16:59:47 2021 +0200

Fix validate
---
 BUILDING.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BUILDING.txt b/BUILDING.txt
index 9cba430..f765f2e 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -256,7 +256,7 @@ You can build them by using the following commands:
 environment, the build scripts assume that Wine is available. If this is 
not
 the case, the skip.installer property may be set to skip the creation of 
the
 Windows installer.
-
+
 Provided that Wine is available on non-Windows platforms, a full release
 build may be made on Windows, Linux or MacOS.
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Fix validate

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new bfa4fb1  Fix validate
bfa4fb1 is described below

commit bfa4fb118a61f1aff569ee700bda25758225c64b
Author: remm 
AuthorDate: Wed Aug 18 16:59:47 2021 +0200

Fix validate
---
 BUILDING.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BUILDING.txt b/BUILDING.txt
index 2a5849b..4945f96 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -257,7 +257,7 @@ You can build them by using the following commands:
 environment, the build scripts assume that Wine is available. If this is 
not
 the case, the skip.installer property may be set to skip the creation of 
the
 Windows installer.
-
+
 Provided that Wine is available on non-Windows platforms, a full release
 build may be made on Windows, Linux or MacOS.
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Fix validate

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 7a82338  Fix validate
7a82338 is described below

commit 7a8233880b873782ec8efeee742c7a10b7bec41b
Author: remm 
AuthorDate: Wed Aug 18 16:59:47 2021 +0200

Fix validate
---
 BUILDING.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BUILDING.txt b/BUILDING.txt
index f5fd465..07f462f 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -257,7 +257,7 @@ You can build them by using the following commands:
 environment, the build scripts assume that Wine is available. If this is 
not
 the case, the skip.installer property may be set to skip the creation of 
the
 Windows installer.
-
+
 Provided that Wine is available on non-Windows platforms, a full release
 build may be made on Windows, Linux or MacOS.
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Fix write timeout check

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 857eb76  Fix write timeout check
857eb76 is described below

commit 857eb76880cfc96bc058dbf5361c52974bdfcc17
Author: remm 
AuthorDate: Wed Aug 18 16:54:36 2021 +0200

Fix write timeout check

BZ 65506. Fix write timeout check that was using the read timeout value.
Patch submitted by Gustavo Mahlow
---
 java/org/apache/tomcat/websocket/WsSession.java | 2 +-
 webapps/docs/changelog.xml  | 8 
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/websocket/WsSession.java 
b/java/org/apache/tomcat/websocket/WsSession.java
index 8e83d1c..595eec2 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -1030,7 +1030,7 @@ public class WsSession implements Session {
 
 if (timeoutRead > 0 && (currentTime - lastActiveRead) > timeoutRead) {
 key = "wsSession.timeoutRead";
-} else if (timeoutWrite > 0 && (currentTime - lastActiveWrite) > 
timeoutRead) {
+} else if (timeoutWrite > 0 && (currentTime - lastActiveWrite) > 
timeoutWrite) {
 key = "wsSession.timeoutWrite";
 } else if (timeout > 0 && (currentTime - lastActiveRead) > timeout &&
 (currentTime - lastActiveWrite) > timeout) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 9666a16..d3e074d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -145,6 +145,14 @@
   
 
   
+  
+
+  
+65506: Fix write timeout check that was using the read
+timeout value. Patch submitted by Gustavo Mahlow. (remm)
+  
+
+  
   
 
   

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Fix write timeout check

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new ed1e58c  Fix write timeout check
ed1e58c is described below

commit ed1e58c39070d8fef8bda86d7d45640ae724a3d5
Author: remm 
AuthorDate: Wed Aug 18 16:54:36 2021 +0200

Fix write timeout check

BZ 65506. Fix write timeout check that was using the read timeout value.
Patch submitted by Gustavo Mahlow
---
 java/org/apache/tomcat/websocket/WsSession.java | 2 +-
 webapps/docs/changelog.xml  | 8 
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/websocket/WsSession.java 
b/java/org/apache/tomcat/websocket/WsSession.java
index 8e83d1c..595eec2 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -1030,7 +1030,7 @@ public class WsSession implements Session {
 
 if (timeoutRead > 0 && (currentTime - lastActiveRead) > timeoutRead) {
 key = "wsSession.timeoutRead";
-} else if (timeoutWrite > 0 && (currentTime - lastActiveWrite) > 
timeoutRead) {
+} else if (timeoutWrite > 0 && (currentTime - lastActiveWrite) > 
timeoutWrite) {
 key = "wsSession.timeoutWrite";
 } else if (timeout > 0 && (currentTime - lastActiveRead) > timeout &&
 (currentTime - lastActiveWrite) > timeout) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 204fe7f..4e0b747 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -145,6 +145,14 @@
   
 
   
+  
+
+  
+65506: Fix write timeout check that was using the read
+timeout value. Patch submitted by Gustavo Mahlow. (remm)
+  
+
+  
   
 
   

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Fix write timeout check

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new a94019e  Fix write timeout check
a94019e is described below

commit a94019ed79ae01196dfab325d9820e2d520cd442
Author: remm 
AuthorDate: Wed Aug 18 16:54:36 2021 +0200

Fix write timeout check

BZ 65506. Fix write timeout check that was using the read timeout value.
Patch submitted by Gustavo Mahlow
---
 java/org/apache/tomcat/websocket/WsSession.java | 2 +-
 webapps/docs/changelog.xml  | 8 
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/websocket/WsSession.java 
b/java/org/apache/tomcat/websocket/WsSession.java
index 3a37d66..03812d0 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -1031,7 +1031,7 @@ public class WsSession implements Session {
 
 if (timeoutRead > 0 && (currentTime - lastActiveRead) > timeoutRead) {
 key = "wsSession.timeoutRead";
-} else if (timeoutWrite > 0 && (currentTime - lastActiveWrite) > 
timeoutRead) {
+} else if (timeoutWrite > 0 && (currentTime - lastActiveWrite) > 
timeoutWrite) {
 key = "wsSession.timeoutWrite";
 } else if (timeout > 0 && (currentTime - lastActiveRead) > timeout &&
 (currentTime - lastActiveWrite) > timeout) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 1c31290..65f1702 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -145,6 +145,14 @@
   
 
   
+  
+
+  
+65506: Fix write timeout check that was using the read
+timeout value. Patch submitted by Gustavo Mahlow. (remm)
+  
+
+  
   
 
   

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Fix write timeout check

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 9cc94bd  Fix write timeout check
9cc94bd is described below

commit 9cc94bd751d90c0a3f65e58198293b88f5318de9
Author: remm 
AuthorDate: Wed Aug 18 16:54:36 2021 +0200

Fix write timeout check

BZ 65506. Fix write timeout check that was using the read timeout value.
Patch submitted by Gustavo Mahlow
---
 java/org/apache/tomcat/websocket/WsSession.java | 2 +-
 webapps/docs/changelog.xml  | 8 
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/websocket/WsSession.java 
b/java/org/apache/tomcat/websocket/WsSession.java
index 3f33099..5859a02 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -937,7 +937,7 @@ public class WsSession implements Session {
 
 if (timeoutRead > 0 && (currentTime - lastActiveRead) > timeoutRead) {
 key = "wsSession.timeoutRead";
-} else if (timeoutWrite > 0 && (currentTime - lastActiveWrite) > 
timeoutRead) {
+} else if (timeoutWrite > 0 && (currentTime - lastActiveWrite) > 
timeoutWrite) {
 key = "wsSession.timeoutWrite";
 } else if (timeout > 0 && (currentTime - lastActiveRead) > timeout &&
 (currentTime - lastActiveWrite) > timeout) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6a741f7..e720724 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -150,6 +150,14 @@
   
 
   
+  
+
+  
+65506: Fix write timeout check that was using the read
+timeout value. Patch submitted by Gustavo Mahlow. (remm)
+  
+
+  
   
 
   

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Remove NioSelectorShared leftovers

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 3b1af26  Remove NioSelectorShared leftovers
3b1af26 is described below

commit 3b1af26b6f93bab51831a2a6ad8e50185e668e9f
Author: remm 
AuthorDate: Wed Aug 18 11:06:35 2021 +0200

Remove NioSelectorShared leftovers
---
 build.properties.default|  4 
 build.xml   |  1 -
 webapps/docs/config/ajp.xml | 25 -
 3 files changed, 30 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index 99e4077..ead69a3 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -69,10 +69,6 @@ execute.findbugs=false
 # multicast tests to work
 java.net.preferIPv4Stack=false
 
-# Specify the default (true) else the empty string will be used which
-# effectively changes the setting to false
-org.apache.tomcat.util.net.NioSelectorShared=true
-
 # Location of GPG executable (used only for releases)
 gpg.exec=/path/to/gpg
 
diff --git a/build.xml b/build.xml
index 17c357d..1a37c0f 100644
--- a/build.xml
+++ b/build.xml
@@ -1965,7 +1965,6 @@
 
 
 
-
 
 
 
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index 2d57646..87e83a4 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -715,31 +715,6 @@
 -1 for unlimited cache and 0 for no 
cache.
   
 
-  
-(int)The max selectors to be used in the pool, to reduce selector
-contention. Use this option when the command line
-org.apache.tomcat.util.net.NioSelectorShared value is set
-to false. Default value is 200.
-  
-
-  
-(int)The max spare selectors to be used in the pool, to reduce
-selector contention. When a selector is returned to the pool, the 
system
-can decide to keep it or let it be GC'd. Use this option when the
-command line org.apache.tomcat.util.net.NioSelectorShared
-value is set to false. Default value is -1 
(unlimited).
-  
-
-  
-The following command line options are available for the NIO
-connector:
--Dorg.apache.tomcat.util.net.NioSelectorShared=true|false
-- default is true. Set this value to false 
if you wish to
-use a selector for each thread. When you set it to false, 
you can
-control the size of the pool of selectors by using the
-selectorPool.maxSelectors attribute.
-  
-
 
   
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Remove NioSelectorShared leftovers

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new d1d4034  Remove NioSelectorShared leftovers
d1d4034 is described below

commit d1d40340afe3f0ab85b56f65277eba63cc5882f0
Author: remm 
AuthorDate: Wed Aug 18 11:06:35 2021 +0200

Remove NioSelectorShared leftovers
---
 build.properties.default|  4 
 build.xml   |  1 -
 webapps/docs/config/ajp.xml | 25 -
 3 files changed, 30 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index 1c1c174..09f2b2f 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -69,10 +69,6 @@ execute.findbugs=false
 # multicast tests to work
 java.net.preferIPv4Stack=false
 
-# Specify the default (true) else the empty string will be used which
-# effectively changes the setting to false
-org.apache.tomcat.util.net.NioSelectorShared=true
-
 # Location of GPG executable (used only for releases)
 gpg.exec=/path/to/gpg
 
diff --git a/build.xml b/build.xml
index b3a6a7b..de0272b 100644
--- a/build.xml
+++ b/build.xml
@@ -1983,7 +1983,6 @@
 
 
 
-
 
 
 
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index 1b678cd..81c825a 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -708,31 +708,6 @@
 -1 for unlimited cache and 0 for no 
cache.
   
 
-  
-(int)The max selectors to be used in the pool, to reduce selector
-contention. Use this option when the command line
-org.apache.tomcat.util.net.NioSelectorShared value is set
-to false. Default value is 200.
-  
-
-  
-(int)The max spare selectors to be used in the pool, to reduce
-selector contention. When a selector is returned to the pool, the 
system
-can decide to keep it or let it be GC'd. Use this option when the
-command line org.apache.tomcat.util.net.NioSelectorShared
-value is set to false. Default value is -1 
(unlimited).
-  
-
-  
-The following command line options are available for the NIO
-connector:
--Dorg.apache.tomcat.util.net.NioSelectorShared=true|false
-- default is true. Set this value to false 
if you wish to
-use a selector for each thread. When you set it to false, 
you can
-control the size of the pool of selectors by using the
-selectorPool.maxSelectors attribute.
-  
-
 
   
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Remove NioSelectorShared leftovers

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 831cf3e  Remove NioSelectorShared leftovers
831cf3e is described below

commit 831cf3e39312f8ad63778454c259c26910e93c0e
Author: remm 
AuthorDate: Wed Aug 18 11:01:08 2021 +0200

Remove NioSelectorShared leftovers
---
 build.properties.default|  4 
 build.xml   |  1 -
 webapps/docs/config/ajp.xml | 25 -
 3 files changed, 30 deletions(-)

diff --git a/build.properties.default b/build.properties.default
index 2d9bac4..c05a246 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -69,10 +69,6 @@ execute.findbugs=false
 # multicast tests to work
 java.net.preferIPv4Stack=false
 
-# Specify the default (true) else the empty string will be used which
-# effectively changes the setting to false
-org.apache.tomcat.util.net.NioSelectorShared=true
-
 # Location of GPG executable (used only for releases)
 gpg.exec=/path/to/gpg
 
diff --git a/build.xml b/build.xml
index fd96d8d..3c48d90 100644
--- a/build.xml
+++ b/build.xml
@@ -1956,7 +1956,6 @@
 
 
 
-
 
 
 
diff --git a/webapps/docs/config/ajp.xml b/webapps/docs/config/ajp.xml
index 1b678cd..81c825a 100644
--- a/webapps/docs/config/ajp.xml
+++ b/webapps/docs/config/ajp.xml
@@ -708,31 +708,6 @@
 -1 for unlimited cache and 0 for no 
cache.
   
 
-  
-(int)The max selectors to be used in the pool, to reduce selector
-contention. Use this option when the command line
-org.apache.tomcat.util.net.NioSelectorShared value is set
-to false. Default value is 200.
-  
-
-  
-(int)The max spare selectors to be used in the pool, to reduce
-selector contention. When a selector is returned to the pool, the 
system
-can decide to keep it or let it be GC'd. Use this option when the
-command line org.apache.tomcat.util.net.NioSelectorShared
-value is set to false. Default value is -1 
(unlimited).
-  
-
-  
-The following command line options are available for the NIO
-connector:
--Dorg.apache.tomcat.util.net.NioSelectorShared=true|false
-- default is true. Set this value to false 
if you wish to
-use a selector for each thread. When you set it to false, 
you can
-control the size of the pool of selectors by using the
-selectorPool.maxSelectors attribute.
-  
-
 
   
 

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Add straight example for the storepass syntax

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 8dd28c2  Add straight example for the storepass syntax
8dd28c2 is described below

commit 8dd28c2767aeb13510d98b81366a7712663d6faa
Author: remm 
AuthorDate: Wed Aug 18 10:51:14 2021 +0200

Add straight example for the storepass syntax
---
 build.properties.default | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/build.properties.default b/build.properties.default
index adb76cf..4f6b3b5 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -81,7 +81,8 @@ do.codesigning=false
 codesigning.alias=Tomcat-PMC-cert-2021-04
 codesigning.digest=SHA-512
 codesigning.storetype=DIGICERTONE
-codesigning.storepass=set-this-in-build.properties
+# Set codesigning.storepass in build.properties with the following syntax
+#codesigning.storepass=|/path/to/Certificate_pkcs12.p12|
 
 # - Settings to use when downloading files -
 trydownload.httpusecaches=true

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 10.0.x updated: Add straight example for the storepass syntax

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.0.x by this push:
 new a763fb7  Add straight example for the storepass syntax
a763fb7 is described below

commit a763fb71abe914c01d3764efc705536b59b4637d
Author: remm 
AuthorDate: Wed Aug 18 10:51:14 2021 +0200

Add straight example for the storepass syntax
---
 build.properties.default | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/build.properties.default b/build.properties.default
index 9ccb60b..1c1c174 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -82,7 +82,8 @@ do.codesigning=false
 codesigning.alias=Tomcat-PMC-cert-2021-04
 codesigning.digest=SHA-512
 codesigning.storetype=DIGICERTONE
-codesigning.storepass=set-this-in-build.properties
+# Set codesigning.storepass in build.properties with the following syntax
+#codesigning.storepass=|/path/to/Certificate_pkcs12.p12|
 
 # - Settings to use when downloading files -
 trydownload.httpusecaches=true

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 9.0.x updated: Add straight example for the storepass syntax

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new e2f5a9e  Add straight example for the storepass syntax
e2f5a9e is described below

commit e2f5a9e302e8a738acafb1a9723582a98ce82eea
Author: remm 
AuthorDate: Wed Aug 18 10:51:14 2021 +0200

Add straight example for the storepass syntax
---
 build.properties.default | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/build.properties.default b/build.properties.default
index c22e58b..99e4077 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -82,7 +82,8 @@ do.codesigning=false
 codesigning.alias=Tomcat-PMC-cert-2021-04
 codesigning.digest=SHA-512
 codesigning.storetype=DIGICERTONE
-codesigning.storepass=set-this-in-build.properties
+# Set codesigning.storepass in build.properties with the following syntax
+#codesigning.storepass=|/path/to/Certificate_pkcs12.p12|
 
 # - Settings to use when downloading files -
 trydownload.httpusecaches=true

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Add straight example for the storepass syntax

2021-08-18 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 58ac04a  Add straight example for the storepass syntax
58ac04a is described below

commit 58ac04aa08182efbf69afc56a28c34fc9294f915
Author: remm 
AuthorDate: Wed Aug 18 10:51:14 2021 +0200

Add straight example for the storepass syntax
---
 build.properties.default | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/build.properties.default b/build.properties.default
index 6b3dc24..2d9bac4 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -82,7 +82,8 @@ do.codesigning=false
 codesigning.alias=Tomcat-PMC-cert-2021-04
 codesigning.digest=SHA-512
 codesigning.storetype=DIGICERTONE
-codesigning.storepass=set-this-in-build.properties
+# Set codesigning.storepass in build.properties with the following syntax
+#codesigning.storepass=|/path/to/Certificate_pkcs12.p12|
 
 # - Settings to use when downloading files -
 trydownload.httpusecaches=true

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch main updated: Improve the reusability of UserDatabase code

2021-08-17 Thread remm
This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
 new 5376d45  Improve the reusability of UserDatabase code
5376d45 is described below

commit 5376d45258b8bf496951a99eab435517d2ed70f0
Author: remm 
AuthorDate: Tue Aug 17 14:56:24 2021 +0200

Improve the reusability of UserDatabase code

Add intermediate concrete implementation classes. Add hooks to allow
partail database updates on save. Will likely make alternate
implementations more realistic.
---
 java/org/apache/catalina/UserDatabase.java |  27 
 .../users/{MemoryGroup.java => GenericGroup.java}  |  60 
 .../users/{MemoryRole.java => GenericRole.java}|  44 +++---
 .../users/{MemoryUser.java => GenericUser.java}| 126 
 java/org/apache/catalina/users/MemoryGroup.java| 116 +--
 java/org/apache/catalina/users/MemoryRole.java |  36 +
 java/org/apache/catalina/users/MemoryUser.java | 158 +
 webapps/docs/changelog.xml |   5 +
 8 files changed, 138 insertions(+), 434 deletions(-)

diff --git a/java/org/apache/catalina/UserDatabase.java 
b/java/org/apache/catalina/UserDatabase.java
index 8bac810..9242170 100644
--- a/java/org/apache/catalina/UserDatabase.java
+++ b/java/org/apache/catalina/UserDatabase.java
@@ -156,6 +156,33 @@ public interface UserDatabase {
 
 
 /**
+ * Signal the specified {@link Group} from this user database has been
+ * modified.
+ *
+ * @param group The group that has been modified
+ */
+public default void modifiedGroup(Group group) {}
+
+
+/**
+ * Signal the specified {@link Role} from this user database has been
+ * modified.
+ *
+ * @param role The role that has been modified
+ */
+public default void modifiedRole(Role role) {}
+
+
+/**
+ * Signal the specified {@link User} from this user database has been
+ * modified.
+ *
+ * @param user The user that has been modified
+ */
+public default void modifiedUser(User user) {}
+
+
+/**
  * Save any updated information to the persistent storage location for this
  * user database.
  *
diff --git a/java/org/apache/catalina/users/MemoryGroup.java 
b/java/org/apache/catalina/users/GenericGroup.java
similarity index 73%
copy from java/org/apache/catalina/users/MemoryGroup.java
copy to java/org/apache/catalina/users/GenericGroup.java
index aad4180..d59e57d 100644
--- a/java/org/apache/catalina/users/MemoryGroup.java
+++ b/java/org/apache/catalina/users/GenericGroup.java
@@ -25,17 +25,15 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import org.apache.catalina.Role;
 import org.apache.catalina.User;
 import org.apache.catalina.UserDatabase;
-import org.apache.tomcat.util.buf.StringUtils;
 
 
 /**
- * Concrete implementation of {@link org.apache.catalina.Group} for the
- * {@link MemoryUserDatabase} implementation of {@link UserDatabase}.
+ * Concrete implementation of {@link org.apache.catalina.Group} for a
+ * {@link UserDatabase}.
  *
  * @author Craig R. McClanahan
- * @since 4.1
  */
-public class MemoryGroup extends AbstractGroup {
+public class GenericGroup extends AbstractGroup {
 
 
 // --- Constructors
@@ -43,19 +41,23 @@ public class MemoryGroup extends AbstractGroup {
 
 /**
  * Package-private constructor used by the factory method in
- * {@link MemoryUserDatabase}.
+ * {@link UserDatabase}.
  *
- * @param database The {@link MemoryUserDatabase} that owns this group
+ * @param database The {@link UserDatabase} that owns this group
  * @param groupname Group name of this group
  * @param description Description of this group
+ * @param roles The roles of this group
  */
-MemoryGroup(MemoryUserDatabase database,
-String groupname, String description) {
+GenericGroup(UD database,
+String groupname, String description, List roles) {
 
 super();
 this.database = database;
-setGroupname(groupname);
-setDescription(description);
+this.groupname = groupname;
+this.description = description;
+if (roles != null) {
+this.roles.addAll(roles);
+}
 
 }
 
@@ -64,9 +66,9 @@ public class MemoryGroup extends AbstractGroup {
 
 
 /**
- * The {@link MemoryUserDatabase} that owns this group.
+ * The {@link UserDatabase} that owns this group.
  */
-protected final MemoryUserDatabase database;
+protected final UD database;
 
 
 /**
@@ -123,7 +125,9 @@ public class MemoryGroup extends AbstractGroup {
  */
 @Override
 public void addRole(Role role) {
-roles.addIfAbsent(role);
+if (roles.addIfAb

svn commit: r49317 - /release/tomcat/tomcat-9/v9.0.50/

2021-08-07 Thread remm
Author: remm
Date: Sat Aug  7 12:32:56 2021
New Revision: 49317

Log:
Drop 9.0.50

Removed:
release/tomcat/tomcat-9/v9.0.50/


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1892073 - in /tomcat/site/trunk/docs/tomcat-9.0-doc: ./ annotationapi/ annotationapi/javax/annotation/ annotationapi/javax/annotation/security/ annotationapi/javax/annotation/sql/ api/ ap

2021-08-07 Thread remm
Author: remm
Date: Sat Aug  7 12:22:06 2021
New Revision: 1892073

URL: http://svn.apache.org/viewvc?rev=1892073=rev
Log:
Update 9.0 docs


[This commit notification would consist of 70 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1892072 - in /tomcat/site/trunk: docs/download-90.html docs/index.html docs/migration-9.html docs/oldnews.html docs/whichversion.html xdocs/download-90.xml xdocs/index.xml xdocs/migration

2021-08-07 Thread remm
Author: remm
Date: Sat Aug  7 12:12:22 2021
New Revision: 1892072

URL: http://svn.apache.org/viewvc?rev=1892072=rev
Log:
Update site for 9.0.52 release

Modified:
tomcat/site/trunk/docs/download-90.html
tomcat/site/trunk/docs/index.html
tomcat/site/trunk/docs/migration-9.html
tomcat/site/trunk/docs/oldnews.html
tomcat/site/trunk/docs/whichversion.html
tomcat/site/trunk/xdocs/download-90.xml
tomcat/site/trunk/xdocs/index.xml
tomcat/site/trunk/xdocs/migration-9.xml
tomcat/site/trunk/xdocs/oldnews.xml
tomcat/site/trunk/xdocs/whichversion.xml

Modified: tomcat/site/trunk/docs/download-90.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/download-90.html?rev=1892072=1892071=1892072=diff
==
--- tomcat/site/trunk/docs/download-90.html (original)
+++ tomcat/site/trunk/docs/download-90.html Sat Aug  7 12:12:22 2021
@@ -12,7 +12,7 @@
 
   Quick Navigation
 
-[define v]9.0.50[end]
+[define v]9.0.52[end]
 https://downloads.apache.org/tomcat/tomcat-9/KEYS;>KEYS |
 [v] |
 Browse |

Modified: tomcat/site/trunk/docs/index.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/index.html?rev=1892072=1892071=1892072=diff
==
--- tomcat/site/trunk/docs/index.html (original)
+++ tomcat/site/trunk/docs/index.html Sat Aug  7 12:12:22 2021
@@ -36,6 +36,28 @@ wiki page.
 Apache Tomcat, Tomcat, Apache, the Apache feather, and the Apache Tomcat
 project logo are trademarks of the Apache Software Foundation.
 
+2021-08-06 Tomcat 9.0.52 Released
+
+The Apache Tomcat Project is proud to announce the release of version 9.0.52
+of Apache Tomcat. This release implements specifications that are part of the
+Java EE 8 platform. The notable changes compared to 9.0.50 include:
+
+Correct a regression in the previous release in the HTTP/2 flow
+control window management
+Correct a regression the could cause some TLS connections to hang when
+using NIO
+Use of GraalVM native images no longer automatically disables JMX
+support 
+
+
+Full details of these changes, and all the other changes, are available in the
+Tomcat 9
+changelog.
+
+
+
+https://tomcat.apache.org/download-90.cgi;>Download
+
 2021-08-05 Tomcat 10.0.10 Released
 
 The Apache Tomcat Project is proud to announce the release of version 10.0.10
@@ -121,27 +143,6 @@ changelog.
 
 https://tomcat.apache.org/download-80.cgi;>Download
 
-2021-07-02 Tomcat 9.0.50 Released
-
-The Apache Tomcat Project is proud to announce the release of version 9.0.48
-of Apache Tomcat. This release implements specifications that are part of the
-Java EE 8 platform. The notable changes compared to 9.0.48 include:
-
-Re-work the HTTP/2 overhead protection to reduce the likelihood of false
-positives. Note that the default overheadCountFactor has changed from 1 to
-10 and that the useful range is now 0 to ~20.
-Update to Eclipse JDT compiler 4.20.
-Fix regressions in JSP compilation in the previous release. 
-
-
-Full details of these changes, and all the other changes, are available in the
-Tomcat 9
-changelog.
-
-
-
-https://tomcat.apache.org/download-90.cgi;>Download
-
 2021-06-04 Tomcat Native 1.2.30 Released
 
 The Apache Tomcat Project is proud to announce the release of version 1.2.30 of

Modified: tomcat/site/trunk/docs/migration-9.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/migration-9.html?rev=1892072=1892071=1892072=diff
==
--- tomcat/site/trunk/docs/migration-9.html (original)
+++ tomcat/site/trunk/docs/migration-9.html Sat Aug  7 12:12:22 2021
@@ -417,7 +417,8 @@ of Apache Tomcat.
 9.0.44
 9.0.45
 9.0.46
-9.0.48
+9.0.48
+9.0.50
 , new version:
 
 9.0.0-M1
@@ -475,7 +476,8 @@ of Apache Tomcat.
 9.0.45
 9.0.46
 9.0.48
-9.0.50
+9.0.50
+9.0.52
 trunk (unreleased)
 
 

Modified: tomcat/site/trunk/docs/oldnews.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/oldnews.html?rev=1892072=1892071=1892072=diff
==
--- tomcat/site/trunk/docs/oldnews.html (original)
+++ tomcat/site/trunk/docs/oldnews.html Sat Aug  7 12:12:22 2021
@@ -17,6 +17,27 @@
   year 2011
   year 2010
 
+2021-07-02 Tomcat 9.0.50 Released
+
+The Apache Tomcat Project is proud to announce the release of version 9.0.50
+of Apache Tomcat. This release implements specifications that are part of the
+Java EE 8 platform. The notable changes compared to 9.0.48 include:
+
+Re-work the HTTP/2 overhead protection to reduce the likelihood of false
+positives. Note that the default overheadCountFactor has changed from 1 to
+10 and that the useful range is now 0 to ~20.
+Update to Eclipse JDT compiler 4.20.
+Fix regres

  1   2   3   4   5   6   7   8   9   10   >