User: ejort   
  Date: 02/01/04 23:53:43

  Modified:    tomcat/src/main/org/jboss/tomcat/security
                        JBossSecurityMgrRealm.java
  Log:
  Guarded debug logging
  
  Revision  Changes    Path
  1.9       +15 -8     
contrib/tomcat/src/main/org/jboss/tomcat/security/JBossSecurityMgrRealm.java
  
  Index: JBossSecurityMgrRealm.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/contrib/tomcat/src/main/org/jboss/tomcat/security/JBossSecurityMgrRealm.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- JBossSecurityMgrRealm.java        2001/07/28 18:28:46     1.8
  +++ JBossSecurityMgrRealm.java        2002/01/05 07:53:43     1.9
  @@ -37,7 +37,7 @@
   @see org.jboss.security.SubjectSecurityManager
   
   @author [EMAIL PROTECTED]
  -@version $Revision: 1.8 $
  +@version $Revision: 1.9 $
   */
   public class JBossSecurityMgrRealm extends BaseInterceptor
   {
  @@ -80,6 +80,7 @@
   
       public int authenticate(Request request, Response response)
       {
  +        boolean debug = category.isDebugEnabled();
           /* Get the username credentials from the request. We dont check
               that they are null as the security domain may consider this
               a valid indication of an unauthenticated user requesting
  @@ -97,7 +98,7 @@
            */
           ClassLoader cl = Thread.currentThread().getContextClassLoader();
           ClassLoader scl = request.getContext().getServletLoader().getClassLoader();
  -        if( category.isDebugEnabled() )
  +        if (debug)
           {
               category.debug("Authenticating access, username: " + username + " " 
+request);
               category.debug("ClassLoader: "+cl.toString()+':'+cl.hashCode());
  @@ -130,7 +131,8 @@
                   org.apache.tomcat.core.Context ctx = request.getContext();
                   if (ctx != null)
                       request.setAuthType(ctx.getAuthMethod());
  -                category.debug("User: "+username+" is authenticated");
  +                if (debug)
  +                   category.debug("User: "+username+" is authenticated");
                   SecurityAssociation.setPrincipal(principal);
                   SecurityAssociation.setCredential(passwordChars);
                   if( useJAAS == true && securityMgr instanceof 
SubjectSecurityManager )
  @@ -142,7 +144,8 @@
               }
               else
               {
  -                category.debug("User: "+username+" is NOT authenticated");
  +                if (debug)
  +                   category.debug("User: "+username+" is NOT authenticated");
               }
           }
           catch(NamingException e)
  @@ -165,10 +168,12 @@
               return 0;
           }
   
  -        String username = request.getRemoteUser(); 
  +        String username = request.getRemoteUser();
           if( username == null )
               return 401;
   
  +        boolean debug = category.isDebugEnabled();
  +
           /* Make sure the thread context class loader it set ot the servlet
               class loader. The Jdk12Interceptor should be handling this but
               it does not do it for the authenticate/authorize phases of a
  @@ -176,7 +181,7 @@
            */
           ClassLoader cl = Thread.currentThread().getContextClassLoader();
           ClassLoader scl = request.getContext().getServletLoader().getClassLoader();
  -        if( category.isDebugEnabled() )
  +        if (debug)
           {
               category.debug("Authorizing access, username: " + username + " " 
+request);
               category.debug("ClassLoader: "+cl.toString()+':'+cl.hashCode());
  @@ -209,11 +214,13 @@
                   // Need to get roles from the security mgr. Needs updated 
interface...
                   String userRoles[] = {};
                   request.setUserRoles( userRoles );
  -                category.debug("User: "+username+" is authorized");
  +                if (debug)
  +                   category.debug("User: "+username+" is authorized");
               }
               else
               {
  -                category.debug("User: "+username+" is NOT authorized, 
requiredRoles="+requiredRoles);
  +                if (debug)
  +                   category.debug("User: "+username+" is NOT authorized, 
requiredRoles="+requiredRoles);
                   code = 401;
               }
           }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to