From 57cd14d057dc4e78abffb19b45497e88cb1961b2 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 14 Apr 2010 22:43:37 +0000 Subject: [PATCH] Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49109 Remove unused authenticate() method with a broken default impl git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@934232 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/Realm.java | 11 -------- java/org/apache/catalina/realm/CombinedRealm.java | 34 ----------------------- java/org/apache/catalina/realm/LockOutRealm.java | 29 ------------------- java/org/apache/catalina/realm/RealmBase.java | 15 ---------- 4 files changed, 89 deletions(-) diff --git a/java/org/apache/catalina/Realm.java b/java/org/apache/catalina/Realm.java index 6e5fa3701..42ad4028c 100644 --- a/java/org/apache/catalina/Realm.java +++ b/java/org/apache/catalina/Realm.java @@ -88,17 +88,6 @@ public interface Realm { /** - * Return the Principal associated with the specified username and - * credentials, if there is one; otherwise return null. - * - * @param username Username of the Principal to look up - * @param credentials Password or other credentials to use in - * authenticating this username - */ - public Principal authenticate(String username, byte[] credentials); - - - /** * Return the Principal associated with the specified username, which * matches the digest calculated using the given parameters using the * method described in RFC 2069; otherwise return null. diff --git a/java/org/apache/catalina/realm/CombinedRealm.java b/java/org/apache/catalina/realm/CombinedRealm.java index 0207f7bdd..fc31e26d3 100644 --- a/java/org/apache/catalina/realm/CombinedRealm.java +++ b/java/org/apache/catalina/realm/CombinedRealm.java @@ -80,40 +80,6 @@ public class CombinedRealm extends RealmBase { /** - * Return the Principal associated with the specified username and - * credentials, if there is one; otherwise return null. - * - * @param username Username of the Principal to look up - * @param credentials Password or other credentials to use in - * authenticating this username - */ - @Override - public Principal authenticate(String username, byte[] credentials) { - Principal authenticatedUser = null; - - for (Realm realm : realms) { - if (log.isDebugEnabled()) { - log.debug(sm.getString("combinedRealm.authStart", username, realm.getInfo())); - } - - authenticatedUser = realm.authenticate(username, credentials); - - if (authenticatedUser == null) { - if (log.isDebugEnabled()) { - log.debug(sm.getString("combinedRealm.authFail", username, realm.getInfo())); - } - } else { - if (log.isDebugEnabled()) { - log.debug(sm.getString("combinedRealm.authSucess", username, realm.getInfo())); - } - break; - } - } - return authenticatedUser; - } - - - /** * Return the Principal associated with the specified username, which * matches the digest calculated using the given parameters using the * method described in RFC 2069; otherwise return null. diff --git a/java/org/apache/catalina/realm/LockOutRealm.java b/java/org/apache/catalina/realm/LockOutRealm.java index f5c721727..638c1bda0 100644 --- a/java/org/apache/catalina/realm/LockOutRealm.java +++ b/java/org/apache/catalina/realm/LockOutRealm.java @@ -115,35 +115,6 @@ public class LockOutRealm extends CombinedRealm { /** - * Return the Principal associated with the specified username and - * credentials, if there is one; otherwise return null. - * - * @param username Username of the Principal to look up - * @param credentials Password or other credentials to use in - * authenticating this username - */ - @Override - public Principal authenticate(String username, byte[] credentials) { - if (isLocked(username)) { - // Trying to authenticate a locked user is an automatic failure - registerAuthFailure(username); - - log.warn(sm.getString("lockOutRealm.authLockedUser", username)); - return null; - } - - Principal authenticatedUser = super.authenticate(username, credentials); - - if (authenticatedUser == null) { - registerAuthFailure(username); - } else { - registerAuthSuccess(username); - } - return authenticatedUser; - } - - - /** * Return the Principal associated with the specified username, which * matches the digest calculated using the given parameters using the * method described in RFC 2069; otherwise return null. diff --git a/java/org/apache/catalina/realm/RealmBase.java b/java/org/apache/catalina/realm/RealmBase.java index a0d3cb8f9..d93557607 100644 --- a/java/org/apache/catalina/realm/RealmBase.java +++ b/java/org/apache/catalina/realm/RealmBase.java @@ -323,21 +323,6 @@ public abstract class RealmBase extends LifecycleBase /** - * Return the Principal associated with the specified username and - * credentials, if there is one; otherwise return null. - * - * @param username Username of the Principal to look up - * @param credentials Password or other credentials to use in - * authenticating this username - */ - public Principal authenticate(String username, byte[] credentials) { - - return (authenticate(username, credentials.toString())); - - } - - - /** * Return the Principal associated with the specified username, which * matches the digest calculated using the given parameters using the * method described in RFC 2069; otherwise return null. -- 2.11.0