Author: ieb
Date: Mon Jan 25 10:38:46 2010
New Revision: 902773

URL: http://svn.apache.org/viewvc?rev=902773&view=rev
Log:
Revert "SLING-1282 First pass at using credentials classes, concerned about 
impersonation."

This reverts commit 017f5fbf5396f7018f33ff9feacbebba17ce46b0.

Removed:
    
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/AdministrativeCredentials.java
    
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/AnonCredentials.java
    
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/CallbackHandlerWrapper.java
    
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/TrustedCredentials.java
Modified:
    
sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
    sling/trunk/bundles/jcr/jackrabbit-server/pom.xml
    
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
    
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/PluggableDefaultLoginModule.java

Modified: 
sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java?rev=902773&r1=902772&r2=902773&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
 (original)
+++ 
sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java
 Mon Jan 25 10:38:46 2010
@@ -140,8 +140,12 @@
 
     private String anonUser;
 
+    private char[] anonPass;
+
     private String adminUser;
 
+    private char[] adminPass;
+
     private SessionPoolManager poolManager;
 
     private Loader loader;
@@ -197,7 +201,8 @@
 
     public Session loginAdministrative(String workspace)
             throws RepositoryException {
-        Credentials sc = getAdministrativeCredentials(this.adminUser);
+        SimpleCredentials sc = new SimpleCredentials(this.adminUser,
+            this.adminPass);
         return this.login(sc, workspace);
     }
 
@@ -221,7 +226,7 @@
         }
 
         if (credentials == null) {
-            credentials = getAnonCredentials(this.anonUser);
+            credentials = new SimpleCredentials(this.anonUser, this.anonPass);
         }
 
         // check the workspace
@@ -264,19 +269,6 @@
             throw new RepositoryException(re.getMessage(), re);
         }
     }
-    
-    /**
-     * @param anonUser the user name of the anon user.
-     * @return a Credentials implementation that represents the anon user.
-     */
-    protected abstract Credentials getAnonCredentials(String anonUser);
-    
-    /**
-     * @param adminUser the name of the administrative user.
-     * @return a Credentials implementation that represents the administrative 
user.
-     */
-    protected abstract Credentials getAdministrativeCredentials(String 
adminUser);
-
 
     /*
      * (non-Javadoc)
@@ -618,9 +610,13 @@
             PROPERTY_DEFAULT_WORKSPACE, null));
         this.anonUser = this.getProperty(properties, PROPERTY_ANONYMOUS_USER,
             DEFAULT_ANONYMOUS_USER);
+        this.anonPass = this.getProperty(properties, PROPERTY_ANONYMOUS_PASS,
+            DEFAULT_ANONYMOUS_PASS).toCharArray();
 
         this.adminUser = this.getProperty(properties, PROPERTY_ADMIN_USER,
             DEFAULT_ADMIN_USER);
+        this.adminPass = this.getProperty(properties, PROPERTY_ADMIN_PASS,
+            DEFAULT_ADMIN_PASS).toCharArray();
 
         setPollTimeActive(getIntProperty(properties, PROPERTY_POLL_ACTIVE));
         setPollTimeInActive(getIntProperty(properties, 
PROPERTY_POLL_INACTIVE));
@@ -713,7 +709,8 @@
 
         Session tmpSession = null;
         try {
-            Credentials sc = getAdministrativeCredentials(this.adminUser);
+            SimpleCredentials sc = new SimpleCredentials(this.adminUser,
+                this.adminPass);
             tmpSession = this.getRepository().login(sc);
             Workspace defaultWs = tmpSession.getWorkspace();
             if (defaultWs instanceof JackrabbitWorkspace) {
@@ -741,7 +738,6 @@
 
     // ---------- Background operation checking repository availability 
--------
 
-
     private void setPollTimeActive(int seconds) {
         if (seconds < MIN_POLL) {
             seconds = DEFAULT_POLL_ACTIVE;

Modified: sling/trunk/bundles/jcr/jackrabbit-server/pom.xml
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/pom.xml?rev=902773&r1=902772&r2=902773&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/jackrabbit-server/pom.xml (original)
+++ sling/trunk/bundles/jcr/jackrabbit-server/pom.xml Mon Jan 25 10:38:46 2010
@@ -236,7 +236,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.base</artifactId>
-            <version>2.0.5-SNAPSHOT</version>
+            <version>2.0.4-incubator</version>
             <scope>compile</scope>
         </dependency>
         
@@ -253,12 +253,6 @@
             <version>1.6.0</version>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>org.apache.jackrabbit</groupId>
-            <artifactId>jackrabbit-jcr-rmi</artifactId>
-            <version>1.5.0</version>
-            <scope>compile</scope>
-        </dependency>
 
         <!-- Text Extractor support -->
         <dependency>

Modified: 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java?rev=902773&r1=902772&r2=902773&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
 (original)
+++ 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/SlingServerRepository.java
 Mon Jan 25 10:38:46 2010
@@ -26,7 +26,6 @@
 import java.net.URL;
 import java.util.Dictionary;
 
-import javax.jcr.Credentials;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 
@@ -34,8 +33,6 @@
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.base.AbstractSlingRepository;
-import 
org.apache.sling.jcr.jackrabbit.server.impl.security.AdministrativeCredentials;
-import org.apache.sling.jcr.jackrabbit.server.impl.security.AnonCredentials;
 import org.osgi.framework.Bundle;
 import org.osgi.service.log.LogService;
 
@@ -165,9 +162,6 @@
                 "Repository is not a RepositoryImpl, nothing to do");
         }
     }
-    
-    
-    
 
     //---------- Helper -------------------------------------------------------
 
@@ -215,22 +209,4 @@
             }
         }
     }
-
-    /**
-     * {...@inheritdoc}
-     * @see 
org.apache.sling.jcr.base.AbstractSlingRepository#getAdministrativeCredentials(java.lang.String)
-     */
-    @Override
-    protected Credentials getAdministrativeCredentials(String adminUser) {
-        return new AdministrativeCredentials(adminUser);
-    }
-
-    /**
-     * {...@inheritdoc}
-     * @see 
org.apache.sling.jcr.base.AbstractSlingRepository#getAnonCredentials(java.lang.String)
-     */
-    @Override
-    protected Credentials getAnonCredentials(String anonUser) {
-        return new AnonCredentials(anonUser);
-    }
 }

