jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1507240 [1/2] - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/ oak-core/src/main/java/org/apache/jack...
Date Fri, 26 Jul 2013 09:52:01 GMT
Author: angela
Date: Fri Jul 26 09:52:00 2013
New Revision: 1507240

URL: http://svn.apache.org/r1507240
Log:
OAK-50: user mgt

- improve naming consistency of utility classes
- improve import tests: simplify test-cases, extend teardown to remove intermediate nodes

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtil.java   (contents, props changed)
      - copied, changed from r1507208, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtility.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtil.java   (contents, props changed)
      - copied, changed from r1507208, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java   (contents, props changed)
      - copied, changed from r1507208, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilityTest.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtility.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilityTest.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/GroupImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/QueryUtil.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlAction.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationAction.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/Jackrabbit2ConfigurationTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java Fri Jul 26 09:52:00 2013
@@ -53,7 +53,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenInfo;
 import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.apache.jackrabbit.util.ISO8601;
 import org.apache.jackrabbit.util.Text;
@@ -221,7 +221,7 @@ public class TokenProviderImpl implement
                 String nodeId = getIdentifier(tokenNode.getTree());
                 String token = new StringBuilder(nodeId).append(DELIM).append(key).toString();
 
-                String keyHash = PasswordUtility.buildPasswordHash(key);
+                String keyHash = PasswordUtil.buildPasswordHash(key);
                 tokenNode.setString(TOKEN_ATTRIBUTE_KEY, keyHash);
                 final long expirationTime = creationTime + tokenExpiration;
                 tokenNode.setDate(TOKEN_ATTRIBUTE_EXPIRY, expirationTime);
@@ -483,7 +483,7 @@ public class TokenProviderImpl implement
             if (pos > -1) {
                 tk = tk.substring(pos + 1);
             }
-            if (key == null || !PasswordUtility.isSame(key, tk)) {
+            if (key == null || !PasswordUtil.isSame(key, tk)) {
                 return false;
             }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java Fri Jul 26 09:52:00 2013
@@ -39,7 +39,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.authentication.Authentication;
 import org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -205,7 +205,7 @@ public final class LoginModuleImpl exten
             return null;
         } else {
             ConfigurationParameters params = sp.getConfiguration(UserConfiguration.class).getParameters();
-            return UserUtility.getAnonymousId(params);
+            return UserUtil.getAnonymousId(params);
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java Fri Jul 26 09:52:00 2013
@@ -31,7 +31,7 @@ import org.apache.jackrabbit.oak.api.Aut
 import org.apache.jackrabbit.oak.security.user.CredentialsImpl;
 import org.apache.jackrabbit.oak.spi.security.authentication.Authentication;
 import org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials;
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -91,7 +91,7 @@ class UserAuthentication implements Auth
                 SimpleCredentials creds = (SimpleCredentials) credentials;
                 Credentials userCreds = user.getCredentials();
                 if (userId.equals(creds.getUserID()) && userCreds instanceof CredentialsImpl) {
-                    success = PasswordUtility.isSame(((CredentialsImpl) userCreds).getPasswordHash(), creds.getPassword());
+                    success = PasswordUtil.isSame(((CredentialsImpl) userCreds).getPasswordHash(), creds.getPassword());
                 }
                 checkSuccess(success, "UserId/Password mismatch.");
             } else if (credentials instanceof ImpersonationCredentials) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java Fri Jul 26 09:52:00 2013
