tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup ContextConfig.java
Date Mon, 09 Oct 2000 23:30:43 GMT
craigmcc    00/10/09 16:30:43

  Modified:    catalina/src/share/org/apache/catalina/deploy
                        SecurityConstraint.java
               catalina/src/share/org/apache/catalina/startup
                        ContextConfig.java
  Log:
  Make it possible to distinguish the following configurations of a security
  constraint:
  - An authorization constraint specified with no defined roles
  - No authorization constraint specified
  
  This will be needed to support a clarification currently under discussion
  in the JSR-053 expert group.
  
  Revision  Changes    Path
  1.2       +36 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/SecurityConstraint.java
  
  Index: SecurityConstraint.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/SecurityConstraint.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SecurityConstraint.java	2000/08/11 05:26:19	1.1
  +++ SecurityConstraint.java	2000/10/09 23:30:40	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/SecurityConstraint.java,v
1.1 2000/08/11 05:26:19 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/11 05:26:19 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/deploy/SecurityConstraint.java,v
1.2 2000/10/09 23:30:40 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2000/10/09 23:30:40 $
    *
    * ====================================================================
    *
  @@ -77,7 +77,7 @@
    * this class is synchronized.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/08/11 05:26:19 $
  + * @version $Revision: 1.2 $ $Date: 2000/10/09 23:30:40 $
    */
   
   public final class SecurityConstraint {
  @@ -100,6 +100,15 @@
   
   
       /**
  +     * Was an authorization constraint included in this security constraint?
  +     * This is necessary to distinguish the case where an auth-constraint with
  +     * no roles (signifying no direct access at all) was requested, versus
  +     * a lack of auth-constraint which implies no access control checking.
  +     */
  +    private boolean authConstraint = false;
  +
  +
  +    /**
        * The set of roles permitted to access resources protected by this
        * security constraint.
        */
  @@ -124,6 +133,28 @@
   
   
       /**
  +     * Return the authorization constraint present flag for this security
  +     * constraint.
  +     */
  +    public boolean getAuthConstraint() {
  +
  +        return (this.authConstraint);
  +
  +    }
  +
  +
  +    /**
  +     * Set the authorization constraint present flag for this security
  +     * constraint.
  +     */
  +    public void setAuthConstraint(boolean authConstraint) {
  +
  +        this.authConstraint = authConstraint;
  +
  +    }
  +
  +
  +    /**
        * Return the user data constraint for this security constraint.
        */
       public String getUserConstraint() {
  @@ -164,6 +195,7 @@
   	    results[i] = authRoles[i];
   	results[authRoles.length] = authRole;
   	authRoles = results;
  +        authConstraint = true;
   
       }
   
  
  
  
  1.23      +30 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ContextConfig.java	2000/10/09 21:04:04	1.22
  +++ ContextConfig.java	2000/10/09 23:30:41	1.23
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
1.22 2000/10/09 21:04:04 craigmcc Exp $
  - * $Revision: 1.22 $
  - * $Date: 2000/10/09 21:04:04 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
1.23 2000/10/09 23:30:41 craigmcc Exp $
  + * $Revision: 1.23 $
  + * $Date: 2000/10/09 23:30:41 $
    *
    * ====================================================================
    *
  @@ -124,7 +124,7 @@
    * of that Context, and the associated defined servlets.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.22 $ $Date: 2000/10/09 21:04:04 $
  + * @version $Revision: 1.23 $ $Date: 2000/10/09 23:30:41 $
    */
   
   public final class ContextConfig
  @@ -568,6 +568,8 @@
   	mapper.addRule("web-app/security-constraint",
   		       mapper.addChild("addConstraint",
   				       "org.apache.catalina.deploy.SecurityConstraint"));
  +        mapper.addRule("web-app/security-constraint/auth-constraint",
  +                       new SetAuthConstraint());
   	mapper.addRule("web-app/security-constraint/auth-constraint/role-name",
   		       mapper.methodSetter("addAuthRole", 0));
   	mapper.addRule("web-app/security-constraint/user-data-constraint/transport-guarantee",
  @@ -1290,6 +1292,30 @@
   
   
   // ----------------------------------------------------------- Private Classes
  +
  +
  +/**
  + * An XmlAction that calls the <code>setAuthConstraint(true)</code> method
of
  + * the top item on the stack, which must be of type
  + * <code>org.apache.catalina.deploy.SecurityConstraint</code>.
  + */
  +
  +final class SetAuthConstraint extends XmlAction {
  +
  +    public SetAuthConstraint() {
  +        super();
  +    }
  +
  +    public void start(SaxContext ctx) {
  +        Stack stack = ctx.getObjectStack();
  +        SecurityConstraint securityConstraint =
  +            (SecurityConstraint) stack.peek();
  +        securityConstraint.setAuthConstraint(true);
  +	if (ctx.getDebug() > 0)
  +	    ctx.log("Calling SecurityConstraint.setAuthConstraint(true)");
  +    }
  +
  +}
   
   
   /**
  
  
  

Mime
View raw message