tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm GenericPrincipal.java
Date Sat, 27 Oct 2001 20:32:33 GMT
craigmcc    01/10/27 13:32:33

  Modified:    catalina/src/share/org/apache/catalina/realm Tag:
                        tomcat_40_branch GenericPrincipal.java
  Log:
  Backport the making public of GenericPrincipal.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +26 -30    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/GenericPrincipal.java
  
  Index: GenericPrincipal.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/GenericPrincipal.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- GenericPrincipal.java	2001/07/22 20:25:11	1.3
  +++ GenericPrincipal.java	2001/10/27 20:32:33	1.3.2.1
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/GenericPrincipal.java,v
1.3 2001/07/22 20:25:11 pier Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/07/22 20:25:11 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/realm/GenericPrincipal.java,v
1.3.2.1 2001/10/27 20:32:33 craigmcc Exp $
  + * $Revision: 1.3.2.1 $
  + * $Date: 2001/10/27 20:32:33 $
    *
    * ====================================================================
    *
  @@ -73,15 +73,13 @@
   
   /**
    * Generic implementation of <strong>java.security.Principal</strong> that
  - * is available for use by <code>Realm</code> implementations.  The class
  - * and all of its methods (except for <code>getName()</code>) are package
  - * private to avoid interference from applications.
  + * is available for use by <code>Realm</code> implementations.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2001/07/22 20:25:11 $
  + * @version $Revision: 1.3.2.1 $ $Date: 2001/10/27 20:32:33 $
    */
   
  -class GenericPrincipal implements Principal {
  +public class GenericPrincipal implements Principal {
   
   
       // ----------------------------------------------------------- Constructors
  @@ -95,7 +93,7 @@
        * @param name The username of the user represented by this Principal
        * @param password Credentials used to authenticate this user
        */
  -    GenericPrincipal(Realm realm, String name, String password) {
  +    public GenericPrincipal(Realm realm, String name, String password) {
   
           this(realm, name, password, null);
   
  @@ -112,7 +110,8 @@
        * @param password Credentials used to authenticate this user
        * @param roles List of roles (must be Strings) possessed by this user
        */
  -    GenericPrincipal(Realm realm, String name, String password, List roles) {
  +    public GenericPrincipal(Realm realm, String name, String password,
  +                            List roles) {
   
           super();
           this.realm = realm;
  @@ -147,7 +146,7 @@
        */
       protected String password = null;
   
  -    String getPassword() {
  +    public String getPassword() {
           return (this.password);
       }
   
  @@ -157,7 +156,7 @@
        */
       protected Realm realm = null;
   
  -    Realm getRealm() {
  +    public Realm getRealm() {
           return (this.realm);
       }
   
  @@ -167,7 +166,7 @@
        */
       protected String roles[] = new String[0];
   
  -    String[] getRoles() {
  +    public String[] getRoles() {
           return (this.roles);
       }
   
  @@ -176,32 +175,29 @@
   
   
       /**
  -     * Return a String representation of this object, which exposes only
  -     * information that should be public.
  +     * Does the user represented by this Principal possess the specified role?
  +     *
  +     * @param role Role to be tested
        */
  -    public String toString() {
  +    public boolean hasRole(String role) {
   
  -        StringBuffer sb = new StringBuffer("GenericPrincipal[");
  -        sb.append(this.name);
  -        sb.append("]");
  -        return (sb.toString());
  +        if (role == null)
  +            return (false);
  +        return (Arrays.binarySearch(roles, role) >= 0);
   
       }
   
   
  -    // -------------------------------------------------------- Package Methods
  -
  -
       /**
  -     * Does the user represented by this Principal possess the specified role?
  -     *
  -     * @param role Role to be tested
  +     * Return a String representation of this object, which exposes only
  +     * information that should be public.
        */
  -    boolean hasRole(String role) {
  +    public String toString() {
   
  -        if (role == null)
  -            return (false);
  -        return (Arrays.binarySearch(roles, role) >= 0);
  +        StringBuffer sb = new StringBuffer("GenericPrincipal[");
  +        sb.append(this.name);
  +        sb.append("]");
  +        return (sb.toString());
   
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message