Removing dead code - AMQSEcurityContext
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/e850e135 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/e850e135 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/e850e135 Branch: refs/heads/master Commit: e850e1351d5f3cb04eb84f6e63c4ec83da8df366 Parents: 738b15d Author: Clebert Suconic <[email protected]> Authored: Fri Aug 28 14:54:27 2015 -0400 Committer: Clebert Suconic <[email protected]> Committed: Fri Aug 28 15:05:44 2015 -0400 ---------------------------------------------------------------------- .../openwire/amq/AMQConnectionContext.java | 16 ---- .../openwire/amq/AMQSecurityContext.java | 83 -------------------- 2 files changed, 99 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e850e135/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java index 54501e9..864ccb8 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConnectionContext.java @@ -33,7 +33,6 @@ public class AMQConnectionContext { private AMQConnector connector; private OpenWireProtocolManager broker; //use protocol manager to represent the broker private boolean inRecoveryMode; - private AMQSecurityContext securityContext; private ConnectionId connectionId; private String clientId; private String userName; @@ -71,7 +70,6 @@ public class AMQConnectionContext { rc.connector = this.connector; rc.broker = this.broker; rc.inRecoveryMode = this.inRecoveryMode; - rc.securityContext = this.securityContext; rc.connectionId = this.connectionId; rc.clientId = this.clientId; rc.userName = this.userName; @@ -87,20 +85,6 @@ public class AMQConnectionContext { return rc; } - public AMQSecurityContext getSecurityContext() { - return securityContext; - } - - public void setSecurityContext(AMQSecurityContext subject) { - this.securityContext = subject; - if (subject != null) { - setUserName(subject.getUserName()); - } - else { - setUserName(null); - } - } - /** * @return the broker being used. */ http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e850e135/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSecurityContext.java ---------------------------------------------------------------------- diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSecurityContext.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSecurityContext.java deleted file mode 100644 index 539e18e..0000000 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSecurityContext.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.activemq.artemis.core.protocol.openwire.amq; - -import java.security.Principal; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; - -import org.apache.activemq.command.ActiveMQDestination; - -public abstract class AMQSecurityContext { - - public static final AMQSecurityContext BROKER_SECURITY_CONTEXT = new AMQSecurityContext("ActiveMQBroker") { - @Override - public boolean isBrokerContext() { - return true; - } - - public Set<Principal> getPrincipals() { - return Collections.emptySet(); - } - }; - - final String userName; - - final ConcurrentMap<ActiveMQDestination, ActiveMQDestination> authorizedReadDests = new ConcurrentHashMap<ActiveMQDestination, ActiveMQDestination>(); - final ConcurrentMap<ActiveMQDestination, ActiveMQDestination> authorizedWriteDests = new ConcurrentHashMap<ActiveMQDestination, ActiveMQDestination>(); - - public AMQSecurityContext(String userName) { - this.userName = userName; - } - - public boolean isInOneOf(Set<?> allowedPrincipals) { - Iterator<?> allowedIter = allowedPrincipals.iterator(); - HashSet<?> userPrincipals = new HashSet<Object>(getPrincipals()); - while (allowedIter.hasNext()) { - Iterator<?> userIter = userPrincipals.iterator(); - Object allowedPrincipal = allowedIter.next(); - while (userIter.hasNext()) { - if (allowedPrincipal.equals(userIter.next())) - return true; - } - } - return false; - } - - public abstract Set<Principal> getPrincipals(); - - public String getUserName() { - return userName; - } - - public ConcurrentMap<ActiveMQDestination, ActiveMQDestination> getAuthorizedReadDests() { - return authorizedReadDests; - } - - public ConcurrentMap<ActiveMQDestination, ActiveMQDestination> getAuthorizedWriteDests() { - return authorizedWriteDests; - } - - public boolean isBrokerContext() { - return false; - } - -}
