jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1470957 - in /jackrabbit/trunk/jackrabbit-core/src: main/java/org/apache/jackrabbit/core/security/user/ main/resources/org/apache/jackrabbit/core/nodetype/ test/java/org/apache/jackrabbit/api/security/user/
Date Tue, 23 Apr 2013 13:51:46 GMT
Author: angela
Date: Tue Apr 23 13:51:46 2013
New Revision: 1470957

URL: http://svn.apache.org/r1470957
Log:
JCR-3577 : Allow creation of users with 'null' password  (patch provided by Lars Krapf)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java?rev=1470957&r1=1470956&r2=1470957&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
Tue Apr 23 13:51:46 2013
@@ -737,7 +737,12 @@ public class UserManagerImpl extends Pro
      */
     void setPassword(NodeImpl userNode, String password, boolean forceHash) throws RepositoryException
{
         if (password == null) {
-            throw new IllegalArgumentException("Password may not be null.");
+            if (userNode.isNew()) {
+                // allow creation of system-only users with 'null' passwords that cannot
login
+                return;
+            } else {
+                throw new IllegalArgumentException("Password may not be null.");
+            }
         }
         String pwHash;
         if (forceHash || PasswordUtility.isPlainTextPassword(password)) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd?rev=1470957&r1=1470956&r2=1470957&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
Tue Apr 23 13:51:46 2013
@@ -603,7 +603,7 @@
   - rep:impersonators (STRING) protected multiple
 
 [rep:User] > rep:Authorizable, rep:Impersonatable
-  - rep:password (STRING) protected mandatory
+  - rep:password (STRING) protected
   - rep:disabled (STRING) protected
 
 [rep:Group] > rep:Authorizable

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java?rev=1470957&r1=1470956&r2=1470957&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java
Tue Apr 23 13:51:46 2013
@@ -16,14 +16,14 @@
  */
 package org.apache.jackrabbit.api.security.user;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.test.NotExecutableException;
-
-import javax.jcr.RepositoryException;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.List;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <code>UserManagerCreateGroupTest</code>...
@@ -151,16 +151,15 @@ public class UserManagerCreateUserTest e
         }
     }
 
-    public void testCreateUserWithNullPassword() throws RepositoryException {
-        try {
-            Principal p = getTestPrincipal();
-            User user = createUser(p.getName(), null);
-            createdUsers.add(user);
-
-            fail("A User cannot be built with 'null' password");
-        } catch (Exception e) {
-            // ok
-        }
+    /**
+     * Test for changed behavior that allows creating of users with 'null' password.
+     *
+     * @since Jackrabbit 2.7
+     */
+    public void testCreateUserWithNullPassword() throws RepositoryException, NotExecutableException
{
+        Principal p = getTestPrincipal();
+        User user = createUser(p.getName(), null);
+        createdUsers.add(user);
     }
 
     public void testCreateUserWithEmptyPassword() throws RepositoryException, NotExecutableException
{



Mime
View raw message