jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1479808 - in /jackrabbit/branches/2.6: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/ jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/ jackrabbit-core/src/test/java/org/apache/jackrabbit/a...
Date Tue, 07 May 2013 08:40:58 GMT
Author: alexparvulescu
Date: Tue May  7 08:40:57 2013
New Revision: 1479808

URL: http://svn.apache.org/r1479808
Log:
JCR-3577 Allow creation of users with 'null' password (backport to 2.6)

Modified:
    jackrabbit/branches/2.6/   (props changed)
    jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
    jackrabbit/branches/2.6/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
    jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java

Propchange: jackrabbit/branches/2.6/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1470957

Modified: jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java?rev=1479808&r1=1479807&r2=1479808&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/security/user/UserManagerImpl.java
Tue May  7 08:40:57 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/branches/2.6/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd?rev=1479808&r1=1479807&r2=1479808&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
(original)
+++ jackrabbit/branches/2.6/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
Tue May  7 08:40:57 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/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java?rev=1479808&r1=1479807&r2=1479808&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserManagerCreateUserTest.java
Tue May  7 08:40:57 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