@@ -29,7 +29,7 @@ import org.apache.jackrabbit.oak.core.Id
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 
 /**
  * Base class for {@link UserProvider} and {@link MembershipProvider}.
@@ -49,7 +49,7 @@ abstract class AuthorizableBaseProvider 
     @CheckForNull
     Tree getByID(@Nonnull String authorizableId, @Nonnull AuthorizableType authorizableType) {
         Tree tree = identifierManager.getTree(getContentID(authorizableId));
-        if (UserUtility.isType(tree, authorizableType)) {
+        if (UserUtil.isType(tree, authorizableType)) {
             return tree;
         } else {
             return null;
@@ -59,7 +59,7 @@ abstract class AuthorizableBaseProvider 
     @CheckForNull
     Tree getByPath(@Nonnull String authorizableOakPath) {
         Tree tree = root.getTree(authorizableOakPath);
-        if (UserUtility.isType(tree, AuthorizableType.AUTHORIZABLE)) {
+        if (UserUtil.isType(tree, AuthorizableType.AUTHORIZABLE)) {
             return tree;
         } else {
             return null;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/GroupImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/GroupImpl.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/GroupImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/GroupImpl.java Fri Jul 26 09:52:00 2013
@@ -31,7 +31,7 @@ import org.apache.jackrabbit.commons.ite
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,7 +52,7 @@ class GroupImpl extends AuthorizableImpl
     //---------------------------------------------------< AuthorizableImpl >---
     @Override
     void checkValidTree(Tree tree) throws RepositoryException {
-        if (tree == null || !UserUtility.isType(tree, AuthorizableType.GROUP)) {
+        if (tree == null || !UserUtil.isType(tree, AuthorizableType.GROUP)) {
             throw new IllegalArgumentException("Invalid group node: node type rep:Group expected.");
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/MembershipProvider.java Fri Jul 26 09:52:00 2013
@@ -36,7 +36,7 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.plugins.memory.PropertyStates;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.apache.jackrabbit.oak.spi.state.PropertyBuilder;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.apache.jackrabbit.oak.util.PropertyUtil;
@@ -240,7 +240,7 @@ class MembershipProvider extends Authori
      *         inherited member of it.
      */
     boolean isCyclicMembership(Tree newMemberTree, String groupContentId) {
-        if (UserUtility.isType(newMemberTree, AuthorizableType.GROUP)) {
+        if (UserUtil.isType(newMemberTree, AuthorizableType.GROUP)) {
             for (Iterator<String> it = getMembers(newMemberTree, AuthorizableType.GROUP, true); it.hasNext(); ) {
                 Tree tree = root.getTree(it.next());
                 String contentId = getContentID(tree);
@@ -301,7 +301,7 @@ class MembershipProvider extends Authori
 
             private Iterator<String> inherited(String authorizablePath) {
                 Tree group = getByPath(authorizablePath);
-                if (UserUtility.isType(group, AuthorizableType.GROUP)) {
+                if (UserUtil.isType(group, AuthorizableType.GROUP)) {
                     return getMembers(group, authorizableType, true);
                 } else {
                     return Iterators.emptyIterator();
@@ -331,7 +331,7 @@ class MembershipProvider extends Authori
 
             private Iterator<String> inherited(String authorizablePath) {
                 Tree group = getByPath(authorizablePath);
-                if (UserUtility.isType(group, AuthorizableType.GROUP)) {
+                if (UserUtil.isType(group, AuthorizableType.GROUP)) {
                     return getMembership(group, true);
                 } else {
                     return Iterators.emptyIterator();

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImpl.java Fri Jul 26 09:52:00 2013
@@ -27,8 +27,8 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.apache.jackrabbit.oak.util.TreeUtil;
 
 import static org.apache.jackrabbit.oak.api.Type.STRING;
@@ -43,13 +43,13 @@ class UserImpl extends AuthorizableImpl 
     UserImpl(String id, Tree tree, UserManagerImpl userManager) throws RepositoryException {
         super(id, tree, userManager);
 
-        isAdmin = UserUtility.getAdminId(userManager.getConfig()).equals(id);
+        isAdmin = UserUtil.getAdminId(userManager.getConfig()).equals(id);
     }
 
     //---------------------------------------------------< AuthorizableImpl >---
     @Override
     void checkValidTree(Tree tree) throws RepositoryException {
-        if (tree == null || !UserUtility.isType(tree, AuthorizableType.USER)) {
+        if (tree == null || !UserUtil.isType(tree, AuthorizableType.USER)) {
             throw new IllegalArgumentException("Invalid user node: node type rep:User expected.");
         }
     }
@@ -101,7 +101,7 @@ class UserImpl extends AuthorizableImpl 
     public void changePassword(String password, String oldPassword) throws RepositoryException {
         // make sure the old password matches.
         String pwHash = getPasswordHash();
-        if (!PasswordUtility.isSame(pwHash, oldPassword)) {
+        if (!PasswordUtil.isSame(pwHash, oldPassword)) {
             throw new RepositoryException("Failed to change password: Old password does not match.");
         }
         changePassword(password);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserManagerImpl.java Fri Jul 26 09:52:00 2013
@@ -48,8 +48,8 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableAction;
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -326,9 +326,9 @@ public class UserManagerImpl implements 
         if (id == null || tree == null) {
             return null;
         }
-        if (UserUtility.isType(tree, AuthorizableType.USER)) {
+        if (UserUtil.isType(tree, AuthorizableType.USER)) {
             return new UserImpl(userProvider.getAuthorizableId(tree), tree, this);
-        } else if (UserUtility.isType(tree, AuthorizableType.GROUP)) {
+        } else if (UserUtil.isType(tree, AuthorizableType.GROUP)) {
             return new GroupImpl(userProvider.getAuthorizableId(tree), tree, this);
         } else {
             throw new RepositoryException("Not a user or group tree " + tree.getPath() + '.');
@@ -362,9 +362,9 @@ public class UserManagerImpl implements 
 
     void setPassword(Tree userTree, String password, boolean forceHash) throws RepositoryException {
         String pwHash;
-        if (forceHash || PasswordUtility.isPlainTextPassword(password)) {
+        if (forceHash || PasswordUtil.isPlainTextPassword(password)) {
             try {
-                pwHash = PasswordUtility.buildPasswordHash(password, config);
+                pwHash = PasswordUtil.buildPasswordHash(password, config);
             } catch (NoSuchAlgorithmException e) {
                 throw new RepositoryException(e);
             } catch (UnsupportedEncodingException e) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProvider.java Fri Jul 26 09:52:00 2013
@@ -40,7 +40,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableNodeName;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
@@ -231,7 +231,7 @@ class UserProvider extends AuthorizableB
     @CheckForNull
     static String getAuthorizableId(@Nonnull Tree authorizableTree) {
         checkNotNull(authorizableTree);
-        if (UserUtility.isType(authorizableTree, AuthorizableType.AUTHORIZABLE)) {
+        if (UserUtil.isType(authorizableTree, AuthorizableType.AUTHORIZABLE)) {
             PropertyState idProp = authorizableTree.getProperty(UserConstants.REP_AUTHORIZABLE_ID);
             if (idProp != null) {
                 return idProp.getValue(STRING);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidator.java Fri Jul 26 09:52:00 2013
@@ -29,8 +29,8 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.commit.VisibleValidator;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.util.TreeUtil;
 import org.apache.jackrabbit.util.Text;
@@ -56,7 +56,7 @@ class UserValidator extends DefaultValid
         this.parentAfter = parentAfter;
         this.provider = provider;
 
-        authorizableType = UserUtility.getType(parentAfter);
+        authorizableType = UserUtil.getType(parentAfter);
     }
 
     //----------------------------------------------------------< Validator >---
@@ -101,7 +101,7 @@ class UserValidator extends DefaultValid
             }
         }
 
-        if (isUser(parentBefore) && REP_PASSWORD.equals(name) && PasswordUtility.isPlainTextPassword(after.getValue(Type.STRING))) {
+        if (isUser(parentBefore) && REP_PASSWORD.equals(name) && PasswordUtil.isPlainTextPassword(after.getValue(Type.STRING))) {
             String msg = "Password may not be plain text.";
             throw constraintViolation(24, msg);
         }
@@ -129,8 +129,8 @@ class UserValidator extends DefaultValid
     public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException {
         Tree tree = checkNotNull(parentAfter.getChild(name));
 
-        AuthorizableType type = UserUtility.getType(tree);
-        String authRoot = UserUtility.getAuthorizableRootPath(provider.getConfig(), type);
+        AuthorizableType type = UserUtil.getType(tree);
+        String authRoot = UserUtil.getAuthorizableRootPath(provider.getConfig(), type);
         if (authRoot != null) {
             assertHierarchy(tree, authRoot);
             // assert rep:principalName is present (that should actually by covered
@@ -162,7 +162,7 @@ class UserValidator extends DefaultValid
     private boolean isAdminUser(@Nonnull Tree userTree) {
         if (userTree.exists() && isUser(userTree)) {
             String id = UserProvider.getAuthorizableId(userTree);
-            return UserUtility.getAdminId(provider.getConfig()).equals(id);
+            return UserUtil.getAdminId(provider.getConfig()).equals(id);
         } else {
             return false;
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/QueryUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/QueryUtil.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/QueryUtil.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/QueryUtil.java Fri Jul 26 09:52:00 2013
@@ -25,7 +25,7 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.apache.jackrabbit.util.Text;
 
 /**
@@ -47,11 +47,11 @@ public final class QueryUtil {
     public static String getSearchRoot(AuthorizableType type, ConfigurationParameters config) {
         String path;
         if (type == AuthorizableType.USER) {
-            path = UserUtility.getAuthorizableRootPath(config, AuthorizableType.USER);
+            path = UserUtil.getAuthorizableRootPath(config, AuthorizableType.USER);
         } else if (type == AuthorizableType.GROUP) {
-            path = UserUtility.getAuthorizableRootPath(config, AuthorizableType.GROUP);
+            path = UserUtil.getAuthorizableRootPath(config, AuthorizableType.GROUP);
         } else {
-            path = UserUtility.getAuthorizableRootPath(config, AuthorizableType.AUTHORIZABLE);
+            path = UserUtil.getAuthorizableRootPath(config, AuthorizableType.AUTHORIZABLE);
         }
         StringBuilder searchRoot = new StringBuilder();
         searchRoot.append("/jcr:root").append(path);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/query/ResultRowToAuthorizable.java Fri Jul 26 09:52:00 2013
@@ -28,7 +28,7 @@ import org.apache.jackrabbit.oak.api.Res
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.spi.security.user.AuthorizableType;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,10 +65,10 @@ class ResultRowToAuthorizable implements
         Authorizable authorizable = null;
         try {
             Tree tree = root.getTree(resultPath);
-            AuthorizableType type = UserUtility.getType(tree);
+            AuthorizableType type = UserUtil.getType(tree);
             while (tree.exists() && !tree.isRoot() && type == null) {
                 tree = tree.getParent();
-                type = UserUtility.getType(tree);
+                type = UserUtil.getType(tree);
             }
             if (tree.exists() && (targetType == null || targetType == type)) {
                 authorizable = userManager.getAuthorizableByPath(tree.getPath());

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConstants.java Fri Jul 26 09:52:00 2013
@@ -21,7 +21,9 @@ import java.util.Collection;
 import com.google.common.collect.ImmutableSet;
 
 /**
- * User management related constants.
+ * User management related constants. Please note that all names and paths
+ * are OAK names/paths and therefore are not suited to be used in JCR context
+ * with remapped namespaces.
  */
 public interface UserConstants {
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlAction.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlAction.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlAction.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AccessControlAction.java Fri Jul 26 09:52:00 2013
@@ -37,7 +37,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -213,7 +213,7 @@ public class AccessControlAction extends
         }
         ConfigurationParameters userConfig = securityProvider.getConfiguration(UserConfiguration.class).getParameters();
         String userId = authorizable.getID();
-        return UserUtility.getAdminId(userConfig).equals(userId) || UserUtility.getAnonymousId(userConfig).equals(userId);
+        return UserUtil.getAdminId(userConfig).equals(userId) || UserUtil.getAnonymousId(userConfig).equals(userId);
     }
 
     /**

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationAction.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationAction.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationAction.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationAction.java Fri Jul 26 09:52:00 2013
@@ -28,7 +28,7 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -102,7 +102,7 @@ public class PasswordValidationAction ex
      * doesn't match the specified password pattern.
      */
     private void validatePassword(@Nullable String password, boolean forceMatch) throws RepositoryException {
-        if (password != null && (forceMatch || PasswordUtility.isPlainTextPassword(password))) {
+        if (password != null && (forceMatch || PasswordUtil.isPlainTextPassword(password))) {
             if (pattern != null && !pattern.matcher(password).matches()) {
                 throw new ConstraintViolationException("Password violates password constraint (" + pattern.pattern() + ").");
             }

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtil.java (from r1507208, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtility.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtil.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtil.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtility.java&r1=1507208&r2=1507240&rev=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtility.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtil.java Fri Jul 26 09:52:00 2013
@@ -37,9 +37,9 @@ import org.slf4j.LoggerFactory;
 /**
  * Utility to generate and compare password hashes.
  */
-public final class PasswordUtility {
+public final class PasswordUtil {
 
-    private static final Logger log = LoggerFactory.getLogger(PasswordUtility.class);
+    private static final Logger log = LoggerFactory.getLogger(PasswordUtil.class);
 
     private static final char DELIMITER = '-';
     private static final int NO_ITERATIONS = 1;
@@ -57,7 +57,7 @@ public final class PasswordUtility {
     /**
      * Avoid instantiation
      */
-    private PasswordUtility() {}
+    private PasswordUtil() {}
 
     /**
      * Generates a hash of the specified password with the default values

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtil.java (from r1507208, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtil.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtil.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java&r1=1507208&r2=1507240&rev=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtility.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtil.java Fri Jul 26 09:52:00 2013
@@ -30,9 +30,9 @@ import org.apache.jackrabbit.util.Text;
 /**
  * Utility methods for user management.
  */
-public final class UserUtility implements UserConstants {
+public final class UserUtil implements UserConstants {
 
-    private UserUtility() {
+    private UserUtil() {
     }
 
     @Nonnull

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/util/UserUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/AbstractSecurityTest.java Fri Jul 26 09:52:00 2013
@@ -50,7 +50,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalConfiguration;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.junit.After;
 import org.junit.Before;
 
@@ -126,7 +126,7 @@ public abstract class AbstractSecurityTe
     }
 
     protected Credentials getAdminCredentials() {
-        String adminId = UserUtility.getAdminId(getUserConfiguration().getParameters());
+        String adminId = UserUtil.getAdminId(getUserConfiguration().getParameters());
         return new SimpleCredentials(adminId, adminId.toCharArray());
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/GuestDefaultLoginModuleTest.java Fri Jul 26 09:52:00 2013
@@ -26,7 +26,7 @@ import org.apache.jackrabbit.oak.api.Aut
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl;
 import org.apache.jackrabbit.oak.spi.security.authentication.GuestLoginModule;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -68,7 +68,7 @@ public class GuestDefaultLoginModuleTest
         ContentSession cs = login(null);
         try {
             AuthInfo authInfo = cs.getAuthInfo();
-            String anonymousID = UserUtility.getAnonymousId(getUserConfiguration().getParameters());
+            String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters());
             assertEquals(anonymousID, authInfo.getUserID());
         } finally {
             cs.close();
@@ -80,7 +80,7 @@ public class GuestDefaultLoginModuleTest
         ContentSession cs = login(new GuestCredentials());
         try {
             AuthInfo authInfo = cs.getAuthInfo();
-            String anonymousID = UserUtility.getAnonymousId(getUserConfiguration().getParameters());
+            String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters());
             assertEquals(anonymousID, authInfo.getUserID());
         } finally {
             cs.close();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/Jackrabbit2ConfigurationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/Jackrabbit2ConfigurationTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/Jackrabbit2ConfigurationTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/Jackrabbit2ConfigurationTest.java Fri Jul 26 09:52:00 2013
@@ -22,7 +22,7 @@ import org.apache.jackrabbit.oak.api.Aut
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.authentication.ConfigurationUtil;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -42,7 +42,7 @@ public class Jackrabbit2ConfigurationTes
         ContentSession cs = login(null);
         try {
             AuthInfo authInfo = cs.getAuthInfo();
-            String anonymousID = UserUtility.getAnonymousId(getUserConfiguration().getParameters());
+            String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters());
             assertEquals(anonymousID, authInfo.getUserID());
         } finally {
             cs.close();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImplTest.java Fri Jul 26 09:52:00 2013
@@ -32,7 +32,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.junit.Test;
 
 import static org.junit.Assert.assertEquals;
@@ -70,7 +70,7 @@ public class LoginModuleImplTest extends
         ContentSession cs = login(new GuestCredentials());
         try {
             AuthInfo authInfo = cs.getAuthInfo();
-            String anonymousID = UserUtility.getAnonymousId(getUserConfiguration().getParameters());
+            String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters());
             assertEquals(anonymousID, authInfo.getUserID());
         } finally {
             cs.close();
@@ -79,7 +79,7 @@ public class LoginModuleImplTest extends
 
     @Test
     public void testAnonymousLogin() throws Exception {
-        String anonymousID = UserUtility.getAnonymousId(getUserConfiguration().getParameters());
+        String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters());
 
         UserManager userMgr = getUserManager(root);
 
@@ -177,7 +177,7 @@ public class LoginModuleImplTest extends
             cs = null;
 
             ConfigurationParameters config = securityProvider.getConfiguration(UserConfiguration.class).getParameters();
-            String adminId = UserUtility.getAdminId(config);
+            String adminId = UserUtil.getAdminId(config);
             sc = new SimpleCredentials(adminId, new char[0]);
             ImpersonationCredentials ic = new ImpersonationCredentials(sc, authInfo);
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserInitializerTest.java Fri Jul 26 09:52:00 2013
@@ -47,7 +47,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.principal.AdminPrincipal;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.UserUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.UserUtil;
 import org.apache.jackrabbit.oak.util.TreeUtil;
 import org.junit.Before;
 import org.junit.Test;
@@ -79,13 +79,13 @@ public class UserInitializerTest extends
 
     @Test
     public void testBuildInUserExist() throws Exception {
-        assertNotNull(userMgr.getAuthorizable(UserUtility.getAdminId(config)));
-        assertNotNull(userMgr.getAuthorizable(UserUtility.getAnonymousId(config)));
+        assertNotNull(userMgr.getAuthorizable(UserUtil.getAdminId(config)));
+        assertNotNull(userMgr.getAuthorizable(UserUtil.getAnonymousId(config)));
     }
 
     @Test
     public void testAdminUser() throws Exception {
-        Authorizable a = userMgr.getAuthorizable(UserUtility.getAdminId(config));
+        Authorizable a = userMgr.getAuthorizable(UserUtil.getAdminId(config));
         assertFalse(a.isGroup());
 
         User admin = (User) a;
@@ -97,7 +97,7 @@ public class UserInitializerTest extends
 
     @Test
     public void testAnonymous() throws Exception {
-        Authorizable a = userMgr.getAuthorizable(UserUtility.getAnonymousId(config));
+        Authorizable a = userMgr.getAuthorizable(UserUtil.getAnonymousId(config));
         assertFalse(a.isGroup());
 
         User anonymous = (User) a;
@@ -109,10 +109,10 @@ public class UserInitializerTest extends
 
     @Test
     public void testUserContent() throws Exception {
-        Authorizable a = userMgr.getAuthorizable(UserUtility.getAdminId(config));
+        Authorizable a = userMgr.getAuthorizable(UserUtil.getAdminId(config));
         assertTrue(root.getTree(a.getPath()).exists());
 
-        a = userMgr.getAuthorizable(UserUtility.getAnonymousId(config));
+        a = userMgr.getAuthorizable(UserUtil.getAnonymousId(config));
         assertTrue(root.getTree(a.getPath()).exists());
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/user/UserManagerImplTest.java Fri Jul 26 09:52:00 2013
@@ -40,7 +40,7 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.junit.After;
 import org.junit.Before;
@@ -89,7 +89,7 @@ public class UserManagerImplTest extends
             userMgr.setPassword(userTree, pw, true);
             String pwHash = userTree.getProperty(UserConstants.REP_PASSWORD).getValue(Type.STRING);
             assertNotNull(pwHash);
-            assertTrue(PasswordUtility.isSame(pwHash, pw));
+            assertTrue(PasswordUtil.isSame(pwHash, pw));
         }
 
         for (String pw : pwds) {
@@ -97,9 +97,9 @@ public class UserManagerImplTest extends
             String pwHash = userTree.getProperty(UserConstants.REP_PASSWORD).getValue(Type.STRING);
             assertNotNull(pwHash);
             if (!pw.startsWith("{")) {
-                assertTrue(PasswordUtility.isSame(pwHash, pw));
+                assertTrue(PasswordUtil.isSame(pwHash, pw));
             } else {
-                assertFalse(PasswordUtility.isSame(pwHash, pw));
+                assertFalse(PasswordUtil.isSame(pwHash, pw));
                 assertEquals(pw, pwHash);
             }
         }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/action/PasswordValidationActionTest.java Fri Jul 26 09:52:00 2013
@@ -34,7 +34,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
+import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtil;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -126,13 +126,13 @@ public class PasswordValidationActionTes
 
     @Test
     public void testPasswordValidationActionOnCreate() throws Exception {
-        String hashed = PasswordUtility.buildPasswordHash("DWkej32H");
+        String hashed = PasswordUtil.buildPasswordHash("DWkej32H");
         testUser = getUserManager(root).createUser("testuser", hashed);
         root.commit();
 
         String pwValue = root.getTree(testUser.getPath()).getProperty(UserConstants.REP_PASSWORD).getValue(Type.STRING);
-        assertFalse(PasswordUtility.isPlainTextPassword(pwValue));
-        assertTrue(PasswordUtility.isSame(pwValue, hashed));
+        assertFalse(PasswordUtil.isPlainTextPassword(pwValue));
+        assertTrue(PasswordUtil.isSame(pwValue, hashed));
     }
 
     @Test
@@ -142,7 +142,7 @@ public class PasswordValidationActionTes
         try {
             pwAction.setConstraint("abc");
 
-            String hashed = PasswordUtility.buildPasswordHash("abc");
+            String hashed = PasswordUtil.buildPasswordHash("abc");
             testUser.changePassword(hashed);
 
             fail("Password change must always enforce password validation.");

Copied: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java (from r1507208, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilityTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java?p2=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java&p1=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilityTest.java&r1=1507208&r2=1507240&rev=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilityTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java Fri Jul 26 09:52:00 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.spi.security.user.util;
 
-import org.apache.jackrabbit.oak.spi.security.user.util.PasswordUtility;
 import org.junit.Test;
 
 import java.security.NoSuchAlgorithmException;
@@ -30,7 +29,7 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-public class PasswordUtilityTest {
+public class PasswordUtilTest {
 
     private static List<String> PLAIN_PWDS = new ArrayList<String>();
     static {
@@ -49,7 +48,7 @@ public class PasswordUtilityTest {
     static {
         for (String pw : PLAIN_PWDS) {
             try {
-                HASHED_PWDS.put(pw, PasswordUtility.buildPasswordHash(pw));
+                HASHED_PWDS.put(pw, PasswordUtil.buildPasswordHash(pw));
             } catch (Exception e) {
                 // should not get here
             }
@@ -59,7 +58,7 @@ public class PasswordUtilityTest {
     @Test
     public void testBuildPasswordHash() throws Exception {
         for (String pw : PLAIN_PWDS) {
-            String pwHash = PasswordUtility.buildPasswordHash(pw);
+            String pwHash = PasswordUtil.buildPasswordHash(pw);
             assertFalse(pw.equals(pwHash));
         }
 
@@ -74,7 +73,7 @@ public class PasswordUtilityTest {
                 int saltsize = params[0];
                 int iterations = params[1];
 
-                String pwHash = PasswordUtility.buildPasswordHash(pw, PasswordUtility.DEFAULT_ALGORITHM, saltsize, iterations);
+                String pwHash = PasswordUtil.buildPasswordHash(pw, PasswordUtil.DEFAULT_ALGORITHM, saltsize, iterations);
                 assertFalse(pw.equals(pwHash));
             }
         }
@@ -89,7 +88,7 @@ public class PasswordUtilityTest {
 
         for (String invalid : invalidAlgorithms) {
             try {
-                String pwHash = PasswordUtility.buildPasswordHash("pw", invalid, PasswordUtility.DEFAULT_SALT_SIZE, PasswordUtility.DEFAULT_ITERATIONS);
+                String pwHash = PasswordUtil.buildPasswordHash("pw", invalid, PasswordUtil.DEFAULT_SALT_SIZE, PasswordUtil.DEFAULT_ITERATIONS);
                 fail("Invalid algorithm " + invalid);
             } catch (NoSuchAlgorithmException e) {
                 // success
@@ -101,19 +100,19 @@ public class PasswordUtilityTest {
     @Test
     public void testIsPlainTextPassword() throws Exception {
         for (String pw : PLAIN_PWDS) {
-            assertTrue(pw + " should be plain text.", PasswordUtility.isPlainTextPassword(pw));
+            assertTrue(pw + " should be plain text.", PasswordUtil.isPlainTextPassword(pw));
         }
     }
 
     @Test
     public void testIsPlainTextForNull() throws Exception {
-        assertTrue(PasswordUtility.isPlainTextPassword(null));
+        assertTrue(PasswordUtil.isPlainTextPassword(null));
     }
 
     @Test
     public void testIsPlainTextForPwHash() throws Exception {
         for (String pwHash : HASHED_PWDS.values()) {
-            assertFalse(pwHash + " should not be plain text.", PasswordUtility.isPlainTextPassword(pwHash));
+            assertFalse(pwHash + " should not be plain text.", PasswordUtil.isPlainTextPassword(pwHash));
         }
     }
 
@@ -121,18 +120,18 @@ public class PasswordUtilityTest {
     public void testIsSame() throws Exception {
         for (String pw : HASHED_PWDS.keySet()) {
             String pwHash = HASHED_PWDS.get(pw);
-            assertTrue("Not the same " + pw + ", " + pwHash, PasswordUtility.isSame(pwHash, pw));
+            assertTrue("Not the same " + pw + ", " + pwHash, PasswordUtil.isSame(pwHash, pw));
         }
 
         String pw = "password";
-        String pwHash = PasswordUtility.buildPasswordHash(pw, "SHA-1", 4, 50);
-        assertTrue("Not the same '" + pw + "', " + pwHash, PasswordUtility.isSame(pwHash, pw));
+        String pwHash = PasswordUtil.buildPasswordHash(pw, "SHA-1", 4, 50);
+        assertTrue("Not the same '" + pw + "', " + pwHash, PasswordUtil.isSame(pwHash, pw));
 
-        pwHash = PasswordUtility.buildPasswordHash(pw, "md5", 0, 5);
-        assertTrue("Not the same '" + pw + "', " + pwHash, PasswordUtility.isSame(pwHash, pw));
+        pwHash = PasswordUtil.buildPasswordHash(pw, "md5", 0, 5);
+        assertTrue("Not the same '" + pw + "', " + pwHash, PasswordUtil.isSame(pwHash, pw));
 
-        pwHash = PasswordUtility.buildPasswordHash(pw, "md5", -1, -1);
-        assertTrue("Not the same '" + pw + "', " + pwHash, PasswordUtility.isSame(pwHash, pw));
+        pwHash = PasswordUtil.buildPasswordHash(pw, "md5", -1, -1);
+        assertTrue("Not the same '" + pw + "', " + pwHash, PasswordUtil.isSame(pwHash, pw));
     }
 
     @Test
@@ -140,10 +139,10 @@ public class PasswordUtilityTest {
         String previous = null;
         for (String pw : HASHED_PWDS.keySet()) {
             String pwHash = HASHED_PWDS.get(pw);
-            assertFalse(pw, PasswordUtility.isSame(pw, pw));
-            assertFalse(pwHash, PasswordUtility.isSame(pwHash, pwHash));
+            assertFalse(pw, PasswordUtil.isSame(pw, pw));
+            assertFalse(pwHash, PasswordUtil.isSame(pwHash, pwHash));
             if (previous != null) {
-                assertFalse(previous, PasswordUtility.isSame(pwHash, previous));
+                assertFalse(previous, PasswordUtil.isSame(pwHash, previous));
             }
             previous = pw;
         }
@@ -153,9 +152,9 @@ public class PasswordUtilityTest {
     public void testPBKDF2WithHmacSHA1() throws Exception {
         String algo = "PBKDF2WithHmacSHA1";
         // test vector from http://tools.ietf.org/html/rfc6070
-        String hash = PasswordUtility.generateHash(
-                "pass\0word", algo, 
-                PasswordUtility.convertBytesToHex("sa\0lt".getBytes()), 4096);
+        String hash = PasswordUtil.generateHash(
+                "pass\0word", algo,
+                PasswordUtil.convertBytesToHex("sa\0lt".getBytes()), 4096);
         assertEquals("{PBKDF2WithHmacSHA1}7361006c74-4096-56fa6aa75548099dcc37d7f03425e0c3", hash);
     }
     

Propchange: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/user/util/PasswordUtilTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/AbstractImportTest.java Fri Jul 26 09:52:00 2013
@@ -20,8 +20,8 @@ import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
-
 import javax.jcr.ImportUUIDBehavior;
 import javax.jcr.Node;
 import javax.jcr.Repository;
@@ -61,6 +61,8 @@ public abstract class AbstractImportTest
     protected Session adminSession;
     protected UserManager userMgr;
 
+    protected abstract List<String> getPathsToRemove();
+
     @Override
     @Before
     protected void setUp() throws Exception {
@@ -86,21 +88,10 @@ public abstract class AbstractImportTest
         }
         userMgr = ((JackrabbitSession) adminSession).getUserManager();
 
-        // avoid collision with testing a-folders that may have been created
-        // with another test (but not removed as user/groups got removed)
-        String path = USERPATH + "/t";
-        if (adminSession.nodeExists(path)) {
-            adminSession.getNode(path).remove();
-        }
-        path = GROUPPATH + "/g";
-        if (adminSession.nodeExists(path)) {
-            adminSession.getNode(path).remove();
-        }
-
         // make sure the target node for group-import exists
         Authorizable administrators = userMgr.getAuthorizable(ADMINISTRATORS);
         if (administrators == null) {
-            userMgr.createGroup(new PrincipalImpl(ADMINISTRATORS));
+            administrators = userMgr.createGroup(new PrincipalImpl(ADMINISTRATORS));
             adminSession.save();
             removeAdministrators = true;
         } else if (!administrators.isGroup()) {
@@ -114,14 +105,10 @@ public abstract class AbstractImportTest
     protected void tearDown() throws Exception {
         try {
             adminSession.refresh(false);
-
-            String path = USERPATH + "/t";
-            if (adminSession.nodeExists(path)) {
-                adminSession.getNode(path).remove();
-            }
-            path = GROUPPATH + "/g";
-            if (adminSession.nodeExists(path)) {
-                adminSession.getNode(path).remove();
+            for (String path : getPathsToRemove()) {
+                if (adminSession.nodeExists(path)) {
+                    adminSession.removeItem(path);
+                }
             }
             if (removeAdministrators) {
                 Authorizable a = userMgr.getAuthorizable(ADMINISTRATORS);
@@ -164,4 +151,4 @@ public abstract class AbstractImportTest
             assertFalse(potentialID.equals(session.getNode(member.getPath()).getIdentifier()));
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/MemberNodeImportTest.java Fri Jul 26 09:52:00 2013
@@ -25,6 +25,7 @@ import javax.jcr.NodeIterator;
 import javax.jcr.PropertyType;
 import javax.jcr.Value;
 
+import com.google.common.collect.ImmutableList;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
@@ -42,6 +43,11 @@ import org.junit.Test;
 public class MemberNodeImportTest extends AbstractImportTest {
 
     @Override
+    protected List<String> getPathsToRemove() {
+        return ImmutableList.of(GROUPPATH + "/s", GROUPPATH + "/gFolder");
+    }
+
+    @Override
     @Before
     public void setUp() throws Exception {
         super.setUp();
@@ -222,4 +228,4 @@ public class MemberNodeImportTest extend
             superuser.refresh(false);
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportAbortTest.java Fri Jul 26 09:52:00 2013
@@ -22,6 +22,7 @@ import java.util.UUID;
 import javax.jcr.RepositoryException;
 import javax.security.auth.Subject;
 
+import com.google.common.collect.ImmutableList;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalImpl;
 import org.apache.jackrabbit.oak.spi.xml.ImportBehavior;
 import org.junit.Test;
@@ -32,6 +33,11 @@ import org.junit.Test;
 public class UserImportAbortTest extends AbstractImportTest {
 
     @Override
+    protected List<String> getPathsToRemove() {
+        return ImmutableList.of(GROUPPATH + "/gFolder", USERPATH + "/t");
+    }
+
+    @Override
     protected String getImportBehavior() {
         return ImportBehavior.NAME_ABORT;
     }
@@ -66,7 +72,6 @@ public class UserImportAbortTest extends
 
     @Test
     public void testImportSelfAsGroupAbort() throws Exception {
-
         String invalidId = "0120a4f9-196a-3f9e-b9f5-23f31f914da7"; // uuid of the group itself
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                 "<sv:node sv:name=\"gFolder\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\" xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\" xmlns:jcr=\"http://www.jcp.org/jcr/1.0\">" +
@@ -82,8 +87,6 @@ public class UserImportAbortTest extends
             fail("Importing self as group with ImportBehavior.ABORT must fail.");
         } catch (RepositoryException e) {
             // success.
-        }finally {
-            adminSession.refresh(false);
         }
     }
 
@@ -99,7 +102,8 @@ public class UserImportAbortTest extends
                     "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:User</sv:value></sv:property>" +
                     "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>e358efa4-89f5-3062-b10d-d7316b65649e</sv:value></sv:property>" +
                     "   <sv:property sv:name=\"rep:password\" sv:type=\"String\"><sv:value>{sha1}8efd86fb78a56a5145ed7739dcb00c78581c5375</sv:value></sv:property>" +
-                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property><sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>" +principalName+ "</sv:value></sv:property>" +
+                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
+                    "   <sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>" +principalName+ "</sv:value></sv:property>" +
                     "</sv:node>";
             Subject subj = new Subject();
             subj.getPrincipals().add(new PrincipalImpl(principalName));
@@ -141,4 +145,4 @@ public class UserImportAbortTest extends
             }
         }
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportBestEffortTest.java Fri Jul 26 09:52:00 2013
@@ -27,6 +27,7 @@ import javax.jcr.PropertyType;
 import javax.jcr.Value;
 import javax.security.auth.Subject;
 
+import com.google.common.collect.ImmutableList;
 import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
@@ -43,6 +44,11 @@ import org.junit.Test;
 public class UserImportBestEffortTest extends AbstractImportTest {
 
     @Override
+    protected List<String> getPathsToRemove() {
+        return ImmutableList.of(GROUPPATH + "/gFolder", USERPATH + "/t", USERPATH + "/uFolder");
+    }
+
+    @Override
     protected String getImportBehavior() {
         return ImportBehavior.NAME_BESTEFFORT;
     }
@@ -99,7 +105,6 @@ public class UserImportBestEffortTest ex
         if (userMgr.getAuthorizable("g") != null) {
             throw new NotExecutableException();
         }
-
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                 "<sv:node sv:name=\"gFolder\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\" xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\" xmlns:jcr=\"http://www.jcp.org/jcr/1.0\">" +
                 "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property>" +
@@ -110,14 +115,6 @@ public class UserImportBestEffortTest ex
                 "</sv:node>" +
                 "</sv:node>";
 
-        String xml2 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-                "   <sv:node sv:name=\"g\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\" xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\" xmlns:jcr=\"http://www.jcp.org/jcr/1.0\">" +
-                "       <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:Group</sv:value></sv:property>" +
-                "       <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>" + nonExistingId + "</sv:value></sv:property>" +
-                "       <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-                "       <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" + g1Id + "</sv:value></sv:property>" +
-                "   </sv:node>";
-
         // BESTEFFORT behavior -> must import non-existing members.
         doImport(GROUPPATH, xml);
         Authorizable g1 = userMgr.getAuthorizable("g1");
@@ -250,8 +247,6 @@ public class UserImportBestEffortTest ex
 
         } catch (ItemExistsException e) {
             // success.
-        } finally {
-            adminSession.refresh(false);
         }
     }
 
@@ -260,36 +255,31 @@ public class UserImportBestEffortTest ex
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                 "<sv:node sv:name=\"uFolder\" xmlns:mix=\"http://www.jcp.org/jcr/mix/1.0\" xmlns:nt=\"http://www.jcp.org/jcr/nt/1.0\" xmlns:fn_old=\"http://www.w3.org/2004/10/xpath-functions\" xmlns:fn=\"http://www.w3.org/2005/xpath-functions\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:sv=\"http://www.jcp.org/jcr/sv/1.0\" xmlns:rep=\"internal\" xmlns:jcr=\"http://www.jcp.org/jcr/1.0\">" +
                 "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:AuthorizableFolder</sv:value></sv:property>" +
-                    "<sv:node sv:name=\"t\">" +
-                    "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:User</sv:value></sv:property>" +
-                    "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>e358efa4-89f5-3062-b10d-d7316b65649e</sv:value></sv:property>" +
-                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
-                    "   <sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-                    "</sv:node>" +
-                    "<sv:node sv:name=\"g\">" +
-                    "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:User</sv:value></sv:property>" +
-                    "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>b2f5ff47-4366-31b6-a533-d8dc3614845d</sv:value></sv:property>" +
-                    "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
-                    "</sv:node>" +
+                "<sv:node sv:name=\"t\">" +
+                "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:User</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>e358efa4-89f5-3062-b10d-d7316b65649e</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
+                "</sv:node>" +
+                "<sv:node sv:name=\"g\">" +
+                "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:User</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>b2f5ff47-4366-31b6-a533-d8dc3614845d</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>g</sv:value></sv:property>" +
+                "</sv:node>" +
                 "</sv:node>";
-        try {
-            doImport(USERPATH, xml);
-
-            Authorizable newUser = userMgr.getAuthorizable("t");
-            assertNotNull(newUser);
+        doImport(USERPATH, xml);
 
-            Authorizable u2 = userMgr.getAuthorizable("g");
-            assertNotNull(u2);
+        Authorizable newUser = userMgr.getAuthorizable("t");
+        assertNotNull(newUser);
 
-            Subject subj = new Subject();
-            subj.getPrincipals().add(u2.getPrincipal());
+        Authorizable u2 = userMgr.getAuthorizable("g");
+        assertNotNull(u2);
 
-            Impersonation imp = ((User) newUser).getImpersonation();
-            assertTrue(imp.allows(subj));
+        Subject subj = new Subject();
+        subj.getPrincipals().add(u2.getPrincipal());
 
-        } finally {
-            superuser.refresh(false);
-        }
+        Impersonation imp = ((User) newUser).getImpersonation();
+        assertTrue(imp.allows(subj));
     }
 
     @Test
@@ -300,9 +290,9 @@ public class UserImportBestEffortTest ex
                 "   <sv:property sv:name=\"jcr:primaryType\" sv:type=\"Name\"><sv:value>rep:User</sv:value></sv:property>" +
                 "   <sv:property sv:name=\"jcr:uuid\" sv:type=\"String\"><sv:value>e358efa4-89f5-3062-b10d-d7316b65649e</sv:value></sv:property>" +
                 "   <sv:property sv:name=\"rep:password\" sv:type=\"String\"><sv:value>{sha1}8efd86fb78a56a5145ed7739dcb00c78581c5375</sv:value></sv:property>" +
-                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property><sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>" +principalName+ "</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:principalName\" sv:type=\"String\"><sv:value>t</sv:value></sv:property>" +
+                "   <sv:property sv:name=\"rep:impersonators\" sv:type=\"String\"><sv:value>" +principalName+ "</sv:value></sv:property>" +
                 "</sv:node>";
-
         doImport(USERPATH, xml);
 
         Authorizable a = userMgr.getAuthorizable("t");
@@ -319,4 +309,4 @@ public class UserImportBestEffortTest ex
         }
         assertTrue(found);
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java?rev=1507240&r1=1507239&r2=1507240&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/user/UserImportIgnoreTest.java Fri Jul 26 09:52:00 2013
@@ -21,6 +21,7 @@ import java.util.List;
 import java.util.UUID;
 import javax.security.auth.Subject;
 
+import com.google.common.collect.ImmutableList;
 import org.apache.jackrabbit.api.security.principal.PrincipalIterator;
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
@@ -40,6 +41,11 @@ public class UserImportIgnoreTest extend
         return ImportBehavior.NAME_IGNORE;
     }
 
+    @Override
+    protected List<String> getPathsToRemove() {
+        return ImmutableList.of(GROUPPATH + "/gFolder", USERPATH + "/t");
+    }
+
     @Test
     public void testImportSelfAsGroupIgnore() throws Exception {
         String invalidId = "0120a4f9-196a-3f9e-b9f5-23f31f914da7"; // uuid of the group itself
@@ -52,17 +58,13 @@ public class UserImportIgnoreTest extend
                 "   <sv:property sv:name=\"rep:members\" sv:type=\"WeakReference\"><sv:value>" +invalidId+ "</sv:value></sv:property>" +
                 "</sv:node>" +
                 "</sv:node>";
-        try {
-            doImport(GROUPPATH, xml);
-            // no exception during import -> member must have been ignored though.
-            Authorizable a = userMgr.getAuthorizable("g1");
-            if (a.isGroup()) {
-                assertNotDeclaredMember((Group) a, invalidId, adminSession);
-            } else {
-                fail("'g1' was not imported as Group.");
-            }
-        } finally {
-            adminSession.refresh(false);
+        doImport(GROUPPATH, xml);
+        // no exception during import -> member must have been ignored though.
+        Authorizable a = userMgr.getAuthorizable("g1");
+        if (a.isGroup()) {
+            assertNotDeclaredMember((Group) a, invalidId, adminSession);
+        } else {
+            fail("'g1' was not imported as Group.");
         }
     }
 
@@ -137,4 +139,4 @@ public class UserImportIgnoreTest extend
             }
         }
     }
-}
\ No newline at end of file
+}



Mime
View raw message