qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgodf...@apache.org
Subject svn commit: r1573421 [2/2] - in /qpid/trunk/qpid/java: broker-core/src/main/java/org/apache/qpid/server/model/ broker-core/src/main/java/org/apache/qpid/server/model/adapter/ broker-core/src/main/java/org/apache/qpid/server/plugin/ broker-core/src/main...
Date Mon, 03 Mar 2014 01:59:54 GMT
Added: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java?rev=1573421&view=auto
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java (added)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordDatabaseAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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.qpid.server.security.auth.manager;
+
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
+import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
+
+import java.util.Map;
+
+public class PlainPasswordDatabaseAuthenticationManager extends PrincipalDatabaseAuthenticationManager<PlainPasswordDatabaseAuthenticationManager>
+{
+    protected PlainPasswordDatabaseAuthenticationManager(final Broker broker,
+                                                         final Map<String, Object> defaults,
+                                                         final Map<String, Object> attributes, final boolean recovering)
+    {
+        super(broker, defaults, attributes,recovering);
+    }
+
+    @Override
+    protected PrincipalDatabase createDatabase()
+    {
+        return new PlainPasswordFilePrincipalDatabase();
+    }
+}

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactory.java Mon Mar  3 01:59:53 2014
@@ -20,14 +20,26 @@
  */
 package org.apache.qpid.server.security.auth.manager;
 
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 
-import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
-import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.util.ResourceBundleLoader;
 
-public class PlainPasswordFileAuthenticationManagerFactory extends AbstractPrincipalDatabaseAuthManagerFactory
+public class PlainPasswordFileAuthenticationManagerFactory implements AuthenticationManagerFactory
 {
+    public static final String RESOURCE_BUNDLE = "org.apache.qpid.server.security.auth.manager.PasswordFileAuthenticationProviderAttributeDescriptions";
+    public static final String ATTRIBUTE_PATH = "path";
+
+
+    public static final Collection<String> ATTRIBUTES = Collections.unmodifiableList(Arrays.asList(
+            AuthenticationProvider.TYPE,
+            ATTRIBUTE_PATH));
+
     public static final String PROVIDER_TYPE = "PlainPasswordFile";
 
     @Override
@@ -37,14 +49,28 @@ public class PlainPasswordFileAuthentica
     }
 
     @Override
-    PrincipalDatabase createPrincipalDatabase()
+    public AbstractAuthenticationManager createInstance(final Broker broker,
+                                                        final Map<String, Object> attributes,
+                                                        final boolean recovering)
     {
-        return new PlainPasswordFilePrincipalDatabase();
+        if (attributes == null || !getType().equals(attributes.get(AuthenticationProvider.TYPE)))
+        {
+            return null;
+        }
+
+        return new PlainPasswordDatabaseAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes,recovering);
     }
 
     @Override
     public Map<String, String> getAttributeDescriptions()
     {
-        return ResourceBundleLoader.getResources(AbstractPrincipalDatabaseAuthManagerFactory.RESOURCE_BUNDLE);
+        return ResourceBundleLoader.getResources(RESOURCE_BUNDLE);
+    }
+
+
+    @Override
+    public Collection<String> getAttributeNames()
+    {
+        return ATTRIBUTES;
     }
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -23,34 +23,84 @@ package org.apache.qpid.server.security.
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.security.AccessControlException;
 import java.security.Principal;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import javax.security.auth.login.AccountNotFoundException;
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 
+import org.apache.log4j.Logger;
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.model.*;
+import org.apache.qpid.server.model.adapter.AbstractConfiguredObject;
+import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
+import org.apache.qpid.server.security.access.Operation;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus;
 import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
 
-public class PrincipalDatabaseAuthenticationManager implements AuthenticationManager
+public abstract class PrincipalDatabaseAuthenticationManager<T extends PrincipalDatabaseAuthenticationManager<T>>
+        extends AbstractAuthenticationManager<T>
+        implements PasswordCredentialManagingAuthenticationProvider<T>
 {
+
+    private static final Logger LOGGER = Logger.getLogger(PrincipalDatabaseAuthenticationManager.class);
+
+
     private final PrincipalDatabase _principalDatabase;
-    private final String _passwordFile;
+    private String _path;
 
-    public PrincipalDatabaseAuthenticationManager(PrincipalDatabase pd, String passwordFile)
+    protected PrincipalDatabaseAuthenticationManager(final Broker broker,
+                                                     final Map<String, Object> defaults,
+                                                     final Map<String, Object> attributes,
+                                                     boolean recovering)
     {
-        _principalDatabase = pd;
-        _passwordFile = passwordFile;
+        super(broker, defaults, attributes);
+
+        if(!recovering)
+        {
+            try
+            {
+                File passwordFile = new File(_path);
+                if (!passwordFile.exists())
+                {
+                    passwordFile.createNewFile();
+                }
+                else if (!passwordFile.canRead())
+                {
+                    throw new IllegalConfigurationException("Cannot read password file" + _path + ". Check permissions.");
+                }
+            }
+            catch (IOException e)
+            {
+                throw new IllegalConfigurationException("Cannot use password database at :" + _path, e);
+            }
+        }
+        _principalDatabase = createDatabase();
+    }
+
+    protected abstract PrincipalDatabase createDatabase();
+
+
+    @ManagedAttribute( automate = true , mandatory = true )
+    public String getPath()
+    {
+        return _path;
     }
 
     public void initialise()
     {
         try
         {
-            _principalDatabase.open(new File(_passwordFile));
+            _principalDatabase.open(new File(_path));
         }
         catch (FileNotFoundException e)
         {
@@ -58,7 +108,7 @@ public class PrincipalDatabaseAuthentica
         }
         catch (IOException e)
         {
-            throw new IllegalConfigurationException("Cannot use password database at :" + _passwordFile, e);
+            throw new IllegalConfigurationException("Cannot use password database at :" + _path, e);
         }
     }
 
@@ -130,34 +180,371 @@ public class PrincipalDatabaseAuthentica
         return _principalDatabase;
     }
 
+
     @Override
