You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ep...@apache.org on 2004/04/04 11:58:15 UTC

cvs commit: jakarta-turbine-fulcrum/security/xdocs changes.xml

epugh       2004/04/04 01:58:15

  Modified:    security/api/src/java/org/apache/fulcrum/security/model/basic/entity
                        BasicGroup.java BasicUser.java
               security/api/src/java/org/apache/fulcrum/security/authenticator
                        TextMatchAuthenticator.java
               security/xdocs changes.xml
  Log:
  Patches from Mike Manners.  Thanks!
  
  Revision  Changes    Path
  1.2       +15 -7     jakarta-turbine-fulcrum/security/api/src/java/org/apache/fulcrum/security/model/basic/entity/BasicGroup.java
  
  Index: BasicGroup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/security/api/src/java/org/apache/fulcrum/security/model/basic/entity/BasicGroup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicGroup.java	5 Dec 2003 23:29:12 -0000	1.1
  +++ BasicGroup.java	4 Apr 2004 09:58:15 -0000	1.2
  @@ -69,13 +69,18 @@
    */
   public class BasicGroup extends SecurityEntityImpl implements Group
   {
  -	private UserSet userSet = new UserSet();
  +	private Set userSet = new UserSet();
   	/**
   	 * @return
   	 */
   	public UserSet getUsers()
   	{
  -		return userSet;
  +	    if( userSet instanceof UserSet )
  +	        return (UserSet) userSet;
  +	    else {
  +	        userSet = new UserSet(userSet);
  +	        return (UserSet)userSet;
  +	    }
   	}
   
   	/**
  @@ -83,15 +88,18 @@
   	 */
   	public void setUsers(UserSet userSet)
   	{
  -		this.userSet = userSet;
  +	    if( userSet != null )
  +	        this.userSet = userSet;
  +	    else
  +	        this.userSet = new UserSet();
   	}
       
   	/**
   	 * @return
   	 */
  -	public UserSet getUsersAsSet()
  +	public Set getUsersAsSet()
   	{
  -		return userSet;
  +	    return userSet;
   	}
   
   	/**
  @@ -99,7 +107,7 @@
   	 */
   	public void setUsersAsSet(Set users)
   	{
  -		getUsers().add(users);
  +	    this.userSet = users;
   	}    
   
   	
  
  
  
  1.2       +16 -8     jakarta-turbine-fulcrum/security/api/src/java/org/apache/fulcrum/security/model/basic/entity/BasicUser.java
  
  Index: BasicUser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/security/api/src/java/org/apache/fulcrum/security/model/basic/entity/BasicUser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicUser.java	5 Dec 2003 23:29:12 -0000	1.1
  +++ BasicUser.java	4 Apr 2004 09:58:15 -0000	1.2
  @@ -70,7 +70,7 @@
   public class BasicUser extends SecurityEntityImpl implements User
   {
       private String password;
  -    private GroupSet groups = new GroupSet();
  +    private Set groupSet = new GroupSet();
   
       /**
        * @return
  @@ -91,14 +91,22 @@
       */
       public GroupSet getGroups()
       {
  -        return groups;
  +        if( groupSet instanceof GroupSet )
  +            return (GroupSet) groupSet;
  +        else {
  +            groupSet = new GroupSet(groupSet);
  +            return (GroupSet)groupSet;
  +        }
       }
       /**
        * @param groups
        */
       public void setGroups(GroupSet groups)
       {
  -        this.groups = groups;
  +        if( groups != null )
  +            this.groupSet = groups;
  +        else
  +            this.groupSet = new GroupSet();
       }
       public void removeGroup(Group group)
       {
  @@ -108,12 +116,12 @@
       {
           getGroups().add(group);
       }
  -    void setGroupsAsSet(Set groups)
  +    public void setGroupsAsSet(Set groups)
       {
  -        this.getGroups().add(groups);
  +        this.groupSet = groups;
       }
  -    Set getGroupsAsSet()
  +    public Set getGroupsAsSet()
       {
  -        return getGroups().getSet();
  +        return groupSet;
       }
   }
  
  
  
  1.2       +8 -2      jakarta-turbine-fulcrum/security/api/src/java/org/apache/fulcrum/security/authenticator/TextMatchAuthenticator.java
  
  Index: TextMatchAuthenticator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/security/api/src/java/org/apache/fulcrum/security/authenticator/TextMatchAuthenticator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TextMatchAuthenticator.java	5 Dec 2003 23:29:12 -0000	1.1
  +++ TextMatchAuthenticator.java	4 Apr 2004 09:58:15 -0000	1.2
  @@ -84,6 +84,12 @@
        */
       public boolean authenticate(User user, String password) throws  DataBackendException
       {
  -        return user.getPassword().equals(password);
  +        if( user == null )
  +            return false;
  +        
  +        String referenced = user.getPassword() == null ? "" : user.getPassword().trim();
  +        String tested = password == null ? "" : password.trim();
  +        
  +        return referenced.equals(tested);
       }
   }
  
  
  
  1.15      +6 -0      jakarta-turbine-fulcrum/security/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-fulcrum/security/xdocs/changes.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- changes.xml	29 Mar 2004 07:50:27 -0000	1.14
  +++ changes.xml	4 Apr 2004 09:58:15 -0000	1.15
  @@ -8,6 +8,12 @@
     <body>
       <release version="1.0-alpha-7" date="in cvs">
         <action dev="mmanner" type="add">
  +        Null passwords properly dealt with in TextMatchAuthenticator.
  +      </action>    	    	
  +      <action dev="mmanner" type="add">
  +        Change Basic* entity objects to use Set. 
  +      </action>    	
  +      <action dev="mmanner" type="add">
           Change Dynamic* entity objects to use Set.  Refactored Hibernate implementation of Security to 
           use more efficient deletion when doing oneshot deletes during revokeAll methods.  Added get[Entity]ById()
           method as well.  Change grants/revokes to be Synchronizied.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org