jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1521884 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: security/authentication/ security/principal/ security/privilege/ spi/security/
Date Wed, 11 Sep 2013 14:51:54 GMT
Author: angela
Date: Wed Sep 11 14:51:54 2013
New Revision: 1521884

URL: http://svn.apache.org/r1521884
Log:
OAK-754 	: Pluggable Security Setup  (WIP)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImpl.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/ConfigurationBase.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java?rev=1521884&r1=1521883&r2=1521884&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/AuthenticationConfigurationImpl.java
Wed Sep 11 14:51:54 2013
@@ -19,11 +19,14 @@ package org.apache.jackrabbit.oak.securi
 import javax.annotation.Nonnull;
 import javax.security.auth.login.Configuration;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.security.authentication.token.TokenProviderImpl;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationBase;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.AuthenticationConfiguration;
 import org.apache.jackrabbit.oak.spi.security.authentication.ConfigurationUtil;
@@ -49,10 +52,16 @@ import org.slf4j.LoggerFactory;
  * </ul>
  *
  */
+@Component()
+@Service({AuthenticationConfiguration.class, SecurityConfiguration.class})
 public class AuthenticationConfigurationImpl extends ConfigurationBase implements AuthenticationConfiguration
{
 
     private static final Logger log = LoggerFactory.getLogger(AuthenticationConfigurationImpl.class);
 
+    public AuthenticationConfigurationImpl() {
+        super();
+    }
+
     public AuthenticationConfigurationImpl(SecurityProvider securityProvider) {
         super(securityProvider);
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImpl.java?rev=1521884&r1=1521883&r2=1521884&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/principal/PrincipalConfigurationImpl.java
Wed Sep 11 14:51:54 2013
@@ -18,10 +18,13 @@ package org.apache.jackrabbit.oak.securi
 
 import javax.annotation.Nonnull;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationBase;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalConfiguration;
 import org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider;
@@ -30,8 +33,14 @@ import org.apache.jackrabbit.oak.spi.sec
 /**
  * Default implementation of the {@code PrincipalConfiguration}
  */
+@Component()
+@Service({PrincipalConfiguration.class, SecurityConfiguration.class})
 public class PrincipalConfigurationImpl extends ConfigurationBase implements PrincipalConfiguration
{
 
+    public PrincipalConfigurationImpl() {
+        super();
+    }
+
     public PrincipalConfigurationImpl(SecurityProvider securityProvider) {
         super(securityProvider);
     }

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=1521884&r1=1521883&r2=1521884&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 Sep 11 14:51:54 2013
@@ -20,6 +20,8 @@ import java.util.Collections;
 import java.util.List;
 import javax.annotation.Nonnull;
 
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
@@ -28,11 +30,14 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationBase;
 import org.apache.jackrabbit.oak.spi.security.Context;
+import org.apache.jackrabbit.oak.spi.security.SecurityConfiguration;
 import org.apache.jackrabbit.oak.spi.security.privilege.PrivilegeConfiguration;
 
 /**
  * Configuration for the privilege management component.
  */
+@Component()
+@Service({PrivilegeConfiguration.class, SecurityConfiguration.class})
 public class PrivilegeConfigurationImpl extends ConfigurationBase implements PrivilegeConfiguration
{
 
     //---------------------------------------------< PrivilegeConfiguration >---

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/ConfigurationBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/ConfigurationBase.java?rev=1521884&r1=1521883&r2=1521884&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/ConfigurationBase.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/ConfigurationBase.java
Wed Sep 11 14:51:54 2013
@@ -18,17 +18,18 @@ package org.apache.jackrabbit.oak.spi.se
 
 import javax.annotation.Nonnull;
 
+import org.apache.felix.scr.annotations.Activate;
+import org.osgi.service.component.ComponentContext;
+
 /**
  * Abstract base implementation for the various security configurations.
  */
 public abstract class ConfigurationBase extends SecurityConfiguration.Default {
 
-    private final SecurityProvider securityProvider;
-    private final ConfigurationParameters config;
+    private SecurityProvider securityProvider;
+    private ConfigurationParameters config = ConfigurationParameters.EMPTY;
 
     public ConfigurationBase() {
-        securityProvider = null;
-        config = ConfigurationParameters.EMPTY;
     }
 
     public ConfigurationBase(SecurityProvider securityProvider) {
@@ -37,17 +38,28 @@ public abstract class ConfigurationBase 
     }
 
     @Nonnull
-    protected SecurityProvider getSecurityProvider() {
+    public SecurityProvider getSecurityProvider() {
         if (securityProvider == null) {
             throw new IllegalStateException();
         }
         return securityProvider;
     }
 
+    public void setSecurityProvider(@Nonnull SecurityProvider securityProvider) {
+        this.securityProvider = securityProvider;
+        config = securityProvider.getParameters(getName());
+    }
+
     //----------------------------------------------< SecurityConfiguration >---
     @Nonnull
     @Override
     public ConfigurationParameters getParameters() {
         return config;
     }
+
+    //----------------------------------------------------< SCR Integration >---
+    @Activate
+    protected void activate(ComponentContext context) {
+        config = ConfigurationParameters.newInstance(context.getProperties());
+    }
 }



Mime
View raw message