-    public void onCreate()
+    public void delete()
     {
-        try
+        File file = new File(_path);
+        if (file.exists() && file.isFile())
+        {
+            file.delete();
+        }
+    }
+
+    @Override
+    public boolean createUser(String username, String password, Map<String, String> attributes)
+    {
+        getSecurityManager().authoriseUserOperation(Operation.CREATE, username);
+        return getPrincipalDatabase().createPrincipal(new UsernamePrincipal(username), password.toCharArray());
+
+    }
+
+    @Override
+    public void deleteUser(String username) throws AccountNotFoundException
+    {
+        getSecurityManager().authoriseUserOperation(Operation.DELETE, username);
+        getPrincipalDatabase().deletePrincipal(new UsernamePrincipal(username));
+
+    }
+
+    private org.apache.qpid.server.security.SecurityManager getSecurityManager()
+    {
+        return getBroker().getSecurityManager();
+    }
+
+    @Override
+    public void setPassword(String username, String password) throws AccountNotFoundException
+    {
+        getSecurityManager().authoriseUserOperation(Operation.UPDATE, username);
+
+        getPrincipalDatabase().updatePassword(new UsernamePrincipal(username), password.toCharArray());
+
+    }
+
+    @Override
+    public Map<String, Map<String, String>> getUsers()
+    {
+
+        Map<String, Map<String,String>> users = new HashMap<String, Map<String, String>>();
+        for(Principal principal : getPrincipalDatabase().getUsers())
         {
-            File passwordFile = new File(_passwordFile);
-            if (!passwordFile.exists())
+            users.put(principal.getName(), Collections.<String, String>emptyMap());
+        }
+        return users;
+    }
+
+    public void reload() throws IOException
+    {
+        getPrincipalDatabase().reload();
+    }
+
+    @Override
+    public <C extends ConfiguredObject> C addChild(Class<C> childClass,
+                                                   Map<String, Object> attributes,
+                                                   ConfiguredObject... otherParents)
+    {
+        if(childClass == User.class)
+        {
+            String username = (String) attributes.get("name");
+            String password = (String) attributes.get("password");
+            Principal p = new UsernamePrincipal(username);
+
+            if(createUser(username, password,null))
             {
-                passwordFile.createNewFile();
+                @SuppressWarnings("unchecked")
+                C principalAdapter = (C) new PrincipalAdapter(p);
+                return principalAdapter;
             }
-            else if (!passwordFile.canRead())
+            else
             {
-                throw new IllegalConfigurationException("Cannot read password file" + _passwordFile + ". Check permissions.");
+                LOGGER.info("Failed to create user " + username + ". User already exists?");
+                return null;
+
             }
         }
-        catch (IOException e)
+
+        return super.addChild(childClass, attributes, otherParents);
+    }
+
+    @Override
+    public <C extends ConfiguredObject> Collection<C> getChildren(Class<C> clazz)
+    {
+        if(clazz == User.class)
         {
-            throw new IllegalConfigurationException("Cannot use password database at :" + _passwordFile, e);
+            List<Principal> users = getPrincipalDatabase().getUsers();
+            Collection<User> principals = new ArrayList<User>(users.size());
+            for(Principal user : users)
+            {
+                principals.add(new PrincipalAdapter(user));
+            }
+            @SuppressWarnings("unchecked")
+            Collection<C> unmodifiablePrincipals = (Collection<C>) Collections.unmodifiableCollection(principals);
+            return unmodifiablePrincipals;
+        }
+        else
+        {
+            return super.getChildren(clazz);
         }
     }
 
     @Override
-    public void onDelete()
+    protected void childAdded(ConfiguredObject child)
     {
-        File file = new File(_passwordFile);
-        if (file.exists() && file.isFile())
+        if (child instanceof User)
         {
-            file.delete();
+            // no-op, prevent storing users in the broker store
+            return;
+        }
+        super.childAdded(child);
+    }
+
+    @Override
+    protected void childRemoved(ConfiguredObject child)
+    {
+        if (child instanceof User)
+        {
+            // no-op, as per above, users are not in the store
+            return;
+        }
+        super.childRemoved(child);
+    }
+
+    protected void validateAttributes(Map<String, Object> attributes)
+    {
+        super.validateChangeAttributes(attributes);
+
+        String newName = (String)attributes.get(NAME);
+        String currentName = getName();
+        if (!currentName.equals(newName))
+        {
+            throw new IllegalConfigurationException("Changing the name of authentication provider is not supported");
+        }
+        String newType = (String)attributes.get(TYPE);
+        String currentType = (String)getAttribute(TYPE);
+        if (!currentType.equals(newType))
+        {
+            throw new IllegalConfigurationException("Changing the type of authentication provider is not supported");
+        }
+
+    }
+
+    @Override
+    protected void changeAttributes(Map<String, Object> attributes)
+    {
+        Map<String, Object> effectiveAttributes = super.generateEffectiveAttributes(attributes);
+        validateAttributes(effectiveAttributes);
+        super.changeAttributes(attributes);
+        initialise();
+
+        // if provider was previously in ERRORED state then set its state to ACTIVE
+        updateState(State.ERRORED, State.ACTIVE);
+
+    }
+
+    private class PrincipalAdapter extends AbstractConfiguredObject<PrincipalAdapter> implements User<PrincipalAdapter>
+    {
+        private final Principal _user;
+
+        public PrincipalAdapter(Principal user)
+        {
+            super(Collections.<String,Object>emptyMap(), createPrincipalAttributes(PrincipalDatabaseAuthenticationManager.this, user),
+                  PrincipalDatabaseAuthenticationManager.this.getTaskExecutor());
+            _user = user;
+
+        }
+
+        @Override
+        public String getPassword()
+        {
+            return (String)getAttribute(PASSWORD);
+        }
+
+        @Override
+        public void setPassword(String password)
+        {
+            try
+            {
+                PrincipalDatabaseAuthenticationManager.this.setPassword(_user.getName(), password);
+            }
+            catch (AccountNotFoundException e)
+            {
+                throw new IllegalStateException(e);
+            }
+        }
+
+
+        @Override
+        public String setName(String currentName, String desiredName)
+                throws IllegalStateException, AccessControlException
+        {
+            throw new IllegalStateException("Names cannot be updated");
+        }
+
+        @Override
+        public State getState()
+        {
+            return State.ACTIVE;
         }
+
+        @Override
+        public boolean isDurable()
+        {
+            return true;
+        }
+
+        @Override
+        public void setDurable(boolean durable)
+                throws IllegalStateException, AccessControlException, IllegalArgumentException
+        {
+            throw new IllegalStateException("Durability cannot be updated");
+        }
+
+        @Override
+        public LifetimePolicy getLifetimePolicy()
+        {
+            return LifetimePolicy.PERMANENT;
+        }
+
+        @Override
+        public LifetimePolicy setLifetimePolicy(LifetimePolicy expected, LifetimePolicy desired)
+                throws IllegalStateException, AccessControlException, IllegalArgumentException
+        {
+            throw new IllegalStateException("LifetimePolicy cannot be updated");
+        }
+
+        @Override
+        public <C extends ConfiguredObject> Collection<C> getChildren(Class<C> clazz)
+        {
+            return null;
+        }
+
+        @Override
+        public <C extends ConfiguredObject> C createChild(Class<C> childClass,
+                                                          Map<String, Object> attributes,
+                                                          ConfiguredObject... otherParents)
+        {
+            return null;
+        }
+
+        @Override
+        public Collection<String> getAttributeNames()
+        {
+            return getAttributeNames(User.class);
+        }
+
+        @Override
+        public Object getAttribute(String name)
+        {
+            if(ID.equals(name))
+            {
+                return getId();
+            }
+            else if(PASSWORD.equals(name))
+            {
+                return null; // for security reasons we don't expose the password
+            }
+            else if(NAME.equals(name))
+            {
+                return getName();
+            }
+            return super.getAttribute(name);
+        }
+
+        @Override
+        public boolean changeAttribute(String name, Object expected, Object desired)
+                throws IllegalStateException, AccessControlException, IllegalArgumentException
+        {
+            if(name.equals(PASSWORD))
+            {
+                setPassword((String)desired);
+                return true;
+            }
+            return super.changeAttribute(name, expected, desired);
+        }
+
+        @Override
+        protected boolean setState(State currentState, State desiredState)
+                throws IllegalStateTransitionException, AccessControlException
+        {
+            if(desiredState == State.DELETED)
+            {
+                try
+                {
+                    String userName = _user.getName();
+                    deleteUser(userName);
+                    PreferencesProvider preferencesProvider = getPreferencesProvider();
+                    if (preferencesProvider != null)
+                    {
+                        preferencesProvider.deletePreferences(userName);
+                    }
+                }
+                catch (AccountNotFoundException e)
+                {
+                    LOGGER.warn("Failed to delete user " + _user, e);
+                }
+                return true;
+            }
+            return false;
+        }
+
+        @Override
+        public Map<String, Object> getPreferences()
+        {
+            PreferencesProvider preferencesProvider = getPreferencesProvider();
+            if (preferencesProvider == null)
+            {
+                return null;
+            }
+            return preferencesProvider.getPreferences(this.getName());
+        }
+
+        @Override
+        public Object getPreference(String name)
+        {
+            Map<String, Object> preferences = getPreferences();
+            if (preferences == null)
+            {
+                return null;
+            }
+            return preferences.get(name);
+        }
+
+        @Override
+        public Map<String, Object> setPreferences(Map<String, Object> preferences)
+        {
+            PreferencesProvider preferencesProvider = getPreferencesProvider();
+            if (preferencesProvider == null)
+            {
+                return null;
+            }
+            return preferencesProvider.setPreferences(this.getName(), preferences);
+        }
+
+        @Override
+        public boolean deletePreferences()
+        {
+            PreferencesProvider preferencesProvider = getPreferencesProvider();
+            if (preferencesProvider == null)
+            {
+                return false;
+            }
+            String[] deleted = preferencesProvider.deletePreferences(this.getName());
+            return deleted.length == 1;
+        }
+
+        private PreferencesProvider getPreferencesProvider()
+        {
+            return PrincipalDatabaseAuthenticationManager.this.getPreferencesProvider();
+        }
+
     }
