jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1393961 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Date Thu, 04 Oct 2012 08:58:52 GMT
Author: angela
Date: Thu Oct  4 08:58:51 2012
New Revision: 1393961

URL: http://svn.apache.org/viewvc?rev=1393961&view=rev
Log:
 OAK-91 - Implement Authentication Support (WIP)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1393961&r1=1393960&r2=1393961&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Thu Oct  4 08:58:51 2012
@@ -28,8 +28,6 @@ import org.apache.jackrabbit.oak.api.Con
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.plugins.commit.AnnotatingConflictHandlerProvider;
 import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
-import org.apache.jackrabbit.oak.security.authentication.LoginContextProviderImpl;
-import org.apache.jackrabbit.oak.security.authorization.AccessControlProviderImpl;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.commit.ConflictHandlerProvider;
@@ -60,8 +58,7 @@ public class ContentRepositoryImpl imple
     private static final ConflictHandlerProvider DEFAULT_CONFLICT_HANDLER_PROVIDER =
             new AnnotatingConflictHandlerProvider();
 
-    private final LoginContextProvider loginContextProvider;
-    private final AccessControlProvider accProvider;
+    private final SecurityProvider securityProvider;
     private final QueryIndexProvider indexProvider;
     private final KernelNodeStore nodeStore;
 
@@ -75,8 +72,7 @@ public class ContentRepositoryImpl imple
     }
 
     public ContentRepositoryImpl(CommitHook hook) {
-        this(new MicroKernelImpl(), new SecurityProviderImpl(),
-                new CompositeQueryIndexProvider(), hook);
+        this(new MicroKernelImpl(), new CompositeQueryIndexProvider(), hook, null);
     }
 
     /**
@@ -95,9 +91,9 @@ public class ContentRepositoryImpl imple
     public ContentRepositoryImpl(
             MicroKernel microKernel, QueryIndexProvider indexProvider,
             ValidatorProvider validatorProvider) {
-        this(microKernel, new SecurityProviderImpl(), indexProvider,
-                new ValidatingHook(validatorProvider != null
-                    ? validatorProvider : DefaultValidatorProvider.INSTANCE));
+        this(microKernel, indexProvider,
+                new ValidatingHook(validatorProvider != null ? validatorProvider : DefaultValidatorProvider.INSTANCE),
+                null);
     }
 
     public ContentRepositoryImpl(
@@ -109,21 +105,6 @@ public class ContentRepositoryImpl imple
      * Creates an Oak repository instance based on the given, already
      * initialized components.
      *
-     * @param microKernel underlying kernel instance
-     * @param securityProvider security provider
-     * @param indexProvider index provider
-     * @param commitHook the commit hook
-     */
-    public ContentRepositoryImpl(
-            MicroKernel microKernel, SecurityProvider securityProvider,
-            QueryIndexProvider indexProvider, CommitHook commitHook) {
-        this(microKernel, indexProvider, commitHook, securityProvider);
-    }
-
-    /**
-     * Creates an Oak repository instance based on the given, already
-     * initialized components.
-     *
      * @param microKernel   underlying kernel instance
      * @param indexProvider index provider
      * @param commitHook    the commit hook
@@ -141,14 +122,10 @@ public class ContentRepositoryImpl imple
         this.indexProvider = indexProvider != null ? indexProvider
                 : new CompositeQueryIndexProvider();
 
-        if (securityProvider != null) {
-            this.loginContextProvider = securityProvider.getLoginContextProvider();
-            this.accProvider = securityProvider.getAccessControlProvider();
-        } else {
-            // use default implementation
-            this.loginContextProvider = new LoginContextProviderImpl();
-            this.accProvider = new AccessControlProviderImpl();
-        }
+        // TODO: in order not to having failing tests we use SecurityProviderImpl as default
+        //       - review if passing a security provider should be mandatory
+        //       - review if another default (not enforcing any security constraint) was
more appropriate.
+        this.securityProvider = (securityProvider == null) ? new SecurityProviderImpl() :
securityProvider;
     }
 
     @Nonnull
@@ -164,11 +141,12 @@ public class ContentRepositoryImpl imple
             throw new NoSuchWorkspaceException(workspaceName);
         }
 
-        OakLoginContext loginContext =
-                loginContextProvider.getLoginContext(credentials, workspaceName);
+        LoginContextProvider lcProvider = securityProvider.getLoginContextProvider();
+        OakLoginContext loginContext = lcProvider.getLoginContext(credentials, workspaceName);
         loginContext.login();
 
-        return new ContentSessionImpl(loginContext, accProvider, workspaceName,
+        AccessControlProvider acProvider = securityProvider.getAccessControlProvider();
+        return new ContentSessionImpl(loginContext, acProvider, workspaceName,
                 nodeStore, DEFAULT_CONFLICT_HANDLER_PROVIDER, indexProvider);
     }
 }



Mime
View raw message