diff options
author | Martin Ritchie <ritchiem@apache.org> | 2009-04-13 14:03:55 +0000 |
---|---|---|
committer | Martin Ritchie <ritchiem@apache.org> | 2009-04-13 14:03:55 +0000 |
commit | e9564bb6002741d38090a7a04cf4649ba6c7958c (patch) | |
tree | ec2d942c0c2001b17f906fa9aef2e954c63e745c | |
parent | cbafa89d9bca60334e44a4a850374175dc4a843d (diff) | |
download | qpid-python-e9564bb6002741d38090a7a04cf4649ba6c7958c.tar.gz |
QPID-1626: handle legacy config file a bit more gracefully.
merged from trunk r754958
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/0.5-fix@764473 13f79535-47bb-0310-9956-ffa450edef68
2 files changed, 73 insertions, 0 deletions
diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java index 5d8fa3e9d7..dbfcefb6ab 100644 --- a/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java @@ -34,6 +34,7 @@ import org.apache.qpid.server.security.access.ACLPlugin; import org.apache.qpid.server.security.access.ACLPluginFactory; import org.apache.qpid.server.security.access.plugins.AllowAll; import org.apache.qpid.server.security.access.plugins.DenyAll; +import org.apache.qpid.server.security.access.plugins.LegacyAccessPlugin; import org.apache.qpid.server.security.access.plugins.SimpleXML; import org.apache.qpid.server.security.access.plugins.network.FirewallPlugin; import org.osgi.framework.BundleActivator; @@ -166,6 +167,7 @@ public class PluginManager _securityPlugins.put(SimpleXML.class.getName(), SimpleXML.FACTORY); _securityPlugins.put(AllowAll.class.getName(), AllowAll.FACTORY); _securityPlugins.put(DenyAll.class.getName(), DenyAll.FACTORY); + _securityPlugins.put(LegacyAccessPlugin.class.getName(), LegacyAccessPlugin.FACTORY); _securityPlugins.put(FirewallPlugin.class.getName(), FirewallPlugin.FACTORY); } return _securityPlugins; diff --git a/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/LegacyAccessPlugin.java b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/LegacyAccessPlugin.java new file mode 100644 index 0000000000..fc1bc048d4 --- /dev/null +++ b/qpid/java/broker/src/main/java/org/apache/qpid/server/security/access/plugins/LegacyAccessPlugin.java @@ -0,0 +1,71 @@ +/* + * 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.access.plugins; + +import java.util.Collection; +import java.util.HashSet; + +import org.apache.commons.configuration.Configuration; +import org.apache.qpid.server.security.access.ACLPlugin; +import org.apache.qpid.server.security.access.ACLPluginFactory; + +/** + * + * Used to suppress warnings in legacy config files that have things in <security> which aren't handled by a plugin directly. + * + */ +public class LegacyAccessPlugin extends BasicACLPlugin +{ + public static final ACLPluginFactory FACTORY = new ACLPluginFactory() + { + private Collection maskedTags = new HashSet<String>(); + { + maskedTags.add("principal-databases"); + maskedTags.add("access"); + maskedTags.add("msg-auth"); + maskedTags.add("false"); + maskedTags.add("jmx"); + } + + public boolean supportsTag(String name) + { + return maskedTags .contains(name); + } + + public ACLPlugin newInstance(Configuration config) + { + return new LegacyAccessPlugin(); + } + }; + + public String getPluginName() + { + return getClass().getSimpleName(); + } + + @Override + protected AuthzResult getResult() + { + // Always abstain + return AuthzResult.ABSTAIN; + } + +} |