jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1448230 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: ./ security/privilege/ spi/security/ spi/security/privilege/
Date Wed, 20 Feb 2013 15:29:36 GMT
Author: angela
Date: Wed Feb 20 15:29:35 2013
New Revision: 1448230

URL: http://svn.apache.org/r1448230
Log:
OAK-17: simplify security configuration

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeConfiguration.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java?rev=1448230&r1=1448229&r2=1448230&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java Wed Feb
20 15:29:35 2013
@@ -209,9 +209,7 @@ public class Oak {
     @Nonnull
     public Oak with(@Nonnull SecurityProvider securityProvider) {
         this.securityProvider = securityProvider;
-        for (SecurityConfiguration sc : securityProvider.getSecurityConfigurations()) {
-            initializers.add(sc.getRepositoryInitializer());
-        }
+        initializers.add(securityProvider.getPrivilegeConfiguration().getPrivilegeInitializer());
         return this;
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java?rev=1448230&r1=1448229&r2=1448230&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeConfigurationImpl.java
Wed Feb 20 15:29:35 2013
@@ -41,13 +41,13 @@ public class PrivilegeConfigurationImpl 
         return new PrivilegeManagerImpl(root, namePathMapper);
     }
 
-    //----------------------------------------------< SecurityConfiguration >---
     @Nonnull
     @Override
-    public RepositoryInitializer getRepositoryInitializer() {
+    public RepositoryInitializer getPrivilegeInitializer() {
         return new PrivilegeInitializer();
     }
 
+    //----------------------------------------------< SecurityConfiguration >---
     @Nonnull
     @Override
     public CommitHookProvider getSecurityHooks() {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java?rev=1448230&r1=1448229&r2=1448230&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/OpenSecurityProvider.java
Wed Feb 20 15:29:35 2013
@@ -16,10 +16,15 @@
  */
 package org.apache.jackrabbit.oak.spi.security;
 
+import java.util.Collections;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
-import com.google.common.collect.ImmutableList;
+import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
+import org.apache.jackrabbit.oak.api.Root;
+import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+import org.apache.jackrabbit.oak.spi.lifecycle.CompositeInitializer;
+import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authentication.OpenAuthenticationConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authorization.AccessControlConfiguration;
@@ -42,7 +47,7 @@ public class OpenSecurityProvider implem
     @Nonnull
     @Override
     public Iterable<SecurityConfiguration> getSecurityConfigurations() {
-        return ImmutableList.of(getAccessControlConfiguration(), getAuthenticationConfiguration());
+        return Collections.emptyList();
     }
 
     @Nonnull
@@ -60,7 +65,7 @@ public class OpenSecurityProvider implem
     @Nonnull
     @Override
     public PrivilegeConfiguration getPrivilegeConfiguration() {
-        throw new UnsupportedOperationException();
+        return new OpenPrivilegeConfiguration();
     }
 
     @Nonnull
@@ -74,4 +79,18 @@ public class OpenSecurityProvider implem
     public PrincipalConfiguration getPrincipalConfiguration() {
         throw new UnsupportedOperationException();
     }
+
+    private static final class OpenPrivilegeConfiguration extends SecurityConfiguration.Default
implements PrivilegeConfiguration {
+        @Nonnull
+        @Override
+        public PrivilegeManager getPrivilegeManager(Root root, NamePathMapper namePathMapper)
{
+            throw new UnsupportedOperationException();
+        }
+
+        @Nonnull
+        @Override
+        public RepositoryInitializer getPrivilegeInitializer() {
+            return new CompositeInitializer();
+        }
+    }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java?rev=1448230&r1=1448229&r2=1448230&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityConfiguration.java
Wed Feb 20 15:29:35 2013
@@ -25,8 +25,6 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.plugins.index.IndexHookProvider;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitHookProvider;
-import org.apache.jackrabbit.oak.spi.lifecycle.CompositeInitializer;
-import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.lifecycle.WorkspaceInitializer;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -41,9 +39,6 @@ public interface SecurityConfiguration {
     ConfigurationParameters getConfigurationParameters();
 
     @Nonnull
-    RepositoryInitializer getRepositoryInitializer();
-
-    @Nonnull
     WorkspaceInitializer getWorkspaceInitializer();
 
     @Nonnull
@@ -71,12 +66,6 @@ public interface SecurityConfiguration {
 
         @Nonnull
         @Override
-        public RepositoryInitializer getRepositoryInitializer() {
-            return new CompositeInitializer(Collections.<RepositoryInitializer>emptyList());
-        }
-
-        @Nonnull
-        @Override
         public WorkspaceInitializer getWorkspaceInitializer() {
             return new WorkspaceInitializer() {
                 @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeConfiguration.java?rev=1448230&r1=1448229&r2=1448230&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeConfiguration.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/privilege/PrivilegeConfiguration.java
Wed Feb 20 15:29:35 2013
@@ -21,6 +21,7 @@ import javax.annotation.Nonnull;
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 
 /**
@@ -37,4 +38,13 @@ public interface PrivilegeConfiguration 
      */
     @Nonnull
     PrivilegeManager getPrivilegeManager(Root root, NamePathMapper namePathMapper);
+
+    /**
+     * Returns the privilege specific repository initializer.
+     *
+     * @return An instance of {@code RepositoryInitializer} that initializes
+     *         the built-in privileges.
+     */
+    @Nonnull
+    RepositoryInitializer getPrivilegeInitializer();
 }



Mime
View raw message