You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ie...@apache.org on 2010/01/24 15:26:25 UTC

svn commit: r902574 - /sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.java

Author: ieb
Date: Sun Jan 24 14:26:25 2010
New Revision: 902574

URL: http://svn.apache.org/viewvc?rev=902574&view=rev
Log:
SLING-1282 added default behaviour back in to allow other SlingRepository implementations to continue to work as before.

Modified:
    sling/trunk/bundles/jcr/base/src/main/java/org/apache/sling/jcr/base/AbstractSlingRepository.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=902574&r1=902573&r2=902574&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 Sun Jan 24 14:26:25 2010
@@ -140,8 +140,12 @@
 
     private String anonUser;
 
+    private char[] anonPass;
+
     private String adminUser;
 
+    private char[] adminPass;
+
     private SessionPoolManager poolManager;
 
     private Loader loader;
@@ -269,13 +273,20 @@
      * @param anonUser the user name of the anon user.
      * @return a Credentials implementation that represents the anon user.
      */
-    protected abstract Credentials getAnonCredentials(String anonUser);
+    protected Credentials getAnonCredentials(String anonUser) {
+        // NB: this method is overridden in the Jackrabbit Service bundle to avoid using the anon password. SLING-1282
+        return new SimpleCredentials(anonUser, anonPass);
+    }
     
     /**
      * @param adminUser the name of the administrative user.
      * @return a Credentials implementation that represents the administrative user.
      */
-    protected abstract Credentials getAdministrativeCredentials(String adminUser);
+    protected Credentials getAdministrativeCredentials(String adminUser){
+        // NB: this method is overridden in the Jackrabbit Service bundle to avoid using the admin password. SLING-1282
+        return new SimpleCredentials(adminUser, adminPass);
+    }
+     
 
 
     /*
@@ -618,9 +629,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));
@@ -741,7 +756,6 @@
 
     // ---------- Background operation checking repository availability --------
 
-
     private void setPollTimeActive(int seconds) {
         if (seconds < MIN_POLL) {
             seconds = DEFAULT_POLL_ACTIVE;