This is an automated email from the ASF dual-hosted git repository.

rmaucher 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 530b4c93d0 Add removeRealm, matching addRealm
530b4c93d0 is described below

commit 530b4c93d0cd3c3d8a440ad4d39240b3b791998a
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 df97683981..ec16df0e84 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]

Reply via email to