tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1667496 - in /tomcat/trunk/java/org/apache/catalina/authenticator: AuthenticatorBase.java BasicAuthenticator.java DigestAuthenticator.java FormAuthenticator.java SSLAuthenticator.java SpnegoAuthenticator.java
Date Wed, 18 Mar 2015 11:05:30 GMT
Author: markt
Date: Wed Mar 18 11:05:29 2015
New Revision: 1667496

URL: http://svn.apache.org/r1667496
Log:
Revert r1667314. I discovered I need this for the fix for BZ 57708

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/SSLAuthenticator.java
    tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java

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=1667496&r1=1667495&r2=1667496&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/AuthenticatorBase.java Wed Mar 18
11:05:29 2015
@@ -783,20 +783,22 @@ public abstract class AuthenticatorBase
      * @param request The servlet request we are processing
      * @param response The servlet response we are generating
      * @param principal The authenticated Principal to be registered
+     * @param authType The authentication type to be registered
      * @param username Username used to authenticate (if any)
      * @param password Password used to authenticate (if any)
      */
-    public void register(Request request, HttpServletResponse response, Principal principal,
+    public void register(Request request, HttpServletResponse response,
+                            Principal principal, String authType,
                             String username, String password) {
 
         if (log.isDebugEnabled()) {
             String name = (principal == null) ? "none" : principal.getName();
-            log.debug("Authenticated '" + name + "' with type '" + getAuthMethod() +
+            log.debug("Authenticated '" + name + "' with type '" + authType +
                     "'");
         }
 
         // Cache the authentication information in our request
-        request.setAuthType(getAuthMethod());
+        request.setAuthType(authType);
         request.setUserPrincipal(principal);
 
         Session session = request.getSessionInternal(false);
@@ -822,7 +824,7 @@ public abstract class AuthenticatorBase
         // Cache the authentication information in our session, if any
         if (cache) {
             if (session != null) {
-                session.setAuthType(getAuthMethod());
+                session.setAuthType(authType);
                 session.setPrincipal(principal);
                 if (username != null) {
                     session.setNote(Constants.SESS_USERNAME_NOTE, username);
@@ -871,7 +873,7 @@ public abstract class AuthenticatorBase
             response.addCookie(cookie);
 
             // Register this principal with our SSO valve
-            sso.register(ssoId, principal, getAuthMethod(), username, password);
+            sso.register(ssoId, principal, authType, username, password);
             request.setNote(Constants.REQ_SSOID_NOTE, ssoId);
 
         } else {
@@ -882,7 +884,7 @@ public abstract class AuthenticatorBase
                 return;
             } else {
                 // Update the SSO session with the latest authentication data
-                sso.update(ssoId, principal, getAuthMethod(), username, password);
+                sso.update(ssoId, principal, authType, username, password);
             }
         }
 
@@ -903,7 +905,8 @@ public abstract class AuthenticatorBase
     public void login(String username, String password, Request request)
             throws ServletException {
         Principal principal = doLogin(request, username, password);
-        register(request, request.getResponse(), principal, username, password);
+        register(request, request.getResponse(), principal,
+                    getAuthMethod(), username, password);
     }
 
     protected abstract String getAuthMethod();
@@ -928,7 +931,9 @@ public abstract class AuthenticatorBase
 
     @Override
     public void logout(Request request) {
-        register(request, request.getResponse(), null, null, null);
+        register(request, request.getResponse(), null,
+                null, null, null);
+
     }
 
     /**

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=1667496&r1=1667495&r2=1667496&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java (original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/BasicAuthenticator.java Wed Mar 18
11:05:29 2015
@@ -83,8 +83,9 @@ public class BasicAuthenticator extends
 
                 Principal principal = context.getRealm().authenticate(username, password);
                 if (principal != null) {
-                    register(request, response, principal, username, password);
-                    return true;
+                    register(request, response, principal,
+                        HttpServletRequest.BASIC_AUTH, username, password);
+                    return (true);
                 }
             }
             catch (IllegalArgumentException iae) {
@@ -101,7 +102,7 @@ public class BasicAuthenticator extends
         value.append('\"');
         response.setHeader(AUTH_HEADER_NAME, value.toString());
         response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
-        return false;
+        return (false);
 
     }
 

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=1667496&r1=1667495&r2=1667496&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java (original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/DigestAuthenticator.java Wed Mar 18
11:05:29 2015
@@ -221,7 +221,9 @@ public class DigestAuthenticator extends
                 }
 
                 if (principal != null && !digestInfo.isNonceStale()) {
-                    register(request, response, principal, digestInfo.getUsername(), null);
+                    register(request, response, principal,
+                            HttpServletRequest.DIGEST_AUTH,
+                            digestInfo.getUsername(), null);
                     return true;
                 }
             }

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=1667496&r1=1667495&r2=1667496&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java (original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/FormAuthenticator.java Wed Mar 18
11:05:29 2015
@@ -161,7 +161,9 @@ public class FormAuthenticator
                 if (principal != null) {
                     session.setNote(Constants.FORM_PRINCIPAL_NOTE, principal);
                     if (!matchRequest(request)) {
-                        register(request, response, principal, username, password);
+                        register(request, response, principal,
+                                HttpServletRequest.FORM_AUTH,
+                                username, password);
                         return true;
                     }
                 }
@@ -182,7 +184,7 @@ public class FormAuthenticator
             }
             principal = (Principal)
                 session.getNote(Constants.FORM_PRINCIPAL_NOTE);
-            register(request, response, principal,
+            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

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=1667496&r1=1667495&r2=1667496&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java (original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/SSLAuthenticator.java Wed Mar 18 11:05:29
2015
@@ -85,12 +85,13 @@ public class SSLAuthenticator extends Au
             }
             response.sendError(HttpServletResponse.SC_UNAUTHORIZED,
                                sm.getString("authenticator.unauthorized"));
-            return false;
+            return (false);
         }
 
         // Cache the principal (if requested) and record this authentication
-        register(request, response, principal, null, null);
-        return true;
+        register(request, response, principal,
+                HttpServletRequest.CLIENT_CERT_AUTH, null, null);
+        return (true);
 
     }
 

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=1667496&r1=1667495&r2=1667496&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java (original)
+++ tomcat/trunk/java/org/apache/catalina/authenticator/SpnegoAuthenticator.java Wed Mar 18
11:05:29 2015
@@ -271,7 +271,9 @@ public class SpnegoAuthenticator extends
                 + Base64.encodeBase64String(outToken));
 
         if (principal != null) {
-            register(request, response, principal,  principal.getName(), null);
+            register(request, response, principal, Constants.SPNEGO_METHOD,
+                    principal.getName(), null);
+
             Pattern p = noKeepAliveUserAgents;
             if (p != null) {
                 MessageBytes ua =



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


Mime
View raw message