luehe 2005/02/18 10:00:22 Modified: catalina/src/share/org/apache/catalina/authenticator FormAuthenticator.java NonLoginAuthenticator.java SSLAuthenticator.java SingleSignOn.java mbeans-descriptors.xml Log: - Made logging more consistent: In some classes, we used to invoke logging methods on container.getLogger(), in others, we were invoking them on Log instance created by LogFactory (in some classes, we were using both!). We now use Log instance created by LogFactory consistently. - Removed obsolete "debug" property from "NonLoginAuthenticator" MBean descriptor Revision Changes Path 1.16 +3 -3 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java Index: FormAuthenticator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/FormAuthenticator.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- FormAuthenticator.java 7 Jan 2005 10:06:38 -0000 1.15 +++ FormAuthenticator.java 18 Feb 2005 18:00:22 -0000 1.16 @@ -272,8 +272,8 @@ if (session == null) session = request.getSessionInternal(false); if (session == null) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("User took so long to log on the session expired"); + if (log.isDebugEnabled()) + log.debug("User took so long to log on the session expired"); response.sendError(HttpServletResponse.SC_REQUEST_TIMEOUT, sm.getString("authenticator.sessionExpired")); return (false); 1.8 +8 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/NonLoginAuthenticator.java Index: NonLoginAuthenticator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/NonLoginAuthenticator.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- NonLoginAuthenticator.java 23 Jun 2004 13:51:36 -0000 1.7 +++ NonLoginAuthenticator.java 18 Feb 2005 18:00:22 -0000 1.8 @@ -23,7 +23,8 @@ import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.catalina.deploy.LoginConfig; - +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** @@ -38,6 +39,9 @@ extends AuthenticatorBase { + private static Log log = LogFactory.getLog(NonLoginAuthenticator.class); + + // ----------------------------------------------------- Instance Variables @@ -91,8 +95,8 @@ associate(ssoId, getSession(request, true)); */ - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("User authentication is not required"); + if (log.isDebugEnabled()) + log.debug("User authentication is not required"); return (true); 1.19 +14 -10 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SSLAuthenticator.java Index: SSLAuthenticator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SSLAuthenticator.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- SSLAuthenticator.java 16 Jul 2004 05:47:22 -0000 1.18 +++ SSLAuthenticator.java 18 Feb 2005 18:00:22 -0000 1.19 @@ -30,7 +30,8 @@ import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.catalina.deploy.LoginConfig; - +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** @@ -45,6 +46,9 @@ extends AuthenticatorBase { + private static Log log = LogFactory.getLog(SSLAuthenticator.class); + + // ------------------------------------------------------------- Properties @@ -89,8 +93,8 @@ Principal principal = request.getUserPrincipal(); //String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE); if (principal != null) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("Already authenticated '" + principal.getName() + "'"); + if (log.isDebugEnabled()) + log.debug("Already authenticated '" + principal.getName() + "'"); // Associate the session with any existing SSO session in order // to get coordinated session invalidation at logout String ssoId = (String) request.getNote(Constants.REQ_SSOID_NOTE); @@ -125,8 +129,8 @@ */ // Retrieve the certificate chain for this client - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" Looking up certificates"); + if (log.isDebugEnabled()) + log.debug(" Looking up certificates"); X509Certificate certs[] = (X509Certificate[]) request.getAttribute(Globals.CERTIFICATES_ATTR); @@ -137,8 +141,8 @@ request.getAttribute(Globals.CERTIFICATES_ATTR); } if ((certs == null) || (certs.length < 1)) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" No certificates included with this request"); + if (log.isDebugEnabled()) + log.debug(" No certificates included with this request"); response.sendError(HttpServletResponse.SC_BAD_REQUEST, sm.getString("authenticator.certificates")); return (false); @@ -147,8 +151,8 @@ // Authenticate the specified certificate chain principal = context.getRealm().authenticate(certs); if (principal == null) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" Realm.authenticate() returned false"); + if (log.isDebugEnabled()) + log.debug(" Realm.authenticate() returned false"); response.sendError(HttpServletResponse.SC_UNAUTHORIZED, sm.getString("authenticator.unauthorized")); return (false); 1.20 +34 -29 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java Index: SingleSignOn.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/SingleSignOn.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- SingleSignOn.java 21 Sep 2004 01:45:12 -0000 1.19 +++ SingleSignOn.java 18 Feb 2005 18:00:22 -0000 1.20 @@ -37,6 +37,8 @@ import org.apache.catalina.util.LifecycleSupport; import org.apache.catalina.util.StringManager; import org.apache.catalina.valves.ValveBase; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** @@ -65,6 +67,9 @@ implements Lifecycle, SessionListener { + private static Log log = LogFactory.getLog(SingleSignOn.class); + + // ----------------------------------------------------- Instance Variables @@ -280,8 +285,8 @@ // Look up the single session id associated with this session (if any) Session session = event.getSession(); - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("Process session destroyed on " + session); + if (log.isDebugEnabled()) + log.debug("Process session destroyed on " + session); String ssoId = null; synchronized (reverse) { @@ -336,19 +341,19 @@ request.removeNote(Constants.REQ_SSOID_NOTE); // Has a valid user already been authenticated? - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("Process request for '" + request.getRequestURI() + "'"); + if (log.isDebugEnabled()) + log.debug("Process request for '" + request.getRequestURI() + "'"); if (request.getUserPrincipal() != null) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" Principal '" + request.getUserPrincipal().getName() + + if (log.isDebugEnabled()) + log.debug(" Principal '" + request.getUserPrincipal().getName() + "' has already been authenticated"); getNext().invoke(request, response); return; } // Check for the single sign on cookie - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" Checking for SSO cookie"); + if (log.isDebugEnabled()) + log.debug(" Checking for SSO cookie"); Cookie cookie = null; Cookie cookies[] = request.getCookies(); if (cookies == null) @@ -360,19 +365,19 @@ } } if (cookie == null) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" SSO cookie is not present"); + if (log.isDebugEnabled()) + log.debug(" SSO cookie is not present"); getNext().invoke(request, response); return; } // Look up the cached Principal associated with this cookie value - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" Checking for cached principal for " + cookie.getValue()); + if (log.isDebugEnabled()) + log.debug(" Checking for cached principal for " + cookie.getValue()); SingleSignOnEntry entry = lookup(cookie.getValue()); if (entry != null) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" Found cached principal '" + + if (log.isDebugEnabled()) + log.debug(" Found cached principal '" + entry.getPrincipal().getName() + "' with auth type '" + entry.getAuthType() + "'"); request.setNote(Constants.REQ_SSOID_NOTE, cookie.getValue()); @@ -382,8 +387,8 @@ request.setUserPrincipal(entry.getPrincipal()); } } else { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug(" No cached principal found, erasing SSO cookie"); + if (log.isDebugEnabled()) + log.debug(" No cached principal found, erasing SSO cookie"); cookie.setMaxAge(0); response.addCookie(cookie); } @@ -425,8 +430,8 @@ */ protected void associate(String ssoId, Session session) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("Associate sso id " + ssoId + " with session " + session); + if (log.isDebugEnabled()) + log.debug("Associate sso id " + ssoId + " with session " + session); SingleSignOnEntry sso = lookup(ssoId); if (sso != null) @@ -475,8 +480,8 @@ */ protected void deregister(String ssoId) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("Deregistering sso id '" + ssoId + "'"); + if (log.isDebugEnabled()) + log.debug("Deregistering sso id '" + ssoId + "'"); // Look up and remove the corresponding SingleSignOnEntry SingleSignOnEntry sso = null; @@ -490,8 +495,8 @@ // Expire any associated sessions Session sessions[] = sso.findSessions(); for (int i = 0; i < sessions.length; i++) { - if (container.getLogger().isTraceEnabled()) - container.getLogger().trace(" Invalidating session " + sessions[i]); + if (log.isTraceEnabled()) + log.trace(" Invalidating session " + sessions[i]); // Remove from reverse cache first to avoid recursion synchronized (reverse) { reverse.remove(sessions[i]); @@ -570,8 +575,8 @@ protected void register(String ssoId, Principal principal, String authType, String username, String password) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("Registering sso id '" + ssoId + "' for user '" + + if (log.isDebugEnabled()) + log.debug("Registering sso id '" + ssoId + "' for user '" + principal.getName() + "' with auth type '" + authType + "'"); synchronized (cache) { @@ -612,8 +617,8 @@ SingleSignOnEntry sso = lookup(ssoId); if (sso != null && !sso.getCanReauthenticate()) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("Update sso id " + ssoId + " to auth type " + authType); + if (log.isDebugEnabled()) + log.debug("Update sso id " + ssoId + " to auth type " + authType); synchronized(sso) { sso.updateCredentials(principal, authType, username, password); @@ -647,8 +652,8 @@ */ protected void removeSession(String ssoId, Session session) { - if (container.getLogger().isDebugEnabled()) - container.getLogger().debug("Removing session " + session.toString() + " from sso id " + + if (log.isDebugEnabled()) + log.debug("Removing session " + session.toString() + " from sso id " + ssoId ); // Get a reference to the SingleSignOn 1.4 +0 -4 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/mbeans-descriptors.xml Index: mbeans-descriptors.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/authenticator/mbeans-descriptors.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- mbeans-descriptors.xml 4 Oct 2004 13:27:09 -0000 1.3 +++ mbeans-descriptors.xml 18 Feb 2005 18:00:22 -0000 1.4 @@ -93,10 +93,6 @@ type="java.lang.String" writeable="false"/> - <attribute name="debug" - description="The debugging detail level for this component" - type="int"/> - <attribute name="entropy" description="A String initialization parameter used to increase the entropy of the initialization of our random number generator" type="java.lang.String"/>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]