jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1447702 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: core/RootImpl.java security/authentication/SystemSubject.java spi/security/authentication/callback/RepositoryCallback.java
Date Tue, 19 Feb 2013 13:04:38 GMT
Author: angela
Date: Tue Feb 19 13:04:37 2013
New Revision: 1447702

URL: http://svn.apache.org/r1447702
Log:
OAK-91 : Implement Authentication Support (remove duplicated code)

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/SystemSubject.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/spi/security/authentication/callback/RepositoryCallback.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=1447702&r1=1447701&r2=1447702&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
Tue Feb 19 13:04:37 2013
@@ -23,7 +23,6 @@ import java.io.InputStream;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import javax.annotation.Nonnull;
 import javax.security.auth.Subject;
@@ -39,6 +38,7 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.index.diffindex.UUIDDiffIndexProviderWrapper;
 import org.apache.jackrabbit.oak.query.QueryEngineImpl;
+import org.apache.jackrabbit.oak.security.authentication.SystemSubject;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.commit.EmptyHook;
@@ -49,7 +49,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.authorization.PermissionProvider;
-import org.apache.jackrabbit.oak.spi.security.principal.SystemPrincipal;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStateDiff;
@@ -138,9 +137,9 @@ public class RootImpl implements Root {
         // FIXME: define proper default or pass workspace name with the constructor
         this.workspaceName = Oak.DEFAULT_WORKSPACE_NAME;
         this.hook = EmptyHook.INSTANCE;
-        this.subject = new Subject(true, Collections.singleton(SystemPrincipal.INSTANCE),
Collections.<Object>emptySet(), Collections.<Object>emptySet());
+        this.subject = SystemSubject.INSTANCE;
         this.securityProvider = new OpenSecurityProvider();
-        this.indexProvider = indexProvider;
+        this.indexProvider = new CompositeQueryIndexProvider();
         refresh();
     }
 

Added: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/SystemSubject.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/SystemSubject.java?rev=1447702&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/SystemSubject.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/SystemSubject.java
Tue Feb 19 13:04:37 2013
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.oak.security.authentication;
+
+import java.util.Collections;
+import javax.security.auth.Subject;
+
+import org.apache.jackrabbit.oak.spi.security.principal.SystemPrincipal;
+
+/**
+ * SystemSubject... TODO
+ */
+public final class SystemSubject {
+
+    public static final Subject INSTANCE = createSystemSubject();
+
+    private static Subject createSystemSubject() {
+        return new Subject(true, Collections.singleton(SystemPrincipal.INSTANCE), Collections.<Object>emptySet(),
Collections.<Object>emptySet());
+    }
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java?rev=1447702&r1=1447701&r2=1447702&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/callback/RepositoryCallback.java
Tue Feb 19 13:04:37 2013
@@ -16,17 +16,15 @@
  */
 package org.apache.jackrabbit.oak.spi.security.authentication.callback;
 
-import java.util.Collections;
 import javax.annotation.CheckForNull;
-import javax.security.auth.Subject;
 import javax.security.auth.callback.Callback;
 
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.core.RootImpl;
+import org.apache.jackrabbit.oak.security.authentication.SystemSubject;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
-import org.apache.jackrabbit.oak.spi.security.principal.SystemPrincipal;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 
 /**
@@ -51,8 +49,7 @@ public class RepositoryCallback implemen
     @CheckForNull
     public Root getRoot() {
         if (nodeStore != null) {
-            Subject subject = new Subject(true, Collections.singleton(SystemPrincipal.INSTANCE),
Collections.<Object>emptySet(), Collections.<Object>emptySet());
-            return new RootImpl(nodeStore, commitHook, workspaceName, subject, securityProvider,
indexProvider);
+            return new RootImpl(nodeStore, commitHook, workspaceName, SystemSubject.INSTANCE,
securityProvider, indexProvider);
         }
         return null;
     }



Mime
View raw message