jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1398707 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: security/ security/authentication/ security/authentication/user/ spi/security/authentication/
Date Tue, 16 Oct 2012 09:35:28 GMT
Author: angela
Date: Tue Oct 16 09:35:27 2012
New Revision: 1398707

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

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
      - copied, changed from r1398676, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java
      - copied, changed from r1398687, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/UserAuthentication.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/UserAuthentication.java
Modified:
    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/authentication/AuthInfoImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/GuestLoginModule.java

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=1398707&r1=1398706&r2=1398707&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
Tue Oct 16 09:35:27 2012
@@ -26,7 +26,7 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.security.authentication.LoginContextProviderImpl;
-import org.apache.jackrabbit.oak.security.authentication.LoginModuleImpl;
+import org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl;
 import org.apache.jackrabbit.oak.security.authentication.token.TokenProviderImpl;
 import org.apache.jackrabbit.oak.security.authorization.AccessControlProviderImpl;
 import org.apache.jackrabbit.oak.security.principal.PrincipalManagerImpl;
@@ -50,18 +50,32 @@ public class SecurityProviderImpl implem
 
     private static final Logger log = LoggerFactory.getLogger(SecurityProviderImpl.class);
 
+    public static final String PARAM_APP_NAME = "org.apache.jackrabbit.oak.auth.appName";
+    private static final String DEFAULT_APP_NAME = "jackrabbit.oak";
+
+    private final ConfigurationParameters configuration;
+
+    public SecurityProviderImpl() {
+        this(new ConfigurationParameters());
+    }
+
+    public SecurityProviderImpl(ConfigurationParameters configuration) {
+        this.configuration = configuration;
+    }
+
     @Nonnull
     @Override
     public LoginContextProvider getLoginContextProvider(NodeStore nodeStore) {
-        Configuration configuration;
+        String appName = configuration.getConfigValue(PARAM_APP_NAME, DEFAULT_APP_NAME);
+        Configuration loginConfig;
         try {
-            configuration = Configuration.getConfiguration();
+            loginConfig = Configuration.getConfiguration();
         } catch (SecurityException e) {
             log.warn("Failed to read login configuration: using default.", e);
-            configuration = new OakConfiguration();
-            Configuration.setConfiguration(configuration);
+            loginConfig = new OakConfiguration();
+            Configuration.setConfiguration(loginConfig);
         }
-        return new LoginContextProviderImpl(configuration, nodeStore, this);
+        return new LoginContextProviderImpl(appName, loginConfig, nodeStore, this);
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthInfoImpl.java?rev=1398707&r1=1398706&r2=1398707&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthInfoImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthInfoImpl.java
Tue Oct 16 09:35:27 2012
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
 import org.apache.jackrabbit.oak.api.AuthInfo;
 
 /**
- * AuthInfoImpl... TODO
+ * Default implementation of the AuthInfo interface.
  */
 public class AuthInfoImpl implements AuthInfo {
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java?rev=1398707&r1=1398706&r2=1398707&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginContextProviderImpl.java
Tue Oct 16 09:35:27 2012
@@ -33,21 +33,21 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * LoginContextProviderImpl...  TODO
+ * {@code LoginContextProvider}
  */
 public class LoginContextProviderImpl implements LoginContextProvider {
 
     private static final Logger log = LoggerFactory.getLogger(LoginContextProviderImpl.class);
 
-    private static final String APP_NAME = "jackrabbit.oak";
-
+    private final String appName;
     private final Configuration configuration;
     private final NodeStore nodeStore;
     private final SecurityProvider securityProvider;
 
-    public LoginContextProviderImpl(Configuration configuration,
+    public LoginContextProviderImpl(String appName, Configuration configuration,
                                     NodeStore nodeStore,
                                     SecurityProvider securityProvider) {
+        this.appName = appName;
         this.configuration = configuration;
         this.nodeStore = nodeStore;
         this.securityProvider = securityProvider;
@@ -57,12 +57,10 @@ public class LoginContextProviderImpl im
     @Nonnull
     public LoginContext getLoginContext(Credentials credentials, String workspaceName)
             throws LoginException {
-        // TODO: add proper implementation
-        // TODO  - authentication against configurable spi-authentication
         // TODO  - validation of workspace name (including access rights for the given 'user')
         Subject subject = getSubject();
         CallbackHandler handler = getCallbackHandler(credentials, workspaceName);
-        return new JaasLoginContext(APP_NAME, subject, handler, configuration);
+        return new JaasLoginContext(appName, subject, handler, configuration);
     }
 
     //------------------------------------------------------------< private >---

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
(from r1398676, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java&r1=1398676&r2=1398707&rev=1398707&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/LoginModuleImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/LoginModuleImpl.java
Tue Oct 16 09:35:27 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.security.authentication;
+package org.apache.jackrabbit.oak.security.authentication.user;
 
 import java.io.IOException;
 import java.security.Principal;
@@ -33,6 +33,7 @@ import javax.security.auth.callback.Unsu
 import javax.security.auth.login.LoginException;
 
 import org.apache.jackrabbit.oak.api.AuthInfo;
+import org.apache.jackrabbit.oak.security.authentication.AuthInfoImpl;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.AbstractLoginModule;
 import org.apache.jackrabbit.oak.spi.security.authentication.Authentication;

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java
(from r1398687, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/UserAuthentication.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/UserAuthentication.java&r1=1398687&r2=1398707&rev=1398707&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/UserAuthentication.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/user/UserAuthentication.java
Tue Oct 16 09:35:27 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.oak.security.authentication;
+package org.apache.jackrabbit.oak.security.authentication.user;
 
 import java.util.Collections;
 import javax.jcr.Credentials;
@@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory;
  * will return {@code false} indicating that this implementation is not able
  * to verify their validity.
  */
-public class UserAuthentication implements Authentication {
+class UserAuthentication implements Authentication {
 
     private static final Logger log = LoggerFactory.getLogger(UserAuthentication.class);
 
@@ -64,7 +64,7 @@ public class UserAuthentication implemen
     private final UserProvider userProvider;
     private final PrincipalProvider principalProvider;
 
-    public UserAuthentication(String userId, UserProvider userProvider, PrincipalProvider
principalProvider) {
+    UserAuthentication(String userId, UserProvider userProvider, PrincipalProvider principalProvider)
{
         this.userId = userId;
         this.userProvider = userProvider;
         this.principalProvider = principalProvider;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/GuestLoginModule.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/GuestLoginModule.java?rev=1398707&r1=1398706&r2=1398707&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/GuestLoginModule.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/GuestLoginModule.java
Tue Oct 16 09:35:27 2012
@@ -64,7 +64,7 @@ import org.slf4j.LoggerFactory;
  *
  *    jackrabbit.oak {
  *            org.apache.jackrabbit.oak.spi.security.authentication.GuestLoginModule  optional;
- *            org.apache.jackrabbit.oak.security.authentication.LoginModuleImpl required;
+ *            org.apache.jackrabbit.oak.security.authentication.user.LoginModuleImpl required;
  *    };
  *
  * </pre>



Mime
View raw message