You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@apache.org on 2002/01/24 23:45:55 UTC

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users BasicRole.java AbstractGroup.java AbstractUser.java

craigmcc    02/01/24 14:45:54

  Modified:    catalina/src/share/org/apache/catalina Group.java User.java
               catalina/src/share/org/apache/catalina/users
                        AbstractGroup.java AbstractUser.java
  Added:       catalina/src/share/org/apache/catalina Role.java
               catalina/src/share/org/apache/catalina/users BasicRole.java
  Log:
  Make o.a.c.{Group,User} extend java.security.Principal so that they fit more
  easily into environments that like to deal with Principals (like JAAS
  LoginModules).  Create a Role interface (and simple implementation) that
  also implements Principal for the same reason.
  
  Revision  Changes    Path
  1.3       +6 -5      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Group.java
  
  Index: Group.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Group.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Group.java	22 Jan 2002 23:22:23 -0000	1.2
  +++ Group.java	24 Jan 2002 22:45:54 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Group.java,v 1.2 2002/01/22 23:22:23 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/01/22 23:22:23 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Group.java,v 1.3 2002/01/24 22:45:54 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/01/24 22:45:54 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -64,6 +64,7 @@
   package org.apache.catalina;
   
   
  +import java.security.Principal;
   import java.util.Iterator;
   
   
  @@ -73,11 +74,11 @@
    * inherits the security roles assigned to the group.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:23 $
  + * @version $Revision: 1.3 $ $Date: 2002/01/24 22:45:54 $
    * @since 4.1
    */
   
  -public interface Group {
  +public interface Group extends Principal {
   
   
       // ------------------------------------------------------------- Properties
  
  
  
  1.3       +6 -5      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/User.java
  
  Index: User.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/User.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- User.java	22 Jan 2002 23:22:23 -0000	1.2
  +++ User.java	24 Jan 2002 22:45:54 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/User.java,v 1.2 2002/01/22 23:22:23 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/01/22 23:22:23 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/User.java,v 1.3 2002/01/24 22:45:54 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/01/24 22:45:54 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -64,6 +64,7 @@
   package org.apache.catalina;
   
   
  +import java.security.Principal;
   import java.util.Iterator;
   
   
  @@ -74,11 +75,11 @@
    * of specific security roles.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2002/01/22 23:22:23 $
  + * @version $Revision: 1.3 $ $Date: 2002/01/24 22:45:54 $
    * @since 4.1
    */
   
  -public interface User {
  +public interface User extends Principal {
   
   
       // ------------------------------------------------------------- Properties
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Role.java
  
  Index: Role.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Role.java,v 1.1 2002/01/24 22:45:54 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/24 22:45:54 $
   *
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  
  package org.apache.catalina;
  
  
  import java.security.Principal;
  
  
  /**
   * <p>Abstract representation of a security role, suitable for use in
   * environments like JAAS that want to deal with <code>Principals</code>.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/24 22:45:54 $
   * @since 4.1
   */
  
  public interface Role extends Principal {
  
  
      // No additional methods required
  
  
  }
  
  
  
  1.2       +17 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/AbstractGroup.java
  
  Index: AbstractGroup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/AbstractGroup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractGroup.java	20 Jan 2002 03:00:57 -0000	1.1
  +++ AbstractGroup.java	24 Jan 2002 22:45:54 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/AbstractGroup.java,v 1.1 2002/01/20 03:00:57 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/AbstractGroup.java,v 1.2 2002/01/24 22:45:54 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/24 22:45:54 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -73,7 +73,7 @@
    * <p>Convenience base class for {@link Group} implementations.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:57 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/24 22:45:54 $
    * @since 4.1
    */
   
  @@ -212,6 +212,19 @@
           synchronized (roles) {
               roles.remove(role);
           }
  +
  +    }
  +
  +
  +    // ------------------------------------------------------ Principal Methods
  +
  +
  +    /**
  +     * Make the principal name the same as the group name.
  +     */
  +    public String getName() {
  +
  +        return (getGroupname());
   
       }
   
  
  
  
  1.2       +17 -4     jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/AbstractUser.java
  
  Index: AbstractUser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/AbstractUser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractUser.java	20 Jan 2002 03:00:57 -0000	1.1
  +++ AbstractUser.java	24 Jan 2002 22:45:54 -0000	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/AbstractUser.java,v 1.1 2002/01/20 03:00:57 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2002/01/20 03:00:57 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/AbstractUser.java,v 1.2 2002/01/24 22:45:54 craigmcc Exp $
  + * $Revision: 1.2 $
  + * $Date: 2002/01/24 22:45:54 $
    *
    * ====================================================================
    * The Apache Software License, Version 1.1
  @@ -74,7 +74,7 @@
    * <p>Convenience base class for {@link User} implementations.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2002/01/20 03:00:57 $
  + * @version $Revision: 1.2 $ $Date: 2002/01/24 22:45:54 $
    * @since 4.1
    */
   
  @@ -271,6 +271,19 @@
           synchronized (roles) {
               roles.remove(role);
           }
  +
  +    }
  +
  +
  +    // ------------------------------------------------------ Principal Methods
  +
  +
  +    /**
  +     * Make the principal name the same as the group name.
  +     */
  +    public String getName() {
  +
  +        return (getUsername());
   
       }
   
  
  
  
  1.1                  jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/BasicRole.java
  
  Index: BasicRole.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/users/BasicRole.java,v 1.1 2002/01/24 22:45:54 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2002/01/24 22:45:54 $
   *
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * [Additional notices, if required by prior licensing conditions]
   *
   */
  
  
  package org.apache.catalina.users;
  
  
  import java.util.ArrayList;
  import java.util.Iterator;
  import org.apache.catalina.Role;
  
  
  /**
   * <p>Convenience base class for {@link Role} implementations.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2002/01/24 22:45:54 $
   * @since 4.1
   */
  
  public class BasicRole implements Role {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The name of this security role.
       */
      protected String name = null;
  
  
      // ----------------------------------------------------------- Role Methods
  
  
      /**
       * Return the name of this security role.
       */
      public String getName() {
  
          return (this.name);
  
      }
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>