jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1375079 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/ oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/ oak-core/src/mai...
Date Mon, 20 Aug 2012 15:54:46 GMT
Author: angela
Date: Mon Aug 20 15:54:45 2012
New Revision: 1375079

URL: http://svn.apache.org/viewvc?rev=1375079&view=rev
Log:
OAK-50 : Implement User Management (WIP)

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConfig.java
  (contents, props changed)
      - copied, changed from r1375014, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserManagerConfig.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserManagerConfig.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.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/UserValidatorProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AuthorizableAction.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1375079&r1=1375078&r2=1375079&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Mon Aug 20 15:54:45 2012
@@ -36,7 +36,7 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlContext;
 import org.apache.jackrabbit.oak.spi.security.authorization.CompiledPermissions;
-import org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig;
+import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
@@ -255,7 +255,7 @@ public class RootImpl implements Root {
         providers.add(accessControlContext.getAccessControlValdatorProvider(valueFactory));
         // TODO the following v-providers could be initialized at ContentRepo level
         // FIXME: use proper configuration
-        providers.add(new UserValidatorProvider(valueFactory, new UserManagerConfig("admin")));
+        providers.add(new UserValidatorProvider(valueFactory, new UserConfig("admin")));
         providers.add(new PrivilegeValidatorProvider(valueFactory));
 
         return new ValidatingEditor(new CompositeValidatorProvider(providers));

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java?rev=1375079&r1=1375078&r2=1375079&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserProviderImpl.java
Mon Aug 20 15:54:45 2012
@@ -40,6 +40,7 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.CoreValue;
+import org.apache.jackrabbit.oak.api.CoreValueFactory;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Result;
 import org.apache.jackrabbit.oak.api.Root;
@@ -50,7 +51,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.spi.security.principal.TreeBasedPrincipal;
 import org.apache.jackrabbit.oak.spi.security.user.MembershipProvider;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig;
+import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
 import org.apache.jackrabbit.oak.spi.security.user.UserProvider;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.apache.jackrabbit.util.Text;
@@ -68,10 +69,10 @@ import org.slf4j.LoggerFactory;
  * authorizable ID with the following behavior:
  * <ul>
  * <li>Users are created below /rep:security/rep:authorizables/rep:users or
- * the path configured in the {@link org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig#PARAM_USER_PATH}
+ * the path configured in the {@link org.apache.jackrabbit.oak.spi.security.user.UserConfig#PARAM_USER_PATH}
  * respectively.</li>
  * <li>Groups are created below /rep:security/rep:authorizables/rep:groups or
- * the path configured in the {@link org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig#PARAM_GROUP_PATH}
+ * the path configured in the {@link org.apache.jackrabbit.oak.spi.security.user.UserConfig#PARAM_GROUP_PATH}
  * respectively.</li>
  * <li>Below each category authorizables are created within a human readable
  * structure based on the defined intermediate path or some internal logic
@@ -119,13 +120,13 @@ import org.slf4j.LoggerFactory;
  *
  * <h3>Configuration Options</h3>
  * <ul>
- *     <li>{@link org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig#PARAM_USER_PATH}:
Underneath this structure
+ *     <li>{@link org.apache.jackrabbit.oak.spi.security.user.UserConfig#PARAM_USER_PATH}:
Underneath this structure
  *     all user nodes are created. Default value is
  *     "/rep:security/rep:authorizables/rep:users"</li>
- *     <li>{@link org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig#PARAM_GROUP_PATH}:
Underneath this structure
+ *     <li>{@link org.apache.jackrabbit.oak.spi.security.user.UserConfig#PARAM_GROUP_PATH}:
Underneath this structure
  *     all group nodes are created. Default value is
  *     "/rep:security/rep:authorizables/rep:groups"</li>
- *     <li>{@link org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig#PARAM_DEFAULT_DEPTH}:
A positive {@code integer}
+ *     <li>{@link org.apache.jackrabbit.oak.spi.security.user.UserConfig#PARAM_DEFAULT_DEPTH}:
A positive {@code integer}
  *     greater than zero defining the depth of the default structure that is
  *     always created. Default value: 2</li>
  * </ul>
@@ -161,7 +162,8 @@ public class UserProviderImpl implements
     private static final String DELIMITER = "/";
     private static final int DEFAULT_DEPTH = 2;
 
-    private final ContentSession contentSession;
+    private final CoreValueFactory valueFactory;
+    private final SessionQueryEngine queryEngine;
     private final Root root;
     private final IdentifierManager identifierManager;
 
@@ -172,22 +174,27 @@ public class UserProviderImpl implements
     private final String groupPath;
     private final String userPath;
 
-    public UserProviderImpl(ContentSession contentSession, Root root, UserManagerConfig config)
{
-        this.contentSession = contentSession;
+    public UserProviderImpl(ContentSession contentSession, Root root, UserConfig config)
{
+        this(contentSession.getCoreValueFactory(), contentSession.getQueryEngine(), root,
config);
+    }
+
+    public UserProviderImpl(CoreValueFactory valueFactory, SessionQueryEngine queryEngine,
Root root, UserConfig config) {
+        this.valueFactory = valueFactory;
+        this.queryEngine = queryEngine;
         this.root = root;
-        this.identifierManager = new IdentifierManager(contentSession.getQueryEngine(), root);
+        this.identifierManager = new IdentifierManager(queryEngine, root);
 
-        defaultDepth = config.getConfigValue(UserManagerConfig.PARAM_DEFAULT_DEPTH, DEFAULT_DEPTH);
-        int splitValue = config.getConfigValue(UserManagerConfig.PARAM_GROUP_MEMBERSHIP_SPLIT_SIZE,
0);
+        defaultDepth = config.getConfigValue(UserConfig.PARAM_DEFAULT_DEPTH, DEFAULT_DEPTH);
+        int splitValue = config.getConfigValue(UserConfig.PARAM_GROUP_MEMBERSHIP_SPLIT_SIZE,
0);
         if (splitValue != 0 && splitValue < 4) {
-            log.warn("Invalid value {} for {}. Expected integer >= 4 or 0", splitValue,
UserManagerConfig.PARAM_GROUP_MEMBERSHIP_SPLIT_SIZE);
+            log.warn("Invalid value {} for {}. Expected integer >= 4 or 0", splitValue,
UserConfig.PARAM_GROUP_MEMBERSHIP_SPLIT_SIZE);
             splitValue = 0;
         }
         this.splitSize = splitValue;
         this.adminId = config.getAdminId();
 
-        groupPath = config.getConfigValue(UserManagerConfig.PARAM_GROUP_PATH, DEFAULT_GROUP_PATH);
-        userPath = config.getConfigValue(UserManagerConfig.PARAM_USER_PATH, DEFAULT_USER_PATH);
+        groupPath = config.getConfigValue(UserConfig.PARAM_GROUP_PATH, DEFAULT_GROUP_PATH);
+        userPath = config.getConfigValue(UserConfig.PARAM_USER_PATH, DEFAULT_USER_PATH);
     }
 
     //-------------------------------------------------------< UserProvider >---
@@ -240,12 +247,11 @@ public class UserProviderImpl implements
             // NOTE: in contrast to JR2 the extra shortcut for ID==principalName
             // can be omitted as principals names are stored in user defined
             // index as well.
-            SessionQueryEngine queryEngine = contentSession.getQueryEngine();
             try {
-                CoreValue bindValue = contentSession.getCoreValueFactory().createValue(principal.getName());
+                CoreValue bindValue = valueFactory.createValue(principal.getName());
                 Map<String, CoreValue> bindings = Collections.singletonMap("principalName",
bindValue);
                 String stmt = "SELECT * FROM [rep:Authorizable] WHERE [rep:principalName]
= $principalName";
-                Result result = contentSession.getQueryEngine().executeQuery(stmt,
+                Result result = queryEngine.executeQuery(stmt,
                         Query.JCR_SQL2, 1, 0,
                         Collections.singletonMap("principalName", bindValue),
                         new NamePathMapper.Default());
@@ -383,7 +389,7 @@ public class UserProviderImpl implements
     @Override
     public boolean addMember(Tree groupTree, Tree newMemberTree) {
         if (useMemberNode(groupTree)) {
-            NodeUtil groupNode = new NodeUtil(groupTree, contentSession);
+            NodeUtil groupNode = new NodeUtil(groupTree, valueFactory);
             NodeUtil membersNode = groupNode.getOrAddChild(REP_MEMBERS, NT_REP_MEMBERS);
 
             //FIXME: replace usage of PropertySequence with oak-compatible utility
@@ -513,12 +519,12 @@ public class UserProviderImpl implements
         NodeUtil folder;
         Tree authTree = root.getTree(authRoot);
         if (authTree == null) {
-            folder = new NodeUtil(root.getTree("/"), contentSession);
+            folder = new NodeUtil(root.getTree("/"), valueFactory);
             for (String name : Text.explode(authRoot, '/', false)) {
                 folder = folder.getOrAddChild(name, NT_REP_AUTHORIZABLE_FOLDER);
             }
         }  else {
-            folder = new NodeUtil(authTree, contentSession);
+            folder = new NodeUtil(authTree, valueFactory);
         }
         String folderPath = getFolderPath(authorizableId, intermediatePath);
         String[] segmts = Text.explode(folderPath, '/', false);
@@ -576,7 +582,7 @@ public class UserProviderImpl implements
     //-----------------------------------------< private MembershipProvider >---
 
     private CoreValue createCoreValue(Tree authorizableTree) {
-        return contentSession.getCoreValueFactory().createValue(getContentID(authorizableTree),
PropertyType.WEAKREFERENCE);
+        return valueFactory.createValue(getContentID(authorizableTree), PropertyType.WEAKREFERENCE);
     }
 
     private boolean useMemberNode(Tree groupTree) {

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=1375079&r1=1375078&r2=1375079&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
Mon Aug 20 15:54:45 2012
@@ -26,7 +26,7 @@ import org.apache.jackrabbit.oak.api.Pro
 import org.apache.jackrabbit.oak.spi.commit.UniquePropertyValidator;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig;
+import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 import org.apache.jackrabbit.util.Text;
@@ -34,10 +34,11 @@ import org.apache.jackrabbit.util.Text;
 /**
  * UserValidator... TODO
  */
-class UserValidator extends UniquePropertyValidator {
+class UserValidator extends UniquePropertyValidator implements UserConstants {
 
     private final static Set<String> PROPERTY_NAMES = ImmutableSet.copyOf(new String[]
{
-            UserConstants.REP_AUTHORIZABLE_ID, UserConstants.REP_PRINCIPAL_NAME});
+            REP_AUTHORIZABLE_ID, REP_PRINCIPAL_NAME
+    });
 
     private final UserValidatorProvider provider;
 
@@ -67,6 +68,11 @@ class UserValidator extends UniqueProper
     @Override
     public void propertyChanged(PropertyState before, PropertyState after) throws CommitFailedException
{
         super.propertyChanged(before, after);
+
+        String name = before.getName();
+        if (REP_PRINCIPAL_NAME.equals(name) || REP_AUTHORIZABLE_ID.equals(name)) {
+            throw new CommitFailedException("Authorizable property " + name + " may not be
altered after user/group creation.");
+        }
     }
 
     @Override
@@ -78,10 +84,10 @@ class UserValidator extends UniqueProper
     public Validator childNodeAdded(String name, NodeState after) throws CommitFailedException
{
         NodeUtil node = parentAfter.getChild(name);
         String authRoot = null;
-        if (node.hasPrimaryNodeTypeName(UserConstants.NT_REP_USER)) {
-            authRoot = provider.getConfig().getConfigValue(UserManagerConfig.PARAM_USER_PATH,
UserConstants.DEFAULT_USER_PATH);
+        if (node.hasPrimaryNodeTypeName(NT_REP_USER)) {
+            authRoot = provider.getConfig().getConfigValue(UserConfig.PARAM_USER_PATH, DEFAULT_USER_PATH);
         } else if (node.hasPrimaryNodeTypeName(UserConstants.NT_REP_GROUP)) {
-            authRoot = provider.getConfig().getConfigValue(UserManagerConfig.PARAM_GROUP_PATH,
UserConstants.DEFAULT_GROUP_PATH);
+            authRoot = provider.getConfig().getConfigValue(UserConfig.PARAM_GROUP_PATH, DEFAULT_GROUP_PATH);
         }
         if (authRoot != null) {
             assertHierarchy(node, authRoot);
@@ -119,7 +125,7 @@ class UserValidator extends UniqueProper
 
         NodeUtil parent = userNode.getParent();
         while (!parent.getTree().isRoot()) {
-            if (!parent.hasPrimaryNodeTypeName(UserConstants.NT_REP_AUTHORIZABLE_FOLDER))
{
+            if (!parent.hasPrimaryNodeTypeName(NT_REP_AUTHORIZABLE_FOLDER)) {
                 String msg = "Cannot create user/group: Intermediate folders must be of type
rep:AuthorizableFolder.";
                 Exception e = new ConstraintViolationException(msg);
                 throw new CommitFailedException(e);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java?rev=1375079&r1=1375078&r2=1375079&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserValidatorProvider.java
Mon Aug 20 15:54:45 2012
@@ -23,7 +23,7 @@ import org.apache.jackrabbit.oak.core.Re
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
-import org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig;
+import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.util.NodeUtil;
 
@@ -33,9 +33,9 @@ import org.apache.jackrabbit.oak.util.No
 public class UserValidatorProvider implements ValidatorProvider {
 
     private final CoreValueFactory valueFactory;
-    private final UserManagerConfig config;
+    private final UserConfig config;
 
-    public UserValidatorProvider(CoreValueFactory valueFactory, UserManagerConfig config)
{
+    public UserValidatorProvider(CoreValueFactory valueFactory, UserConfig config) {
         assert valueFactory != null;
         assert config != null;
 
@@ -55,7 +55,7 @@ public class UserValidatorProvider imple
 
     //-----------------------------------------------------------< internal >---
     @Nonnull
-    UserManagerConfig getConfig() {
+    UserConfig getConfig() {
         return config;
     }
 

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConfig.java
(from r1375014, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserManagerConfig.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConfig.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConfig.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserManagerConfig.java&r1=1375014&r2=1375079&rev=1375079&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserManagerConfig.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/UserConfig.java
Mon Aug 20 15:54:45 2012
@@ -16,23 +16,23 @@
  */
 package org.apache.jackrabbit.oak.spi.security.user;
 
-import org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableAction;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.util.Collections;
 import java.util.Map;
 import java.util.Set;
 import javax.annotation.Nonnull;
 
+import org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableAction;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * UserManagerConfig provides utilities to retrieve configuration options
  * related to user management. In addition it defines some constants that
  * have been used in Jackrabbit 2.0 default user management implementation.
  */
-public class UserManagerConfig {
+public class UserConfig {
 
-    private static final Logger log = LoggerFactory.getLogger(UserManagerConfig.class);
+    private static final Logger log = LoggerFactory.getLogger(UserConfig.class);
 
     /**
      * Configuration option to define the path underneath which user nodes
@@ -87,11 +87,11 @@ public class UserManagerConfig {
     private final Map<String, Object> options;
     private final Set<AuthorizableAction> actions;
 
-    public UserManagerConfig(String adminId) {
+    public UserConfig(String adminId) {
         this(adminId, null, null);
     }
 
-    public UserManagerConfig(String adminId, Map<String, Object> options, Set<AuthorizableAction>
actions) {
+    public UserConfig(String adminId, Map<String, Object> options, Set<AuthorizableAction>
actions) {
         assert adminId != null;
 
         this.adminId = adminId;

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

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AuthorizableAction.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AuthorizableAction.java?rev=1375079&r1=1375078&r2=1375079&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AuthorizableAction.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/user/action/AuthorizableAction.java
Mon Aug 20 15:54:45 2012
@@ -16,13 +16,13 @@
  */
 package org.apache.jackrabbit.oak.spi.security.user.action;
 
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
 import org.apache.jackrabbit.api.security.user.Authorizable;
 import org.apache.jackrabbit.api.security.user.Group;
 import org.apache.jackrabbit.api.security.user.User;
 
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-
 /**
  * The {@code AuthorizableAction} interface provide an implementation
  * specific way to execute additional validation or write tasks upon
@@ -34,7 +34,7 @@ import javax.jcr.Session;
  * <li>{@link #onPasswordChange(org.apache.jackrabbit.api.security.user.User, String,
javax.jcr.Session) User password modification}.</li>
  * </ul>
  *
- * @see org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig
+ * @see org.apache.jackrabbit.oak.spi.security.user.UserConfig
  */
 public interface AuthorizableAction {
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java?rev=1375079&r1=1375078&r2=1375079&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/NodeUtil.java
Mon Aug 20 15:54:45 2012
@@ -57,12 +57,16 @@ public class NodeUtil {
         this.tree = tree;
     }
 
-    public NodeUtil(Tree tree, ContentSession contentSession) {
+    public NodeUtil(Tree tree, CoreValueFactory factory) {
         this.tree = tree;
-        this.factory = contentSession.getCoreValueFactory();
+        this.factory = factory;
         this.mapper = NamePathMapper.DEFAULT;
     }
 
+    public NodeUtil(Tree tree, ContentSession contentSession) {
+        this(tree, contentSession.getCoreValueFactory());
+    }
+
     @Nonnull
     public Tree getTree() {
         return tree;

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java?rev=1375079&r1=1375078&r2=1375079&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerImpl.java
Mon Aug 20 15:54:45 2012
@@ -47,7 +47,7 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.user.MembershipProvider;
 import org.apache.jackrabbit.oak.spi.security.user.PasswordUtility;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
-import org.apache.jackrabbit.oak.spi.security.user.UserManagerConfig;
+import org.apache.jackrabbit.oak.spi.security.user.UserConfig;
 import org.apache.jackrabbit.oak.spi.security.user.UserProvider;
 import org.apache.jackrabbit.oak.spi.security.user.action.AuthorizableAction;
 import org.slf4j.Logger;
@@ -61,13 +61,13 @@ public class UserManagerImpl implements 
     private static final Logger log = LoggerFactory.getLogger(UserManagerImpl.class);
 
     private final SessionDelegate sessionDelegate;
-    private final UserManagerConfig config;
+    private final UserConfig config;
     private final UserProviderImpl userProvider;
     private final NodeTreeUtil util;
 
-    public UserManagerImpl(SessionDelegate sessionDelegate, Root root, UserManagerConfig
config) {
+    public UserManagerImpl(SessionDelegate sessionDelegate, Root root, UserConfig config)
{
         this.sessionDelegate = sessionDelegate;
-        this.config = (config == null) ? new UserManagerConfig("admin") : config;
+        this.config = (config == null) ? new UserConfig("admin") : config;
         userProvider = new UserProviderImpl(sessionDelegate.getContentSession(), root, this.config);
 
         // FIXME: remove again. only tmp workaround
@@ -286,9 +286,9 @@ public class UserManagerImpl implements 
         String pwHash;
         if (forceHash || PasswordUtility.isPlainTextPassword(password)) {
             try {
-                String algorithm = config.getConfigValue(UserManagerConfig.PARAM_PASSWORD_HASH_ALGORITHM,
PasswordUtility.DEFAULT_ALGORITHM);
-                int iterations = config.getConfigValue(UserManagerConfig.PARAM_PASSWORD_HASH_ITERATIONS,
PasswordUtility.DEFAULT_ITERATIONS);
-                int saltSize = config.getConfigValue(UserManagerConfig.PARAM_PASSWORD_SALT_SIZE,
PasswordUtility.DEFAULT_SALT_SIZE);
+                String algorithm = config.getConfigValue(UserConfig.PARAM_PASSWORD_HASH_ALGORITHM,
PasswordUtility.DEFAULT_ALGORITHM);
+                int iterations = config.getConfigValue(UserConfig.PARAM_PASSWORD_HASH_ITERATIONS,
PasswordUtility.DEFAULT_ITERATIONS);
+                int saltSize = config.getConfigValue(UserConfig.PARAM_PASSWORD_SALT_SIZE,
PasswordUtility.DEFAULT_SALT_SIZE);
                 pwHash = PasswordUtility.buildPasswordHash(password, algorithm, saltSize,
iterations);
             } catch (NoSuchAlgorithmException e) {
                 throw new RepositoryException(e);



Mime
View raw message