Skip to content

Commit

Permalink
Log a warning if adding CredentialHandler to CombinedRealm
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Apr 20, 2020
1 parent 6a313e9 commit 65bc61a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions java/org/apache/catalina/realm/CombinedRealm.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
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;
Expand Down Expand Up @@ -461,4 +462,12 @@ public boolean isAvailable() {
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);
}
}
1 change: 1 addition & 0 deletions java/org/apache/catalina/realm/LocalStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,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">
Expand Down

0 comments on commit 65bc61a

Please sign in to comment.