You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2011/10/26 16:02:40 UTC

svn commit: r1189224 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/authenticator/ java/org/apache/catalina/realm/ webapps/docs/

Author: kkolinko
Date: Wed Oct 26 14:02:40 2011
New Revision: 1189224

URL: http://svn.apache.org/viewvc?rev=1189224&view=rev
Log:
Followup to deprecating the auth method names constants in authenticator.Constants
Add Javadoc comment that points to replacements.
Replace use of the old constants with the new ones from HttpServletRequest.

Modified:
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/Constants.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SingleSignOnEntry.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
    tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java Wed Oct 26 14:02:40 2011
@@ -22,6 +22,7 @@ package org.apache.catalina.authenticato
 import java.io.IOException;
 import java.security.Principal;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.catalina.connector.Request;
@@ -156,8 +157,8 @@ public class BasicAuthenticator
 
             principal = context.getRealm().authenticate(username, password);
             if (principal != null) {
-                register(request, response, principal, Constants.BASIC_METHOD,
-                         username, password);
+                register(request, response, principal,
+                        HttpServletRequest.BASIC_AUTH, username, password);
                 return (true);
             }
         }
@@ -179,6 +180,6 @@ public class BasicAuthenticator
 
     @Override
     protected String getAuthMethod() {
-        return Constants.BASIC_METHOD;
+        return HttpServletRequest.BASIC_AUTH;
     }
 }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/Constants.java?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/Constants.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/Constants.java Wed Oct 26 14:02:40 2011
@@ -25,14 +25,31 @@ public class Constants {
 
     // Authentication methods for login configuration
     // Servlet spec schemes
+
+    /**
+     * @deprecated Replaced by HttpServletRequest.BASIC_AUTH
+     */
     @Deprecated
     public static final String BASIC_METHOD = "BASIC";
+
+    /**
+     * @deprecated Replaced by HttpServletRequest.CLIENT_CERT_AUTH
+     */
     @Deprecated
     public static final String CERT_METHOD = "CLIENT_CERT";
+
+    /**
+     * @deprecated Replaced by HttpServletRequest.DIGEST_AUTH
+     */
     @Deprecated
     public static final String DIGEST_METHOD = "DIGEST";
+
+    /**
+     * @deprecated Replaced by HttpServletRequest.FORM_AUTH
+     */
     @Deprecated
     public static final String FORM_METHOD = "FORM";
+
     // Vendor specific schemes
     public static final String SPNEGO_METHOD = "SPNEGO";
 

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java Wed Oct 26 14:02:40 2011
@@ -272,7 +272,7 @@ public class DigestAuthenticator extends
             if (principal != null) {
                 String username = parseUsername(authorization);
                 register(request, response, principal,
-                         Constants.DIGEST_METHOD,
+                        HttpServletRequest.DIGEST_AUTH,
                          username, null);
                 return (true);
             }
@@ -295,7 +295,7 @@ public class DigestAuthenticator extends
 
     @Override
     protected String getAuthMethod() {
-        return Constants.DIGEST_METHOD;
+        return HttpServletRequest.DIGEST_AUTH;
     }
 
 

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java Wed Oct 26 14:02:40 2011
@@ -28,6 +28,7 @@ import java.util.Locale;
 
 import javax.servlet.RequestDispatcher;
 import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.catalina.Realm;
@@ -204,7 +205,7 @@ public class FormAuthenticator
                     session.setNote(Constants.FORM_PRINCIPAL_NOTE, principal);
                     if (!matchRequest(request)) {
                         register(request, response, principal,
-                                 Constants.FORM_METHOD,
+                                HttpServletRequest.FORM_AUTH,
                                  username, password);
                         return (true);
                     }
@@ -226,7 +227,7 @@ public class FormAuthenticator
             }
             principal = (Principal)
                 session.getNote(Constants.FORM_PRINCIPAL_NOTE);
-            register(request, response, principal, Constants.FORM_METHOD,
+            register(request, response, principal, HttpServletRequest.FORM_AUTH,
                      (String) session.getNote(Constants.SESS_USERNAME_NOTE),
                      (String) session.getNote(Constants.SESS_PASSWORD_NOTE));
             // If we're caching principals we no longer need the username
@@ -363,7 +364,7 @@ public class FormAuthenticator
 
     @Override
     protected String getAuthMethod() {
-        return Constants.FORM_METHOD;
+        return HttpServletRequest.FORM_AUTH;
     }
 
 

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java Wed Oct 26 14:02:40 2011
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.security.Principal;
 import java.security.cert.X509Certificate;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.catalina.Globals;
@@ -163,8 +164,8 @@ public class SSLAuthenticator
         }
 
         // Cache the principal (if requested) and record this authentication
