Author: markt
Date: Tue Feb  9 14:22:29 2016
New Revision: 1729390

URL: http://svn.apache.org/viewvc?rev=1729390&view=rev
Log:
Refactor AuthenticatorBase to support future plans for the JASPIC 
implementation.

Modified:
    tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
    tomcat/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java
    tomcat/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java
    tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
    
tomcat/trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java
    tomcat/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java
    tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java?rev=1729390&r1=1729389&r2=1729390&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java 
Tue Feb  9 14:22:29 2016
@@ -669,6 +669,12 @@ public abstract class AuthenticatorBase
     }
 
 
+    @Override
+    public boolean authenticate(Request request, HttpServletResponse response) 
throws IOException {
+        return doAuthenticate(request, response);
+    }
+
+
     /**
      * Authenticate the user making this request, based on the login
      * configuration of the {@link Context} with which this Authenticator is
@@ -681,9 +687,11 @@ public abstract class AuthenticatorBase
      *
      * @exception IOException if an input/output error occurs
      */
-    @Override
-    public abstract boolean authenticate(Request request,
-            HttpServletResponse response) throws IOException;
+    protected boolean doAuthenticate(Request request, HttpServletResponse 
response)
+            throws IOException {
+        // Defaults to false in case sub-class doesn't implement this method.
+        return false;
+    }
 
 
     /**

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java?rev=1729390&r1=1729389&r2=1729390&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java 
Tue Feb  9 14:22:29 2016
@@ -14,11 +14,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.catalina.authenticator;
 
-
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.security.Principal;
@@ -33,8 +30,6 @@ import org.apache.tomcat.util.buf.ByteCh
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.codec.binary.Base64;
 
-
-
 /**
  * An <b>Authenticator</b> and <b>Valve</b> implementation of HTTP BASIC
  * Authentication, as outlined in RFC 2617:  "HTTP Authentication: Basic
@@ -43,24 +38,14 @@ import org.apache.tomcat.util.codec.bina
  * @author Craig R. McClanahan
  */
 public class BasicAuthenticator extends AuthenticatorBase {
+
     private static final Log log = LogFactory.getLog(BasicAuthenticator.class);
 
 
     // --------------------------------------------------------- Public Methods
 
-    /**
-     * Authenticate the user making this request, based on the specified
-     * login configuration.  Return <code>true</code> if any specified
-     * constraint has been satisfied, or <code>false</code> if we have
-     * created a response challenge already.
-     *
-     * @param request Request we are processing
-     * @param response Response we are creating
-     *
-     * @exception IOException if an input/output error occurs
-     */
     @Override
-    public boolean authenticate(Request request, HttpServletResponse response)
+    protected boolean doAuthenticate(Request request, HttpServletResponse 
response)
             throws IOException {
 
         if (checkForCachedAuthentication(request, response, true)) {

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java?rev=1729390&r1=1729389&r2=1729390&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java 
(original)
+++ 
tomcat/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java 
Tue Feb  9 14:22:29 2016
@@ -182,19 +182,8 @@ public class DigestAuthenticator extends
 
     // --------------------------------------------------------- Public Methods
 
-    /**
-     * Authenticate the user making this request, based on the specified
-     * login configuration.  Return <code>true</code> if any specified
-     * constraint has been satisfied, or <code>false</code> if we have
-     * created a response challenge already.
-     *
-     * @param request Request we are processing
-     * @param response Response we are creating
-     *
-     * @exception IOException if an input/output error occurs
-     */
     @Override
-    public boolean authenticate(Request request, HttpServletResponse response)
+    protected boolean doAuthenticate(Request request, HttpServletResponse 
response)
             throws IOException {
 
         // NOTE: We don't try to reauthenticate using any existing SSO session,

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java?rev=1729390&r1=1729389&r2=1729390&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java 
Tue Feb  9 14:22:29 2016
@@ -117,20 +117,8 @@ public class FormAuthenticator
 
     // --------------------------------------------------------- Public Methods
 
-
-    /**
-     * Authenticate the user making this request, based on the specified
-     * login configuration.  Return <code>true</code> if any specified
-     * constraint has been satisfied, or <code>false</code> if we have
-     * created a response challenge already.
-     *
-     * @param request Request we are processing
-     * @param response Response we are creating
-     *
-     * @exception IOException if an input/output error occurs
-     */
     @Override
-    public boolean authenticate(Request request, HttpServletResponse response)
+    protected boolean doAuthenticate(Request request, HttpServletResponse 
response)
             throws IOException {
 
         if (checkForCachedAuthentication(request, response, true)) {

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java?rev=1729390&r1=1729389&r2=1729390&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java 
(original)
+++ 
tomcat/trunk/java/org/apache/catalina/authenticator/NonLoginAuthenticator.java 
Tue Feb  9 14:22:29 2016
@@ -74,7 +74,7 @@ public final class NonLoginAuthenticator
      * @exception IOException if an input/output error occurs
      */
     @Override
-    public boolean authenticate(Request request, HttpServletResponse response)
+    protected boolean doAuthenticate(Request request, HttpServletResponse 
response)
         throws IOException {
 
         // Don't try and use SSO to authenticate since there is no auth

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java?rev=1729390&r1=1729389&r2=1729390&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java 
Tue Feb  9 14:22:29 2016
@@ -35,18 +35,8 @@ public class SSLAuthenticator extends Au
 
     // --------------------------------------------------------- Public Methods
 
-    /**
-     * Authenticate the user by checking for the existence of a certificate
-     * chain, validating it against the trust manager for the connector and 
then
-     * validating the user's identity against the configured Realm.
-     *
-     * @param request Request we are processing
-     * @param response Response we are creating
-     *
-     * @exception IOException if an input/output error occurs
-     */
     @Override
-    public boolean authenticate(Request request, HttpServletResponse response)
+    protected boolean doAuthenticate(Request request, HttpServletResponse 
response)
             throws IOException {
 
         // NOTE: We don't try to reauthenticate using any existing SSO session,

Modified: 
tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java?rev=1729390&r1=1729389&r2=1729390&view=diff
==============================================================================
--- 
tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java 
(original)
+++ 
tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java 
Tue Feb  9 14:22:29 2016
@@ -134,7 +134,7 @@ public class SpnegoAuthenticator extends
 
 
     @Override
-    public boolean authenticate(Request request, HttpServletResponse response)
+    protected boolean doAuthenticate(Request request, HttpServletResponse 
response)
             throws IOException {
 
         if (checkForCachedAuthentication(request, response, true)) {

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1729390&r1=1729389&r2=1729390&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Feb  9 14:22:29 2016
@@ -56,6 +56,12 @@
         otherwise, the NIO endpoint will be used by default. If SSL is
         configured, OpenSSL will be used rather than JSSE. (remm)
       </update>
+      <scode>
+        Refactor <code>AuthenticatorBase</code>. Sub-classes should now
+        implement <code>doAuthenticate()</code> rather than
+        <code>authenticate()</code> to ensure compatibility with future
+        improvements to <code>AuthenticatorBase</code>. (markt)
+      </scode>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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

Reply via email to