jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1404643 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: ./ security/ security/privilege/ spi/security/ spi/security/privilege/
Date Thu, 01 Nov 2012 15:30:18 GMT
Author: angela
Date: Thu Nov  1 15:30:18 2012
New Revision: 1404643

URL: http://svn.apache.org/viewvc?rev=1404643&view=rev
Log:
OAK-50, OAK-51, OAK-90, OAK-91: simplify configuration... (WIP)

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/SecurityProviderImpl.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/SecurityProvider.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=1404643&r1=1404642&r2=1404643&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 Thu Nov
 1 15:30:18 2012
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.oak;
 
-import static com.google.common.base.Preconditions.checkNotNull;
-
 import java.util.List;
 import javax.annotation.Nonnull;
 import javax.jcr.NoSuchWorkspaceException;
@@ -42,11 +40,14 @@ import org.apache.jackrabbit.oak.spi.lif
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 /**
  * Builder class for constructing {@link ContentRepository} instances with
  * a set of specified plugin components. This class acts as a public facade
@@ -69,6 +70,7 @@ public class Oak {
 
     private List<ValidatorProvider> validatorProviders = Lists.newArrayList();
 
+    // TODO: review if we really want to have the OpenSecurityProvider as default.
     private SecurityProvider securityProvider = new OpenSecurityProvider();
 
     private ConflictHandler conflictHandler;
@@ -163,9 +165,9 @@ public class Oak {
     public Oak with(@Nonnull SecurityProvider securityProvider) {
         this.securityProvider = securityProvider;
         try {
-            validatorProviders.addAll(securityProvider.getAccessControlProvider().getValidatorProviders());
-            validatorProviders.addAll(securityProvider.getUserConfiguration().getValidatorProviders());
-            validatorProviders.addAll(securityProvider.getPrivilegeConfiguration().getValidatorProviders());
+            for (SecurityConfiguration sc : securityProvider.getSecurityConfigurations())
{
+                validatorProviders.addAll(sc.getValidatorProviders());
+            }
         } catch (UnsupportedOperationException e) {
             log.info(e.getMessage());
         }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java?rev=1404643&r1=1404642&r2=1404643&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
Thu Nov  1 15:30:18 2012
@@ -17,7 +17,9 @@
 package org.apache.jackrabbit.oak.security;
 
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import javax.annotation.Nonnull;
 import javax.jcr.Session;
 import javax.security.auth.login.Configuration;
@@ -71,6 +73,17 @@ public class SecurityProviderImpl implem
 
     @Nonnull
     @Override
+    public Iterable<SecurityConfiguration> getSecurityConfigurations() {
+        Set<SecurityConfiguration> scs = new HashSet<SecurityConfiguration>();
+        scs.add(getAccessControlProvider());
+        scs.add(getUserConfiguration());
+        scs.add(getPrincipalConfiguration());
+        scs.add(getPrivilegeConfiguration());
+        return scs;
+    }
+
+    @Nonnull
+    @Override
     public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider) {
         String appName = configuration.getConfigValue(PARAM_APP_NAME, DEFAULT_APP_NAME);
         Configuration loginConfig;

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=1404643&r1=1404642&r2=1404643&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
Thu Nov  1 15:30:18 2012
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.oak.security.privilege;
 
 import java.util.Collections;
-import java.util.Set;
+import java.util.List;
 import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
@@ -25,6 +25,7 @@ import org.apache.jackrabbit.oak.api.Con
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeManagerImpl;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeProvider;
@@ -32,7 +33,7 @@ import org.apache.jackrabbit.oak.spi.sec
 /**
  * PrivilegeConfigurationImpl... TODO
  */
-public class PrivilegeConfigurationImpl implements PrivilegeConfiguration {
+public class PrivilegeConfigurationImpl extends SecurityConfiguration.Default implements
PrivilegeConfiguration {
 
     @Override
     public PrivilegeProvider getPrivilegeProvider(ContentSession contentSession, Root root)
{
@@ -46,8 +47,8 @@ public class PrivilegeConfigurationImpl 
     }
 
     @Override
-    public Set<ValidatorProvider> getValidatorProviders() {
+    public List<ValidatorProvider> getValidatorProviders() {
         ValidatorProvider vp = new PrivilegeValidatorProvider();
-        return Collections.singleton(vp);
+        return Collections.singletonList(vp);
     }
 }
\ No newline at end of file

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=1404643&r1=1404642&r2=1404643&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
Thu Nov  1 15:30:18 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.spi.security;
 
+import java.util.Collections;
 import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.oak.api.Root;
@@ -37,6 +38,12 @@ public class OpenSecurityProvider implem
 
     @Nonnull
     @Override
+    public Iterable<SecurityConfiguration> getSecurityConfigurations() {
+        return Collections.<SecurityConfiguration>singletonList(getAccessControlProvider());
+    }
+
+    @Nonnull
+    @Override
     public LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider) {
         return new OpenLoginContextProvider();
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java?rev=1404643&r1=1404642&r2=1404643&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/SecurityProvider.java
Thu Nov  1 15:30:18 2012
@@ -33,6 +33,9 @@ import org.apache.jackrabbit.oak.spi.sta
  */
 public interface SecurityProvider {
 
+    @Nonnull
+    Iterable<SecurityConfiguration> getSecurityConfigurations();
+
     // TODO review again
     @Nonnull
     LoginContextProvider getLoginContextProvider(NodeStore nodeStore, QueryIndexProvider
indexProvider);

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=1404643&r1=1404642&r2=1404643&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
Thu Nov  1 15:30:18 2012
@@ -16,26 +16,22 @@
  */
 package org.apache.jackrabbit.oak.spi.security.privilege;
 
-import java.util.Set;
 import javax.annotation.Nonnull;
 
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
-import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 
 /**
  * PrivilegeConfiguration... TODO
  */
-public interface PrivilegeConfiguration {
+public interface PrivilegeConfiguration extends SecurityConfiguration {
 
     @Nonnull
     PrivilegeProvider getPrivilegeProvider(ContentSession contentSession, Root root);
 
     @Nonnull
     PrivilegeManager getPrivilegeManager(ContentSession contentSession, Root root, NamePathMapper
namePathMapper);
-
-    @Nonnull
-    Set<ValidatorProvider> getValidatorProviders();
 }
\ No newline at end of file



Mime
View raw message