Modified: 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/PluggableDefaultLoginModule.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/PluggableDefaultLoginModule.java?rev=902773&r1=902772&r2=902773&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/PluggableDefaultLoginModule.java
 (original)
+++ 
sling/trunk/bundles/jcr/jackrabbit-server/src/main/java/org/apache/sling/jcr/jackrabbit/server/impl/security/PluggableDefaultLoginModule.java
 Mon Jan 25 10:38:46 2010
@@ -53,18 +53,14 @@
         for (int i = 0; i < modules.length; i++) {
             modules[i].doInit(callbackHandler, session, options);
         }
-        CallbackHandlerWrapper wrappedCallbackHandler = new 
CallbackHandlerWrapper(subject, callbackHandler);
 
-        super.doInit(wrappedCallbackHandler, session, options);
+        super.doInit(callbackHandler, session, options);
     }
 
     /**
      * @see 
org.apache.jackrabbit.core.security.authentication.DefaultLoginModule#getPrincipal
      */
     protected Principal getPrincipal(Credentials creds) {
-        if ( creds instanceof TrustedCredentials ) {
-            return ((TrustedCredentials) creds).getPrincipal();
-        }
         LoginModulePlugin[] modules = Activator.getLoginModules();
         for (int i = 0; i < modules.length; i++) {
             if (modules[i].canHandle(creds)) {
@@ -97,9 +93,6 @@
      */
     protected Authentication getAuthentication(Principal principal,
             Credentials creds) throws RepositoryException {
-        if ( creds instanceof TrustedCredentials ) {
-            return ((TrustedCredentials) creds).getTrustedAuthentication();
-        }
         LoginModulePlugin[] modules = Activator.getLoginModules();
         for (int i = 0; i < modules.length; i++) {
             if (modules[i].canHandle(creds)) {
@@ -119,12 +112,6 @@
      */
     protected boolean impersonate(Principal principal, Credentials creds)
             throws RepositoryException, FailedLoginException {
-        if ( creds instanceof AdministrativeCredentials ) {
-            return true;
-        }
-        if ( creds instanceof AnonCredentials ) {
-            return false;
-        }
 
         LoginModulePlugin[] modules = Activator.getLoginModules();
         for (int i = 0; i < modules.length; i++) {


Reply via email to