This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new f649600249 Add removeRealm, matching addRealm
f649600249 is described below
commit f6496002491174a923070807bc411034d738544e
Author: remm <[email protected]>
AuthorDate: Mon Sep 14 23:20:56 2026 +0200
Add removeRealm, matching addRealm
---
java/org/apache/catalina/realm/CombinedRealm.java | 22 ++++++++++++++++++++++
.../apache/catalina/realm/LocalStrings.properties | 1 +
2 files changed, 23 insertions(+)
diff --git a/java/org/apache/catalina/realm/CombinedRealm.java
b/java/org/apache/catalina/realm/CombinedRealm.java
index 30b9fc5204..78b7793018 100644
--- a/java/org/apache/catalina/realm/CombinedRealm.java
+++ b/java/org/apache/catalina/realm/CombinedRealm.java
@@ -73,6 +73,28 @@ public class CombinedRealm extends RealmBase {
}
+ /**
+ * Remove a realm from the list of realms that are used to authenticate
+ * users.
+ *
+ * @param theRealm realm which should no longer be wrapped by the combined
+ * realm
+ *
+ * @return {@code true} if the realm was present and removed,
+ * {@code false} otherwise
+ */
+ public boolean removeRealm(Realm theRealm) {
+ boolean removed = realms.remove(theRealm);
+
+ if (removed && log.isDebugEnabled()) {
+ log.debug(sm.getString("combinedRealm.removeRealm",
theRealm.getClass().getName(),
+ Integer.toString(realms.size())));
+ }
+
+ return removed;
+ }
+
+
/**
* Returns the JMX ObjectNames of the realms that this realm is wrapping.
* Entries for realms that do not implement LifecycleMBeanBase will be
null.
diff --git a/java/org/apache/catalina/realm/LocalStrings.properties
b/java/org/apache/catalina/realm/LocalStrings.properties
index 4e0cf9e312..026e756f94 100644
--- a/java/org/apache/catalina/realm/LocalStrings.properties
+++ b/java/org/apache/catalina/realm/LocalStrings.properties
@@ -23,6 +23,7 @@ combinedRealm.authSuccess=Authenticated user [{0}] with realm
[{1}]
combinedRealm.getPassword=The getPassword() method should never be called
combinedRealm.getPrincipal=The getPrincipal() method should never be called
combinedRealm.realmStartFail=Failed to start [{0}] realm
+combinedRealm.removeRealm=Remove [{0}] realm, leaving a total of [{1}] realms
combinedRealm.setCredentialHandler=A CredentialHandler was set on an instance
of the CombinedRealm (or a sub-class of CombinedRealm). CombinedRealm doesn't
use a configured CredentialHandler. Is this a configuration error?
combinedRealm.unexpectedMethod=An unexpected call was made to a method on the
combined realm
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]