+
+    private static Map<String, Object> createPrincipalAttributes(PrincipalDatabaseAuthenticationManager manager, final Principal user)
+    {
+        final Map<String, Object> attributes = new HashMap<String, Object>();
+        attributes.put(ID, UUIDGenerator.generateUserUUID(manager.getName(), user.getName()));
+        attributes.put(NAME, user.getName());
+        return attributes;
+    }
+
 }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -36,28 +36,33 @@ import javax.security.sasl.SaslException
 import javax.security.sasl.SaslServer;
 
 import org.apache.log4j.Logger;
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.security.auth.sasl.plain.PlainPasswordCallback;
 import org.apache.qpid.server.security.auth.sasl.plain.PlainSaslServer;
 
-public class SimpleAuthenticationManager implements AuthenticationManager
+public class SimpleAuthenticationManager extends AbstractAuthenticationManager<SimpleAuthenticationManager>
 {
     private static final Logger _logger = Logger.getLogger(SimpleAuthenticationManager.class);
 
     private static final String PLAIN_MECHANISM = "PLAIN";
     private static final String CRAM_MD5_MECHANISM = "CRAM-MD5";
 
-    private Map<String, String> _users;
+    private final Map<String, String> _users = Collections.synchronizedMap(new HashMap<String, String>());
 
-    public SimpleAuthenticationManager(String userName, String userPassword)
+    public SimpleAuthenticationManager(final Broker broker,
+                                          final Map<String, Object> defaults,
+                                          final Map<String, Object> attributes)
     {
-        this(Collections.singletonMap(userName, userPassword));
+        super(broker, defaults, attributes);
     }
 
-    public SimpleAuthenticationManager(Map<String, String> users)
+
+    public void addUser(String username, String password)
     {
-        _users = new HashMap<String, String>(users);
+        _users.put(username, password);
     }
 
     @Override
@@ -134,13 +139,7 @@ public class SimpleAuthenticationManager
     }
 
     @Override
