User: starksm 
  Date: 01/05/24 08:36:40

  Added:       tomcat/src/main/org/jboss/tomcat/security Tag: Branch_2_2
                        JBossSecurityMgrRealm.java
  Log:
  Merge 2.3 changes into 2.2 branch
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +28 -19    
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.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  --- JBossSecurityMgrRealm.java        2001/05/11 19:06:26     1.1
  +++ JBossSecurityMgrRealm.java        2001/05/24 15:36:40     1.1.2.1
  @@ -9,7 +9,6 @@
   import javax.naming.NamingException;
   import javax.security.auth.Subject;
   
  -import org.apache.log4j.Category;
   import org.apache.tomcat.core.BaseInterceptor;
   import org.apache.tomcat.core.Context;
   import org.apache.tomcat.core.Request;
  @@ -36,13 +35,13 @@
   @see org.jboss.security.SubjectSecurityManager
   
   @author [EMAIL PROTECTED]
  -@version $Revision: 1.1 $
  +@version $Revision: 1.1.2.1 $
   */
   public class JBossSecurityMgrRealm extends BaseInterceptor
   {
  -    static Category category = 
Category.getInstance(JBossSecurityMgrRealm.class.getName());
  -    public String subjectAttributeName = "j_subject";
  -    public boolean useJAAS = false;
  +    private String subjectAttributeName = "j_subject";
  +    private boolean useJAAS = false;
  +    private boolean debug = false;
   
       /** A flag to indicate if the security manager implements the 
SubjectSecurityManager
        rather than EJBSecurityManager. When true, the authenticated Subject is 
obtained
  @@ -60,6 +59,14 @@
       {
           this.subjectAttributeName = subjectAttributeName;
       }
  +    public boolean getDebug()
  +    {
  +        return debug;
  +    }
  +    public void setDebug(boolean debug)
  +    {
  +        this.debug = debug;
  +    }
   
        public int authenticate(Request request, Response response)
       {
  @@ -80,11 +87,11 @@
            */
           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());
  -            category.debug("Servlet ClassLoader: 
"+scl.toString()+':'+cl.hashCode());
  +            System.out.println("Authenticating access, username: " + username + " " 
+request);
  +            System.out.println("ClassLoader: "+cl.toString()+':'+cl.hashCode());
  +            System.out.println("Servlet ClassLoader: 
"+scl.toString()+':'+cl.hashCode());
           }
           try
           {
  @@ -100,7 +107,7 @@
                   Context ctx = request.getContext();
                   if (ctx != null)
                       request.setAuthType(ctx.getAuthMethod());
  -                category.debug("User: "+username+" is authenticated");
  +                System.out.println("User: "+username+" is authenticated");
                   SecurityAssociation.setPrincipal(principal);
                   SecurityAssociation.setCredential(password.toCharArray());
                   if( useJAAS == true && securityMgr instanceof 
SubjectSecurityManager )
  @@ -112,12 +119,13 @@
               }
               else
               {
  -                category.debug("User: "+username+" is NOT authenticated");
  +                System.out.println("User: "+username+" is NOT authenticated");
               }
           }
           catch(NamingException e)
           {
  -            category.error("Error during authenticate", e);
  +            System.out.println("Error during authenticate");
  +            e.printStackTrace();
           }
           finally
           {
  @@ -147,11 +155,11 @@
            */
           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());
  -            category.debug("Servlet ClassLoader: 
"+scl.toString()+':'+cl.hashCode());
  +            System.out.println("Authorizing access, username: " + username + " " 
+request);
  +            System.out.println("ClassLoader: "+cl.toString()+':'+cl.hashCode());
  +            System.out.println("Servlet ClassLoader: 
"+scl.toString()+':'+cl.hashCode());
           }
           int code = 0;
           try
  @@ -168,17 +176,18 @@
                   // Need to get roles from the security mgr. Needs updated 
interface...
                   String userRoles[] = {};
                   request.setUserRoles( userRoles );
  -                category.debug("User: "+username+" is authorized");
  +                System.out.println("User: "+username+" is authorized");
               }
               else
               {
  -                category.debug("User: "+username+" is not authorized");
  +                System.out.println("User: "+username+" is not authorized");
                   code = 401;
               }
           }
           catch(NamingException e)
           {
  -            category.error("Error during authorize", e);
  +            System.out.println("Error during authorize");
  +            e.printStackTrace();
               code = 401;
           }
           finally
  
  
  

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

Reply via email to