-        register(request, response, principal, Constants.CERT_METHOD,
-                 null, null);
+        register(request, response, principal,
+                HttpServletRequest.CLIENT_CERT_AUTH, null, null);
         return (true);
 
     }
@@ -172,6 +173,6 @@ public class SSLAuthenticator
 
     @Override
     protected String getAuthMethod() {
-        return Constants.CERT_METHOD;
+        return HttpServletRequest.CLIENT_CERT_AUTH;
     }
 }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SingleSignOnEntry.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SingleSignOnEntry.java?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SingleSignOnEntry.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/authenticator/SingleSignOnEntry.java Wed Oct 26 14:02:40 2011
@@ -18,6 +18,8 @@ package org.apache.catalina.authenticato
 
 import java.security.Principal;
 
+import javax.servlet.http.HttpServletRequest;
+
 import org.apache.catalina.Session;
 
 /**
@@ -179,8 +181,8 @@ public class SingleSignOnEntry
         this.username = username;
         this.password = password;
         this.canReauthenticate =
-            (Constants.BASIC_METHOD.equals(authType)
-                || Constants.FORM_METHOD.equals(authType));
+            (HttpServletRequest.BASIC_AUTH.equals(authType)
+                || HttpServletRequest.FORM_AUTH.equals(authType));
     }
 
 }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASMemoryLoginModule.java Wed Oct 26 14:02:40 2011
@@ -34,9 +34,9 @@ import javax.security.auth.callback.Unsu
 import javax.security.auth.login.FailedLoginException;
 import javax.security.auth.login.LoginException;
 import javax.security.auth.spi.LoginModule;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.catalina.Globals;
-import org.apache.catalina.authenticator.Constants;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.digester.Digester;
@@ -292,10 +292,10 @@ public class JAASMemoryLoginModule exten
         if (authMethod == null) {
             // BASIC or FORM
             principal = super.authenticate(username, password);
-        } else if (authMethod.equals(Constants.DIGEST_METHOD)) {
+        } else if (authMethod.equals(HttpServletRequest.DIGEST_AUTH)) {
             principal = super.authenticate(username, password, nonce, nc,
                     cnonce, qop, realmName, md5a2);
-        } else if (authMethod.equals(Constants.CERT_METHOD)) {
+        } else if (authMethod.equals(HttpServletRequest.CLIENT_CERT_AUTH)) {
             principal = super.getPrincipal(username);
         } else {
             throw new LoginException("Unknown authentication method");

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/realm/JAASRealm.java Wed Oct 26 14:02:40 2011
@@ -31,10 +31,10 @@ import javax.security.auth.login.Credent
 import javax.security.auth.login.FailedLoginException;
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.LifecycleException;
-import org.apache.catalina.authenticator.Constants;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.ExceptionUtils;
@@ -357,7 +357,7 @@ public class JAASRealm
         return authenticate(username,
                 new JAASCallbackHandler(this, username, clientDigest, nonce,
                         nc, cnonce, qop, realmName, md5a2,
-                        Constants.DIGEST_METHOD));
+                        HttpServletRequest.DIGEST_AUTH));
     }
 
 
@@ -488,7 +488,7 @@ public class JAASRealm
 
         return authenticate(username,
                 new JAASCallbackHandler(this, username, null, null, null, null,
-                        null, null, null, Constants.CERT_METHOD));
+                        null, null, null, HttpServletRequest.CLIENT_CERT_AUTH));
 
     }
 

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1189224&r1=1189223&r2=1189224&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Oct 26 14:02:40 2011
@@ -131,6 +131,11 @@
         Correct errors in i18n resources and resource usage that meant some
         messages were either not used or were incorrectly formatted. (markt)
       </fix>
+      <scode>
+        Replace the use of deprecated auth method names from
+        <code>authenticator.Constants</code> with the auth method names from
+        <code>HttpServletRequest</code>. (kkolinko)
+      </scode>
     </changelog>
   </subsection>
   <subsection name="Coyote">



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