-    public void onCreate()
-    {
-        // nothing to do, no external resource is required
-    }
-
-    @Override
-    public void onDelete()
+    public void delete()
     {
         // nothing to do, no external resource is used
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManager.java Mon Mar  3 01:59:53 2014
@@ -24,7 +24,9 @@ import java.security.GeneralSecurityExce
 import java.security.KeyManagementException;
 import java.security.NoSuchAlgorithmException;
 import java.security.Principal;
+import java.util.HashMap;
 import java.util.Hashtable;
+import java.util.Map;
 
 import javax.naming.AuthenticationException;
 import javax.naming.Context;
@@ -44,6 +46,9 @@ import javax.security.sasl.SaslException
 import javax.security.sasl.SaslServer;
 
 import org.apache.log4j.Logger;
+import org.apache.qpid.server.configuration.updater.TaskExecutor;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ManagedAttribute;
 import org.apache.qpid.server.model.TrustStore;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus;
@@ -56,7 +61,7 @@ import org.apache.qpid.server.util.Serve
 import org.apache.qpid.server.util.StringUtil;
 import org.apache.qpid.ssl.SSLContextFactory;
 
-public class SimpleLDAPAuthenticationManager implements AuthenticationManager
+public class SimpleLDAPAuthenticationManager extends AbstractAuthenticationManager<SimpleLDAPAuthenticationManager>
 {
     private static final Logger _logger = Logger.getLogger(SimpleLDAPAuthenticationManager.class);
 
@@ -65,34 +70,40 @@ public class SimpleLDAPAuthenticationMan
      */
     private static final String JAVA_NAMING_LDAP_FACTORY_SOCKET = "java.naming.ldap.factory.socket";
 
-    private final String _authManagerName;
-    private final String _providerSearchURL;
-    private final String _providerAuthURL;
-    private final String _searchContext;
-    private final String _searchFilter;
-    private final String _ldapContextFactory;
+    private String _providerUrl;
+    private String _providerAuthUrl;
+    private String _searchContext;
+    private String _searchFilter;
+    private String _ldapContextFactory;
+
 
     /**
      * Trust store - typically used when the Directory has been secured with a certificate signed by a
      * private CA (or self-signed certificate).
      */
-    private final TrustStore _trustStore;
+    private TrustStore _trustStore;
 
     /**
      * Dynamically created SSL Socket Factory implementation used in the case where user has specified a trust store.
      */
     private Class<? extends SocketFactory> _sslSocketFactoryOverrideClass;
 
+    protected SimpleLDAPAuthenticationManager(final Broker broker,
+                                              final Map<String, Object> defaults,
+                                              final Map<String, Object> attributes)
+    {
+        super(broker, createDefaults(defaults, attributes), attributes);
+    }
 
-    SimpleLDAPAuthenticationManager(String authManagerName, String providerSearchUrl, String providerAuthUrl, String searchContext, String searchFilter, String ldapContextFactory, TrustStore trustStore)
+    private static Map<String, Object> createDefaults(final Map<String, Object> defaults,
+                                                      final Map<String, Object> attributes)
     {
-        _authManagerName = authManagerName;
-        _providerSearchURL = providerSearchUrl;
-        _providerAuthURL = providerAuthUrl;
-        _searchContext = searchContext;
-        _searchFilter = searchFilter;
-        _ldapContextFactory = ldapContextFactory;
-        _trustStore = trustStore;
+        final Map<String, Object> newDefaults = new HashMap<String, Object>(defaults);
+        if(!defaults.containsKey("providerAuthUrl") && attributes.containsKey("providerUrl"))
+        {
+            newDefaults.put("providerAuthUrl", attributes.get("providerUrl"));
+        }
+        return newDefaults;
     }
 
     @Override
@@ -103,6 +114,43 @@ public class SimpleLDAPAuthenticationMan
         validateInitialDirContext();
     }
 
+    @ManagedAttribute( automate = true )
+    public String getProviderUrl()
+    {
+        return _providerUrl;
+    }
+
+    @ManagedAttribute( automate = true )
+    public String getProviderAuthUrl()
+    {
+        return _providerAuthUrl;
+    }
+
+    @ManagedAttribute( automate = true )
+    public String getSearchContext()
+    {
+        return _searchContext;
+    }
+
+    @ManagedAttribute( automate = true )
+    public String getSearchFilter()
+    {
+        return _searchFilter;
+    }
+
+    @ManagedAttribute( automate = true )
+    public String getLdapContextFactory()
+    {
+        return _ldapContextFactory;
+    }
+
+    @ManagedAttribute( automate = true )
+    public TrustStore getTrustStore()
+    {
+        return _trustStore;
+    }
+
+
     @Override
     public String getMechanisms()
     {
@@ -181,7 +229,7 @@ public class SimpleLDAPAuthenticationMan
             return new AuthenticationResult(AuthenticationStatus.CONTINUE);
         }
 
-        Hashtable<String, Object> env = createInitialDirContextEnvironment(_providerAuthURL);
+        Hashtable<String, Object> env = createInitialDirContextEnvironment(_providerAuthUrl);
 
         env.put(Context.SECURITY_AUTHENTICATION, "simple");
         env.put(Context.SECURITY_PRINCIPAL, name);
@@ -264,7 +312,7 @@ public class SimpleLDAPAuthenticationMan
     {
         if (_trustStore != null)
         {
-            String clazzName = new StringUtil().createUniqueJavaName(_authManagerName);
+            String clazzName = new StringUtil().createUniqueJavaName(getName());
             SSLContext sslContext = null;
             try
             {
@@ -300,7 +348,7 @@ public class SimpleLDAPAuthenticationMan
 
     private void validateInitialDirContext()
     {
-        Hashtable<String,Object> env = createInitialDirContextEnvironment(_providerSearchURL);
+        Hashtable<String,Object> env = createInitialDirContextEnvironment(_providerUrl);
         env.put(Context.SECURITY_AUTHENTICATION, "none");
 
         InitialDirContext ctx = null;
@@ -310,7 +358,7 @@ public class SimpleLDAPAuthenticationMan
         }
         catch (NamingException e)
         {
-            throw new ServerScopedRuntimeException("Unable to establish anonymous connection to the ldap server at " + _providerSearchURL, e);
+            throw new ServerScopedRuntimeException("Unable to establish anonymous connection to the ldap server at " + _providerUrl, e);
         }
         finally
         {
@@ -371,7 +419,7 @@ public class SimpleLDAPAuthenticationMan
 
     private String getNameFromId(String id) throws NamingException
     {
-        Hashtable<String,Object> env = createInitialDirContextEnvironment(_providerSearchURL);
+        Hashtable<String,Object> env = createInitialDirContextEnvironment(_providerUrl);
 
         env.put(Context.SECURITY_AUTHENTICATION, "none");
         InitialDirContext ctx = createInitialDirContext(env);
@@ -417,13 +465,7 @@ public class SimpleLDAPAuthenticationMan
     }
 
     @Override
-    public void onCreate()
-    {
-        // nothing to do, no external resource is required
-    }
-
-    @Override
-    public void onDelete()
+    public void delete()
     {
         // nothing to do, no external resource is used
     }

Modified: qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactory.java Mon Mar  3 01:59:53 2014
@@ -25,6 +25,7 @@ import java.util.Collections;
 import java.util.Map;
 
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.TrustStore;
 import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
@@ -46,7 +47,7 @@ public class SimpleLDAPAuthenticationMan
     public static final String ATTRIBUTE_PROVIDER_URL = "providerUrl";
 
     public static final Collection<String> ATTRIBUTES = Collections.<String> unmodifiableList(Arrays.asList(
-            ATTRIBUTE_TYPE,
+            AuthenticationProvider.TYPE,
             ATTRIBUTE_PROVIDER_URL,
             ATTRIBUTE_SEARCH_CONTEXT,
             ATTRIBUTE_SEARCH_FILTER,
@@ -56,42 +57,17 @@ public class SimpleLDAPAuthenticationMan
             ));
 
     @Override
-    public AuthenticationManager createInstance(Broker broker, Map<String, Object> attributes)
+    public SimpleLDAPAuthenticationManager createInstance(Broker broker,
+                                                          Map<String, Object> attributes,
+                                                          final boolean recovering)
     {
-        if (attributes == null || !PROVIDER_TYPE.equals(attributes.get(ATTRIBUTE_TYPE)))
+        if (attributes == null || !PROVIDER_TYPE.equals(attributes.get(AuthenticationProvider.TYPE)))
         {
             return null;
         }
 
-        String name = (String) attributes.get(ATTRIBUTE_NAME);
-        String providerUrl = (String) attributes.get(ATTRIBUTE_PROVIDER_URL);
-        String providerAuthUrl = (String) attributes.get(ATTRIBUTE_PROVIDER_AUTH_URL);
 
-        if (providerAuthUrl == null)
-        {
-            providerAuthUrl = providerUrl;
-        }
-        String searchContext = (String) attributes.get(ATTRIBUTE_SEARCH_CONTEXT);
-        String searchFilter = (String) attributes.get(ATTRIBUTE_SEARCH_FILTER);
-        String ldapContextFactory = (String) attributes.get(ATTRIBUTE_LDAP_CONTEXT_FACTORY);
-        String trustStoreName = (String) attributes.get(ATTRIBUTE_TRUST_STORE);
-        if (ldapContextFactory == null)
-        {
-            ldapContextFactory = DEFAULT_LDAP_CONTEXT_FACTORY;
-        }
-
-        TrustStore trustStore = null;
-        if (trustStoreName != null)
-        {
-            trustStore = broker.findTrustStoreByName(trustStoreName);
-            if (trustStore == null)
-            {
-                throw new IllegalConfigurationException("Can't find truststore with name '" + trustStoreName + "'");
-            }
-        }
-
-        return new SimpleLDAPAuthenticationManager(name, providerUrl, providerAuthUrl, searchContext,
-                searchFilter, ldapContextFactory, trustStore);
+        return new SimpleLDAPAuthenticationManager(broker, Collections.<String,Object>emptyMap(),attributes);
     }
 
     @Override

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/AuthenticationProviderRecovererTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/AuthenticationProviderRecovererTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/AuthenticationProviderRecovererTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/startup/AuthenticationProviderRecovererTest.java Mon Mar  3 01:59:53 2014
@@ -83,7 +83,7 @@ public class AuthenticationProviderRecov
         try
         {
             Map<String, Object> authenticationAttributes = new HashMap<String, Object>();
-            authenticationAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE,
+            authenticationAttributes.put(AuthenticationProvider.TYPE,
                     PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
             authenticationAttributes.put(AuthenticationProvider.NAME, "test-authenticator");
             authenticationAttributes.put(PlainPasswordFileAuthenticationManagerFactory.ATTRIBUTE_PATH,

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/configuration/store/ConfigurationEntryStoreTestCase.java Mon Mar  3 01:59:53 2014
@@ -38,7 +38,6 @@ import org.apache.qpid.server.model.Tran
 import org.apache.qpid.server.model.TrustStore;
 import org.apache.qpid.server.model.VirtualHost;
 import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManager;
 import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManager;
 import org.apache.qpid.test.utils.QpidTestCase;
@@ -85,7 +84,7 @@ public abstract class ConfigurationEntry
         _authenticationProviderId = UUID.randomUUID();
         _authenticationProviderAttributes = new HashMap<String, Object>();
         _authenticationProviderAttributes.put(AuthenticationProvider.NAME, "authenticationProvider1");
-        _authenticationProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, AnonymousAuthenticationManager.class.getSimpleName());
+        _authenticationProviderAttributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManager.class.getSimpleName());
 
         _store = createStore(_brokerId, _brokerAttributes);
         addConfiguration(_virtualHostId, VirtualHost.class.getSimpleName(), _virtualHostAttributes);
@@ -247,7 +246,7 @@ public abstract class ConfigurationEntry
         UUID authenticationProviderId = UUID.randomUUID();
         Map<String, Object> authenticationProviderAttributes = new HashMap<String, Object>();
         authenticationProviderAttributes.put(AuthenticationProvider.NAME, "authenticationProvider1");
-        authenticationProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, ExternalAuthenticationManager.class.getSimpleName());
+        authenticationProviderAttributes.put(AuthenticationProvider.TYPE, ExternalAuthenticationManager.class.getSimpleName());
         ConfigurationEntry providerEntry = new ConfigurationEntry(authenticationProviderId, AuthenticationProvider.class.getSimpleName(),
                 authenticationProviderAttributes, Collections.<UUID> emptySet(), _store);
 
@@ -267,7 +266,7 @@ public abstract class ConfigurationEntry
 
         Map<String, Object> authenticationProviderAttributes = new HashMap<String, Object>();
         authenticationProviderAttributes.put(AuthenticationProvider.NAME, "authenticationProvider1");
-        authenticationProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, ExternalAuthenticationManager.class.getSimpleName());
+        authenticationProviderAttributes.put(AuthenticationProvider.TYPE, ExternalAuthenticationManager.class.getSimpleName());
         ConfigurationEntry updatedEntry = new ConfigurationEntry(_authenticationProviderId, AuthenticationProvider.class.getSimpleName(),
                 authenticationProviderAttributes, Collections.<UUID> emptySet(), _store);
         _store.save(updatedEntry);

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/AnonymousAuthenticationManagerTest.java Mon Mar  3 01:59:53 2014
@@ -21,16 +21,35 @@
 package org.apache.qpid.server.security.auth.manager;
 
 import static org.apache.qpid.server.security.auth.AuthenticatedPrincipalTestHelper.assertOnlyContainsWrapped;
+import static org.mockito.Mockito.mock;
 
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.test.utils.QpidTestCase;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
 public class AnonymousAuthenticationManagerTest extends QpidTestCase
 {
-    private AuthenticationManager _manager = new AnonymousAuthenticationManager();
+    private AuthenticationManager _manager;
+
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        Map<String,Object> attrs = new HashMap<String, Object>();
+        attrs.put(AuthenticationProvider.ID, UUID.randomUUID());
+        attrs.put(AuthenticationProvider.NAME, getTestName());
+        _manager = new AnonymousAuthenticationManager(mock(Broker.class), Collections.<String,Object>emptyMap(), attrs);
+
+    }
 
     public void tearDown() throws Exception
     {

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactoryTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactoryTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/Base64MD5PasswordFileAuthenticationManagerFactoryTest.java Mon Mar  3 01:59:53 2014
@@ -25,9 +25,11 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.UUID;
 
 import junit.framework.TestCase;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.security.auth.database.Base64MD5PasswordFilePrincipalDatabase;
@@ -45,14 +47,17 @@ public class Base64MD5PasswordFileAuthen
         super.setUp();
         _emptyPasswordFile = File.createTempFile(getName(), "passwd");
         _emptyPasswordFile.deleteOnExit();
+
+        _configuration.put(AuthenticationProvider.ID, UUID.randomUUID());
+        _configuration.put(AuthenticationProvider.NAME, getName());
     }
 
     public void testBase64MD5InstanceCreated() throws Exception
     {
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _emptyPasswordFile.getAbsolutePath());
+        _configuration.put(AuthenticationProvider.TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put("path", _emptyPasswordFile.getAbsolutePath());
 
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNotNull(manager);
         assertTrue(manager instanceof PrincipalDatabaseAuthenticationManager);
         assertTrue(((PrincipalDatabaseAuthenticationManager)manager).getPrincipalDatabase() instanceof Base64MD5PasswordFilePrincipalDatabase);
@@ -63,12 +68,12 @@ public class Base64MD5PasswordFileAuthen
         //delete the file
         _emptyPasswordFile.delete();
 
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _emptyPasswordFile.getAbsolutePath());
+        _configuration.put(AuthenticationProvider.TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put("path", _emptyPasswordFile.getAbsolutePath());
 
         try
         {
-            _factory.createInstance(_broker, _configuration);
+            _factory.createInstance(_broker, _configuration, false);
         }
         catch (RuntimeException re)
         {
@@ -78,23 +83,30 @@ public class Base64MD5PasswordFileAuthen
 
     public void testReturnsNullWhenNoConfig() throws Exception
     {
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNull(manager);
     }
 
     public void testReturnsNullWhenConfigForOtherAuthManagerType() throws Exception
     {
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_TYPE, "other-auth-manager");
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        _configuration.put(AuthenticationProvider.TYPE, "other-auth-manager");
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNull(manager);
     }
 
-    public void testReturnsNullWhenConfigForPlainPDImplementationNoPasswordFileValueSpecified() throws Exception
+    public void testThrowsExceptionWhenConfigForPlainPDImplementationNoPasswordFileValueSpecified() throws Exception
     {
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put(AuthenticationProvider.TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
 
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
-        assertNull(manager);
+        try
+        {
+            AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
+            fail("No authentication manager should be created");
+        }
+        catch(IllegalArgumentException e)
+        {
+            // pass
+        }
     }
 
     @Override

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationManagerTest.java Mon Mar  3 01:59:53 2014
@@ -19,19 +19,43 @@
 package org.apache.qpid.server.security.auth.manager;
 
 import static org.apache.qpid.server.security.auth.AuthenticatedPrincipalTestHelper.assertOnlyContainsWrapped;
+import static org.mockito.Mockito.mock;
 
 import javax.security.auth.x500.X500Principal;
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.test.utils.QpidTestCase;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
 public class ExternalAuthenticationManagerTest extends QpidTestCase
 {
-    private AuthenticationManager _manager = new ExternalAuthenticationManager(false);
-    private AuthenticationManager _managerUsingFullDN = new ExternalAuthenticationManager(true);
+    private AuthenticationManager _manager;
+    private AuthenticationManager _managerUsingFullDN;
+
+    @Override
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        Map<String,Object> attrs = new HashMap<String, Object>();
+        attrs.put(AuthenticationProvider.ID, UUID.randomUUID());
+        attrs.put(AuthenticationProvider.NAME, getTestName());
+        attrs.put("useFullDN",false);
+        _manager = new ExternalAuthenticationManager(mock(Broker.class), Collections.<String,Object>emptyMap(), attrs);
+        HashMap<String, Object> attrsFullDN = new HashMap<String, Object>();
+        attrsFullDN.put(AuthenticationProvider.ID, UUID.randomUUID());
+        attrsFullDN.put(AuthenticationProvider.NAME, getTestName()+"FullDN");
+        attrsFullDN.put("useFullDN",true);
+        _managerUsingFullDN = new ExternalAuthenticationManager(mock(Broker.class), Collections.<String,Object>emptyMap(), attrsFullDN);
+    }
 
     public void testGetMechanisms() throws Exception
     {

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactoryTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactoryTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PlainPasswordFileAuthenticationManagerFactoryTest.java Mon Mar  3 01:59:53 2014
@@ -24,9 +24,11 @@ import static org.mockito.Mockito.mock;
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.UUID;
 
 import junit.framework.TestCase;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
@@ -44,14 +46,16 @@ public class PlainPasswordFileAuthentica
         super.setUp();
         _emptyPasswordFile = File.createTempFile(getName(), "passwd");
         _emptyPasswordFile.deleteOnExit();
+        _configuration.put(AuthenticationProvider.ID, UUID.randomUUID());
+        _configuration.put(AuthenticationProvider.NAME, getName());
     }
 
     public void testPlainInstanceCreated() throws Exception
     {
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_TYPE, PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _emptyPasswordFile.getAbsolutePath());
+        _configuration.put(AuthenticationProvider.TYPE, PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put("path", _emptyPasswordFile.getAbsolutePath());
 
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNotNull(manager);
         assertTrue(manager instanceof PrincipalDatabaseAuthenticationManager);
         assertTrue(((PrincipalDatabaseAuthenticationManager)manager).getPrincipalDatabase() instanceof PlainPasswordFilePrincipalDatabase);
@@ -62,10 +66,11 @@ public class PlainPasswordFileAuthentica
         //delete the file
         _emptyPasswordFile.delete();
 
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_TYPE, PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _emptyPasswordFile.getAbsolutePath());
+        _configuration.put(AuthenticationProvider.TYPE, PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put("path", _emptyPasswordFile.getAbsolutePath());
 
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
 
         assertNotNull(manager);
         assertTrue(manager instanceof PrincipalDatabaseAuthenticationManager);
@@ -74,23 +79,30 @@ public class PlainPasswordFileAuthentica
 
     public void testReturnsNullWhenNoConfig() throws Exception
     {
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNull(manager);
     }
 
     public void testReturnsNullWhenConfigForOtherAuthManagerType() throws Exception
     {
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_TYPE, "other-auth-manager");
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        _configuration.put(AuthenticationProvider.TYPE, "other-auth-manager");
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNull(manager);
     }
 
-    public void testReturnsNullWhenConfigForPlainPDImplementationNoPasswordFileValueSpecified() throws Exception
+    public void testThrowsExceptionWhenConfigForPlainPDImplementationNoPasswordFileValueSpecified() throws Exception
     {
-        _configuration.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_TYPE, PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put(AuthenticationProvider.TYPE, PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
 
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
-        assertNull(manager);
+        try
+        {
+            AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
+            fail("No authentication manager should be created");
+        }
+        catch (IllegalArgumentException e)
+        {
+            // pass;
+        }
     }
 
     @Override

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManagerTest.java Mon Mar  3 01:59:53 2014
@@ -28,8 +28,11 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.security.Principal;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 import javax.security.auth.callback.CallbackHandler;
 import javax.security.sasl.SaslException;
@@ -37,12 +40,13 @@ import javax.security.sasl.SaslServer;
 import javax.security.sasl.SaslServerFactory;
 
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.model.Broker;
+import org.apache.qpid.server.model.ConfiguredObject;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus;
 import org.apache.qpid.server.security.auth.UsernamePrincipal;
 import org.apache.qpid.server.security.auth.database.PlainPasswordFilePrincipalDatabase;
 import org.apache.qpid.server.security.auth.database.PrincipalDatabase;
-import org.apache.qpid.server.security.auth.sasl.UsernamePasswordInitialiser;
 import org.apache.qpid.test.utils.QpidTestCase;
 
 /**
@@ -91,15 +95,32 @@ public class PrincipalDatabaseAuthentica
         when(_principalDatabase.getMechanisms()).thenReturn(MOCK_MECH_NAME);
         when(_principalDatabase.createSaslServer(MOCK_MECH_NAME, LOCALHOST, null)).thenReturn(new MySaslServer(false, true));
 
-        _manager = new PrincipalDatabaseAuthenticationManager(_principalDatabase, _passwordFileLocation);
+        setupManager(false);
+
         _manager.initialise();
     }
 
+    private void setupManager(final boolean recovering)
+    {
+        Map<String,Object> attrs = new HashMap<String, Object>();
+        attrs.put(ConfiguredObject.ID, UUID.randomUUID());
+        attrs.put(ConfiguredObject.NAME, getTestName());
+        attrs.put("path", _passwordFileLocation);
+        _manager = new PrincipalDatabaseAuthenticationManager(mock(Broker.class), Collections.<String,Object>emptyMap(), attrs, recovering)
+        {
+            @Override
+            protected PrincipalDatabase createDatabase()
+            {
+                return _principalDatabase;
+            }
+
+        };
+    }
+
     public void testInitialiseWhenPasswordFileNotFound() throws Exception
     {
         _principalDatabase = new PlainPasswordFilePrincipalDatabase();
-        _manager = new PrincipalDatabaseAuthenticationManager(_principalDatabase, _passwordFileLocation);
-
+        setupManager(true);
         try
         {
             _manager.initialise();
@@ -114,7 +135,7 @@ public class PrincipalDatabaseAuthentica
     public void testInitialiseWhenPasswordFileExists() throws Exception
     {
         _principalDatabase = new PlainPasswordFilePrincipalDatabase();
-        _manager = new PrincipalDatabaseAuthenticationManager(_principalDatabase, _passwordFileLocation);
+        setupManager(true);
 
         File f = new File(_passwordFileLocation);
         f.createNewFile();
@@ -230,7 +251,6 @@ public class PrincipalDatabaseAuthentica
     {
         setupMocks();
 
-        _manager.onCreate();
         assertTrue("Password file was not created", new File(_passwordFileLocation).exists());
     }
 
@@ -238,10 +258,9 @@ public class PrincipalDatabaseAuthentica
     {
         setupMocks();
 
-        _manager.onCreate();
         assertTrue("Password file was not created", new File(_passwordFileLocation).exists());
 
-        _manager.onDelete();
+        _manager.delete();
         assertFalse("Password file was not deleted", new File(_passwordFileLocation).exists());
     }
 

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManagerTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManagerTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManagerTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleAuthenticationManagerTest.java Mon Mar  3 01:59:53 2014
@@ -21,17 +21,25 @@
 package org.apache.qpid.server.security.auth.manager;
 
 import java.security.Principal;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
+import java.util.UUID;
 
 import javax.security.sasl.SaslException;
 import javax.security.sasl.SaslServer;
 
+import org.apache.qpid.server.model.AuthenticationProvider;
+import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.security.auth.AuthenticationResult;
 import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus;
 import org.apache.qpid.server.security.auth.sasl.SaslUtil;
 import org.apache.qpid.server.security.auth.sasl.plain.PlainSaslServer;
 import org.apache.qpid.test.utils.QpidTestCase;
 
+import static org.mockito.Mockito.mock;
+
 public class SimpleAuthenticationManagerTest extends QpidTestCase
 {
     private static final String TEST_USER = "testUser";
@@ -41,7 +49,13 @@ public class SimpleAuthenticationManager
     public void setUp() throws Exception
     {
         super.setUp();
-        _authenticationManager = new SimpleAuthenticationManager(TEST_USER, TEST_PASSWORD);
+        Map<String,Object> authManagerAttrs = new HashMap<String, Object>();
+        authManagerAttrs.put(AuthenticationProvider.NAME,"MANAGEMENT_MODE_AUTHENTICATION");
+        authManagerAttrs.put(AuthenticationProvider.ID, UUID.randomUUID());
+        final SimpleAuthenticationManager authManager = new SimpleAuthenticationManager(mock(Broker.class), Collections.<String,Object>emptyMap(),authManagerAttrs);
+        authManager.addUser(TEST_USER, TEST_PASSWORD);
+        _authenticationManager = authManager;
+
     }
 
     public void testGetMechanisms()

Modified: qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java (original)
+++ qpid/trunk/qpid/java/broker-core/src/test/java/org/apache/qpid/server/security/auth/manager/SimpleLDAPAuthenticationManagerFactoryTest.java Mon Mar  3 01:59:53 2014
@@ -20,14 +20,17 @@
 package org.apache.qpid.server.security.auth.manager;
 
 
+import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.verifyZeroInteractions;
 
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.UUID;
 
 import org.apache.qpid.server.configuration.IllegalConfigurationException;
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.TrustStore;
 
@@ -41,66 +44,76 @@ public class SimpleLDAPAuthenticationMan
     private Broker _broker = mock(Broker.class);
     private TrustStore _trustStore = mock(TrustStore.class);
 
+    public void setUp() throws Exception
+    {
+        super.setUp();
+
+        when(_trustStore.getName()).thenReturn("mytruststore");
+        when(_trustStore.getId()).thenReturn(UUID.randomUUID());
+
+        _configuration.put(AuthenticationProvider.ID, UUID.randomUUID());
+        _configuration.put(AuthenticationProvider.NAME, getName());
+    }
+
     public void testLdapInstanceCreated() throws Exception
     {
-        _configuration.put(SimpleLDAPAuthenticationManagerFactory.ATTRIBUTE_TYPE, SimpleLDAPAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put(AuthenticationProvider.TYPE, SimpleLDAPAuthenticationManagerFactory.PROVIDER_TYPE);
         _configuration.put("providerUrl", "ldap://example.com:389/");
         _configuration.put("searchContext", "dc=example");
 
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNotNull(manager);
 
-        verifyZeroInteractions(_broker);
     }
 
     public void testLdapsInstanceCreated() throws Exception
     {
-        _configuration.put(SimpleLDAPAuthenticationManagerFactory.ATTRIBUTE_TYPE, SimpleLDAPAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put(AuthenticationProvider.TYPE, SimpleLDAPAuthenticationManagerFactory.PROVIDER_TYPE);
         _configuration.put("providerUrl", "ldaps://example.com:636/");
         _configuration.put("searchContext", "dc=example");
 
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNotNull(manager);
 
-        verifyZeroInteractions(_broker);
     }
 
     public void testLdapsWithTrustStoreInstanceCreated() throws Exception
     {
-        when(_broker.findTrustStoreByName("mytruststore")).thenReturn(_trustStore);
+        when(_broker.getChildren(eq(TrustStore.class))).thenReturn(Collections.singletonList(_trustStore));
+
 
-        _configuration.put(SimpleLDAPAuthenticationManagerFactory.ATTRIBUTE_TYPE, SimpleLDAPAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put(AuthenticationProvider.TYPE, SimpleLDAPAuthenticationManagerFactory.PROVIDER_TYPE);
         _configuration.put("providerUrl", "ldaps://example.com:636/");
         _configuration.put("searchContext", "dc=example");
         _configuration.put("trustStore", "mytruststore");
 
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNotNull(manager);
     }
 
     public void testLdapsWhenTrustStoreNotFound() throws Exception
     {
-        when(_broker.findTrustStoreByName("notfound")).thenReturn(null);
+        when(_broker.getChildren(eq(TrustStore.class))).thenReturn(Collections.singletonList(_trustStore));
 
-        _configuration.put(SimpleLDAPAuthenticationManagerFactory.ATTRIBUTE_TYPE, SimpleLDAPAuthenticationManagerFactory.PROVIDER_TYPE);
+        _configuration.put(AuthenticationProvider.TYPE, SimpleLDAPAuthenticationManagerFactory.PROVIDER_TYPE);
         _configuration.put("providerUrl", "ldaps://example.com:636/");
         _configuration.put("searchContext", "dc=example");
         _configuration.put("trustStore", "notfound");
 
         try
         {
-            _factory.createInstance(_broker, _configuration);
+            _factory.createInstance(_broker, _configuration, false);
             fail("Exception not thrown");
         }
-        catch(IllegalConfigurationException e)
+        catch(IllegalArgumentException e)
         {
-            assertEquals("Can't find truststore with name 'notfound'", e.getMessage());
+            assertEquals("Cannot find a TrustStore with name 'notfound'", e.getMessage());
         }
     }
 
     public void testReturnsNullWhenNoConfig() throws Exception
     {
-        AuthenticationManager manager = _factory.createInstance(_broker, _configuration);
+        AuthenticationManager manager = _factory.createInstance(_broker, _configuration, false);
         assertNull(manager);
     }
 }

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/ExternalAuthenticationTest.java Mon Mar  3 01:59:53 2014
@@ -45,7 +45,6 @@ import org.apache.qpid.server.model.Auth
 import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.Transport;
 import org.apache.qpid.server.model.TrustStore;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.test.utils.JMXTestUtils;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -349,7 +348,7 @@ public class ExternalAuthenticationTest 
 
         Map<String, Object> externalAuthProviderAttributes = new HashMap<String, Object>();
         externalAuthProviderAttributes.put(AuthenticationProvider.NAME, TestBrokerConfiguration.ENTRY_NAME_EXTERNAL_PROVIDER);
-        externalAuthProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, ExternalAuthenticationManagerFactory.PROVIDER_TYPE);
+        externalAuthProviderAttributes.put(AuthenticationProvider.TYPE, ExternalAuthenticationManagerFactory.PROVIDER_TYPE);
         config.addAuthenticationProviderConfiguration(externalAuthProviderAttributes);
 
         config.setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_SSL_PORT, Port.AUTHENTICATION_PROVIDER, TestBrokerConfiguration.ENTRY_NAME_EXTERNAL_PROVIDER);

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/server/security/auth/manager/MultipleAuthenticationManagersTest.java Mon Mar  3 01:59:53 2014
@@ -36,7 +36,6 @@ import org.apache.qpid.client.AMQConnect
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Port;
 import org.apache.qpid.server.model.Transport;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
@@ -48,7 +47,7 @@ public class MultipleAuthenticationManag
         TestBrokerConfiguration config = getBrokerConfiguration();
 
         Map<String, Object> externalAuthProviderAttributes = new HashMap<String, Object>();
-        externalAuthProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE);
+        externalAuthProviderAttributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE);
         externalAuthProviderAttributes.put(AuthenticationProvider.NAME, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
         config.addAuthenticationProviderConfiguration(externalAuthProviderAttributes);
 

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/management/jmx/UserManagementTest.java Mon Mar  3 01:59:53 2014
@@ -30,8 +30,7 @@ import javax.jms.Connection;
 import javax.jms.JMSException;
 
 import org.apache.qpid.management.common.mbeans.UserManagement;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
-import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory;
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.security.auth.manager.PlainPasswordFileAuthenticationManagerFactory;
 import org.apache.qpid.test.utils.JMXTestUtils;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
@@ -58,8 +57,8 @@ public class UserManagementTest extends 
         _passwordFile = createTemporaryPasswordFileWithJmxAdminUser();
 
         Map<String, Object> newAttributes = new HashMap<String, Object>();
-        newAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, getAuthenticationManagerType());
-        newAttributes.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _passwordFile.getAbsolutePath());
+        newAttributes.put(AuthenticationProvider.TYPE, getAuthenticationManagerType());
+        newAttributes.put("path", _passwordFile.getAbsolutePath());
         getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes);
         getBrokerConfiguration().addJmxManagementConfiguration();
 

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AnonymousAccessRestTest.java Mon Mar  3 01:59:53 2014
@@ -29,7 +29,6 @@ import org.apache.qpid.server.management
 import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.model.Broker;
 import org.apache.qpid.server.model.Port;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManagerFactory;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
@@ -53,7 +52,7 @@ public class AnonymousAccessRestTest ext
         TestBrokerConfiguration config = getBrokerConfiguration();
 
         Map<String, Object> anonymousAuthProviderAttributes = new HashMap<String, Object>();
-        anonymousAuthProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE);
+        anonymousAuthProviderAttributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE);
         anonymousAuthProviderAttributes.put(AuthenticationProvider.NAME, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
         config.addAuthenticationProviderConfiguration(anonymousAuthProviderAttributes);
 

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PortRestTest.java Mon Mar  3 01:59:53 2014
@@ -35,7 +35,6 @@ import org.apache.qpid.server.model.Port
 import org.apache.qpid.server.model.Protocol;
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.Transport;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManagerFactory;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
 
@@ -153,7 +152,7 @@ public class PortRestTest extends QpidRe
         Asserts.assertPortAttributes(port);
 
         Map<String, Object> authProviderAttributes = new HashMap<String, Object>();
-        authProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE);
+        authProviderAttributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE);
         authProviderAttributes.put(AuthenticationProvider.NAME, TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER);
 
         responseCode = getRestTestHelper().submitRequest("/rest/authenticationprovider/" + TestBrokerConfiguration.ENTRY_NAME_ANONYMOUS_PROVIDER, "PUT", authProviderAttributes);

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java Mon Mar  3 01:59:53 2014
@@ -35,7 +35,6 @@ import org.apache.qpid.server.model.Pref
 import org.apache.qpid.server.model.State;
 import org.apache.qpid.server.model.adapter.AbstractConfiguredObject;
 import org.apache.qpid.server.model.adapter.FileSystemPreferencesProvider;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
 import org.apache.qpid.server.security.auth.manager.PlainPasswordFileAuthenticationManagerFactory;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.test.utils.TestFileUtils;
@@ -76,7 +75,7 @@ public class PreferencesProviderRestTest
     {
         super.customizeConfiguration();
         Map<String, Object> anonymousAuthProviderAttributes = new HashMap<String, Object>();
-        anonymousAuthProviderAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        anonymousAuthProviderAttributes.put(AuthenticationProvider.TYPE, PlainPasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
         anonymousAuthProviderAttributes.put(AuthenticationProvider.NAME,  TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER + "-2");
         anonymousAuthProviderAttributes.put(PlainPasswordFileAuthenticationManagerFactory.ATTRIBUTE_PATH, _authenticationProviderFile.getAbsolutePath());
         getBrokerConfiguration().addAuthenticationProviderConfiguration(anonymousAuthProviderAttributes);

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/RestTestHelper.java Mon Mar  3 01:59:53 2014
@@ -55,7 +55,6 @@ import org.apache.commons.codec.binary.B
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.log4j.Logger;
 import org.apache.qpid.server.BrokerOptions;
-import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory;
 import org.apache.qpid.ssl.SSLContextFactory;
 import org.apache.qpid.test.utils.QpidBrokerTestCase;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
@@ -443,7 +442,7 @@ public class RestTestHelper
         _passwdFile = createTemporaryPasswdFile(users);
 
         testCase.getBrokerConfiguration().setObjectAttribute(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER,
-                AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, _passwdFile.getAbsolutePath());
+                "path", _passwdFile.getAbsolutePath());
     }
 
     public void tearDown()

Modified: qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java?rev=1573421&r1=1573420&r2=1573421&view=diff
==============================================================================
--- qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java (original)
+++ qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/SaslRestTest.java Mon Mar  3 01:59:53 2014
@@ -36,8 +36,7 @@ import java.util.Map;
 
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.configuration.ConfigurationException;
-import org.apache.qpid.server.plugin.AuthenticationManagerFactory;
-import org.apache.qpid.server.security.auth.manager.AbstractPrincipalDatabaseAuthManagerFactory;
+import org.apache.qpid.server.model.AuthenticationProvider;
 import org.apache.qpid.server.security.auth.manager.Base64MD5PasswordFileAuthenticationManagerFactory;
 import org.apache.qpid.test.utils.TestBrokerConfiguration;
 import org.apache.qpid.tools.security.Passwd;
@@ -378,8 +377,8 @@ public class SaslRestTest extends QpidRe
 
         // configure broker to use Base64MD5PasswordFilePrincipalDatabase
         Map<String, Object> newAttributes = new HashMap<String, Object>();
-        newAttributes.put(AbstractPrincipalDatabaseAuthManagerFactory.ATTRIBUTE_PATH, passwordFile.getAbsolutePath());
-        newAttributes.put(AuthenticationManagerFactory.ATTRIBUTE_TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
+        newAttributes.put("path", passwordFile.getAbsolutePath());
+        newAttributes.put(AuthenticationProvider.TYPE, Base64MD5PasswordFileAuthenticationManagerFactory.PROVIDER_TYPE);
         getBrokerConfiguration().setObjectAttributes(TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER, newAttributes);
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message