User: starksm 
  Date: 01/11/20 01:49:01

  Modified:    tomcat/src/main/org/jboss/tomcat/security Tag: Branch_2_4
                        JBossSecurityMgrRealm.java
  Log:
  Change to the unified log4j based org.jboss.logging.Logger class.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.9   +27 -27    
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.4.2.8
  retrieving revision 1.4.2.9
  diff -u -r1.4.2.8 -r1.4.2.9
  --- JBossSecurityMgrRealm.java        2001/09/14 17:55:08     1.4.2.8
  +++ JBossSecurityMgrRealm.java        2001/11/20 09:49:01     1.4.2.9
  @@ -17,8 +17,8 @@
   import org.apache.tomcat.core.Response;
   import org.apache.tomcat.util.SecurityTools;
   
  -import org.jboss.logging.log4j.JBossCategory;
  -import org.jboss.security.EJBSecurityManager;
  +import org.jboss.logging.Logger;
  +import org.jboss.security.AuthenticationManager;
   import org.jboss.security.RealmMapping;
   import org.jboss.security.SimplePrincipal;
   import org.jboss.security.SecurityAssociation;
  @@ -31,24 +31,24 @@
    for authorization and authenticaton.
    
    @see org.jboss.web.AbstractWebContainer
  - @see org.jboss.security.EJBSecurityManager
  + @see org.jboss.security.AuthenticationManager
    @see org.jboss.security.RealmMapping
    @see org.jboss.security.SimplePrincipal
    @see org.jboss.security.SecurityAssociation
    @see org.jboss.security.SubjectSecurityManager
    
    @author [EMAIL PROTECTED]
  - @version $Revision: 1.4.2.8 $
  + @version $Revision: 1.4.2.9 $
    */
   public class JBossSecurityMgrRealm extends BaseInterceptor
   {
  -   private static JBossCategory category = (JBossCategory) 
JBossCategory.getInstance(JBossSecurityMgrRealm.class);
  +   private static Logger log = Logger.getLogger(JBossSecurityMgrRealm.class);
      private static ThreadLocal authInfo = new ThreadLocal();
      private String subjectAttributeName = "j_subject";
      private boolean useJAAS = false;
      
      /** A flag to indicate if the security manager implements the 
SubjectSecurityManager
  -    rather than EJBSecurityManager. When true, the authenticated Subject is obtained
  +    rather than AuthenticationManager. When true, the authenticated Subject is 
obtained
       from the SubjectSecurityManager and placed into the request under the
       subjectAttributeName attribute.
       */
  @@ -99,12 +99,12 @@
            */
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         ClassLoader scl = request.getContext().getServletLoader().getClassLoader();
  -      boolean trace = category.isTraceEnabled();
  +      boolean trace = log.isTraceEnabled();
         if( trace )
         {
  -         category.trace("Authenticating access, username: " + username + " " 
+request);
  -         category.trace("ClassLoader: "+cl.toString()+':'+cl.hashCode());
  -         category.trace("Servlet ClassLoader: "+scl.toString()+':'+scl.hashCode());
  +         log.trace("Authenticating access, username: " + username + " " +request);
  +         log.trace("ClassLoader: "+cl.toString()+':'+cl.hashCode());
  +         log.trace("Servlet ClassLoader: "+scl.toString()+':'+scl.hashCode());
         }
         
         // If we don't have a security context security is not required
  @@ -114,14 +114,14 @@
         if( securityCtx == null )
         {
            if( trace )
  -            category.trace("No SecurityContext, returning 0");
  +            log.trace("No SecurityContext, returning 0");
            return 0;
         }
   
         try
         {
            // Get the JBoss security manager from the ENC context
  -         EJBSecurityManager securityMgr = (EJBSecurityManager) 
securityCtx.lookup("securityMgr");
  +         AuthenticationManager securityMgr = (AuthenticationManager) 
securityCtx.lookup("securityMgr");
            SimplePrincipal principal = new SimplePrincipal(username);
            char[] passwordChars = null;
            if( password != null )
  @@ -134,7 +134,7 @@
               if (ctx != null)
                  request.setAuthType(ctx.getAuthMethod());
               if( trace )
  -               category.trace("Username: "+username+" is authenticated");
  +               log.trace("Username: "+username+" is authenticated");
               SecurityAssociation.setPrincipal(principal);
               SecurityAssociation.setCredential(passwordChars);
               authInfo.set(new AuthInfo(principal, passwordChars));
  @@ -148,12 +148,12 @@
            else
            {
               if( trace )
  -               category.trace("User: "+username+" is NOT authenticated");
  +               log.trace("User: "+username+" is NOT authenticated");
            }
         }
         catch(NamingException e)
         {
  -         category.error("Error during authenticate", e);
  +         log.error("Error during authenticate", e);
         }
         finally 
         {
  @@ -182,12 +182,12 @@
            */
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
         ClassLoader scl = request.getContext().getServletLoader().getClassLoader();
  -      boolean trace = category.isTraceEnabled();
  +      boolean trace = log.isTraceEnabled();
         if( trace )
         {
  -         category.trace("Authenticating access, username: " + username + " " 
+request);
  -         category.trace("ClassLoader: "+cl.toString()+':'+cl.hashCode());
  -         category.trace("Servlet ClassLoader: "+scl.toString()+':'+scl.hashCode());
  +         log.trace("Authenticating access, username: " + username + " " +request);
  +         log.trace("ClassLoader: "+cl.toString()+':'+cl.hashCode());
  +         log.trace("Servlet ClassLoader: "+scl.toString()+':'+scl.hashCode());
         }
         int code = 0;
         try
  @@ -208,7 +208,7 @@
            }
            else
            {
  -            category.warn("Warning: no security context available");
  +            log.warn("Warning: no security context available");
            }
            
            if( userHasRole )
  @@ -217,18 +217,18 @@
               String userRoles[] = {};
               request.setUserRoles( userRoles );
               if( trace )
  -               category.trace("User: "+username+" is authorized");
  +               log.trace("User: "+username+" is authorized");
            }
            else
            {
               if( trace )
  -               category.trace("User: "+username+" is NOT authorized, 
requiredRoles="+requiredRoles);
  +               log.trace("User: "+username+" is NOT authorized, 
requiredRoles="+requiredRoles);
               code = 401;
            }
         }
         catch(NamingException e)
         {
  -         category.error("Error during authorize", e);
  +         log.error("Error during authorize", e);
            code = 401;
         }
         finally
  @@ -253,10 +253,10 @@
            info.depth ++;
         }
   
  -      if( category.isTraceEnabled() )
  +      if( log.isTraceEnabled() )
         {
            Principal p = SecurityAssociation.getPrincipal();
  -         category.trace("preService, auth="+info+", SA.principal="+p+", request=" 
+request);
  +         log.trace("preService, auth="+info+", SA.principal="+p+", request=" 
+request);
         }
         return 0;
      }
  @@ -267,10 +267,10 @@
      public int postService(Request request, Response response)
      {
         AuthInfo info = (AuthInfo) authInfo.get();
  -      if( category.isTraceEnabled() )
  +      if( log.isTraceEnabled() )
         {
            Principal p = SecurityAssociation.getPrincipal();
  -         category.trace("postService, auth="+info+", SA.principal="+p+", request=" 
+request);
  +         log.trace("postService, auth="+info+", SA.principal="+p+", request=" 
+request);
         }
         SecurityAssociation.setPrincipal(null);
         SecurityAssociation.setCredential(null);
  
  
  

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

Reply via email to