You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/04/20 20:29:01 UTC

[tomcat] branch 8.5.x updated: Log a warning if addind CredentialHandler to CombinedRealm

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

markt 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 acd0cc3  Log a warning if addind CredentialHandler to CombinedRealm
acd0cc3 is described below

commit acd0cc39d6302f808d5dddd1fff42515ffc77c25
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Apr 20 21:28:41 2020 +0100

    Log a warning if addind CredentialHandler to CombinedRealm
---
 java/org/apache/catalina/realm/CombinedRealm.java      | 9 +++++++++
 java/org/apache/catalina/realm/LocalStrings.properties | 1 +
 webapps/docs/changelog.xml                             | 7 +++++++
 3 files changed, 17 insertions(+)

diff --git a/java/org/apache/catalina/realm/CombinedRealm.java b/java/org/apache/catalina/realm/CombinedRealm.java
index 03665e4..69c2c40 100644
--- a/java/org/apache/catalina/realm/CombinedRealm.java
+++ b/java/org/apache/catalina/realm/CombinedRealm.java
@@ -26,6 +26,7 @@ import java.util.List;
 import javax.management.ObjectName;
 
 import org.apache.catalina.Container;
+import org.apache.catalina.CredentialHandler;
 import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleException;
 import org.apache.catalina.Realm;
@@ -484,4 +485,12 @@ public class CombinedRealm extends RealmBase {
         return true;
     }
 
+
+    @Override
+    public void setCredentialHandler(CredentialHandler credentialHandler) {
+        // This is unusual for a CombinedRealm as it does not use
+        // CredentialHandlers. It might be a mis-configuration so warn the user.
+        log.warn(sm.getString("combinedRealm.setCredentialHandler"));
+        super.setCredentialHandler(credentialHandler);
+    }
 }
diff --git a/java/org/apache/catalina/realm/LocalStrings.properties b/java/org/apache/catalina/realm/LocalStrings.properties
index ffffe7d..52f6e42 100644
--- a/java/org/apache/catalina/realm/LocalStrings.properties
+++ b/java/org/apache/catalina/realm/LocalStrings.properties
@@ -20,6 +20,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.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
 
 credentialHandler.invalidStoredCredential=The invalid stored credential string [{0}] was provided by the Realm to match with the user provided credentials
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 471a9e9..a9e8226 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -62,6 +62,13 @@
         Remove redundant sole path/URI from error page message on SC_NOT_FOUND.
         (michaelo)
       </update>
+      <add>
+        Log a warning if a <code>CredentialHandler</code> instance is added to
+        an instance of the <code>CombinedRealm</code> (or a sub-class) as the
+        <code>CombinedRealm</code> doesn't use a configued
+        <code>CredentialHandler</code> and it is likely that a configuration
+        error has occurred. (markt)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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