test_class.declarator: oneopsAuthBroker
test_class.modifier: private
test_class.original_string: private OneopsAuthBroker oneopsAuthBroker;
test_class.type: OneopsAuthBroker
test_class.var_name: oneopsAuthBroker
test_class.declarator: cmsClient
test_class.modifier: private
test_class.original_string: private CMSClient cmsClient;
test_class.type: CMSClient
test_class.var_name: cmsClient
test_class.declarator: connectionInfoSystem
test_class.modifier: private
test_class.original_string: private ConnectionInfo connectionInfoSystem;
test_class.type: ConnectionInfo
test_class.var_name: connectionInfoSystem
test_class.declarator: connectionInfoUser
test_class.modifier: private
test_class.original_string: private ConnectionInfo connectionInfoUser;
test_class.type: ConnectionInfo
test_class.var_name: connectionInfoUser
test_class.declarator: connectionBadInfo
test_class.modifier: private
test_class.original_string: private ConnectionInfo connectionBadInfo;
test_class.type: ConnectionInfo
test_class.var_name: connectionBadInfo
test_class.declarator: connectionContextSystem
test_class.modifier: private
test_class.original_string: private ConnectionContext connectionContextSystem;
test_class.type: ConnectionContext
test_class.var_name: connectionContextSystem
test_class.declarator: connectionContextMock
test_class.modifier: private
test_class.original_string: private ConnectionContext connectionContextMock;
test_class.type: ConnectionContext
test_class.var_name: connectionContextMock
test_class.declarator: consumerInfo
test_class.modifier: private
test_class.original_string: private ConsumerInfo consumerInfo;
test_class.type: ConsumerInfo
test_class.var_name: consumerInfo
test_class.declarator: activeMQDestination
test_class.modifier: private
test_class.original_string: private ActiveMQDestination  activeMQDestination;
test_class.type: ActiveMQDestination
test_class.var_name: activeMQDestination
test_class.declarator: producerInfo
test_class.modifier: private
test_class.original_string: private ProducerInfo producerInfo;
test_class.type: ProducerInfo
test_class.var_name: producerInfo
test_class.declarator: AUTH_KEY_VALUE = "blahblah"
test_class.modifier: private static final
test_class.original_string: private static final String AUTH_KEY_VALUE = "blahblah";
test_class.type: String
test_class.var_name: AUTH_KEY_VALUE
test_class.declarator: CONN_INFO_PASS_BAD = "foobarbizbat"
test_class.modifier: private static final
test_class.original_string: private static final String CONN_INFO_PASS_BAD = "foobarbizbat";
test_class.type: String
test_class.var_name: CONN_INFO_PASS_BAD
test_class.declarator: CLOUD_NAME = "stubbedCloudName"
test_class.modifier: private static final
test_class.original_string: private static final String CLOUD_NAME = "stubbedCloudName";
test_class.type: String
test_class.var_name: CLOUD_NAME
test_class.declarator: SYSTEM_CLIENT_ID = "system"
test_class.modifier: private static final
test_class.original_string: private static final String SYSTEM_CLIENT_ID = "system";
test_class.type: String
test_class.var_name: SYSTEM_CLIENT_ID
test_class.declarator: MOCK_CLIENT_ID = "stubbedClientId"
test_class.modifier: private static final
test_class.original_string: private static final String MOCK_CLIENT_ID = "stubbedClientId";
test_class.type: String
test_class.var_name: MOCK_CLIENT_ID
test_class.declarator: MOCK_REMOTE_ADDR = "stubbedRemoteAddr"
test_class.modifier: private static final
test_class.original_string: private static final String MOCK_REMOTE_ADDR = "stubbedRemoteAddr";
test_class.type: String
test_class.var_name: MOCK_REMOTE_ADDR
test_class.declarator: MOCK_PHYSICAL_NAME = "controller.response"
test_class.modifier: private static final
test_class.original_string: private static final String MOCK_PHYSICAL_NAME = "controller.response";
test_class.type: String
test_class.var_name: MOCK_PHYSICAL_NAME
test_class.declarator: MQ_PHYSICAL_NAME = "ActiveMQ.dest"
test_class.modifier: private static final
test_class.original_string: private static final String MQ_PHYSICAL_NAME = "ActiveMQ.dest";
test_class.type: String
test_class.var_name: MQ_PHYSICAL_NAME
test_class.declarator: AUTH_ATTR_KEY = "auth"
test_class.modifier: private static final
test_class.original_string: private static final String AUTH_ATTR_KEY = "auth";
test_class.type: String
test_class.var_name: AUTH_ATTR_KEY
test_class.declarator: logger = Logger.getLogger(OneopsAuthBrokerTest.class)
test_class.modifier: private static
test_class.original_string: private static Logger logger = Logger.getLogger(OneopsAuthBrokerTest.class);
test_class.type: Logger
test_class.var_name: logger
test_class.file: amq-plugin/src/test/java/com/oneops/amq/plugins/OneopsAuthBrokerTest.java
test_class.identifier: OneopsAuthBrokerTest
test_case.body: @Test(priority=5, expectedExceptions=RuntimeException.class)
  	public void addConsumerTestDenied(){
  		
  		try {
  			this.oneopsAuthBroker.addConsumer(connectionContextMock, consumerInfo);
  		} catch (Exception e) {
  			logger.warn("caught exception, make sure Broker is mocked",e);
  			throw new RuntimeException(e);
  		}
  		
  	}
test_case.class_method_signature: OneopsAuthBrokerTest.addConsumerTestDenied()
test_case.full_signature: @Test(priority=5, expectedExceptions=RuntimeException.class) public void addConsumerTestDenied()
test_case.identifier: addConsumerTestDenied
test_case.invocations: addConsumer warn
test_case.modifiers: @Test(priority=5, expectedExceptions=RuntimeException.class) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void addConsumerTestDenied()
focal_class.declarator: logger = Logger.getLogger(OneopsAuthBroker.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = Logger.getLogger(OneopsAuthBroker.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: SUPER_USER = "superuser"
focal_class.modifier: private static final
focal_class.original_string: private static final String SUPER_USER = "superuser";
focal_class.type: String
focal_class.var_name: SUPER_USER
focal_class.declarator: SYSTEM_USER = "system"
focal_class.modifier: private static final
focal_class.original_string: private static final String SYSTEM_USER = "system";
focal_class.type: String
focal_class.var_name: SYSTEM_USER
focal_class.declarator: QUEUE_SUFFIX = ".ind-wo"
focal_class.modifier: private static final
focal_class.original_string: private static final String QUEUE_SUFFIX = ".ind-wo";
focal_class.type: String
focal_class.var_name: QUEUE_SUFFIX
focal_class.declarator: superpass = "-"
focal_class.modifier: private
focal_class.original_string: private String superpass = "-";
focal_class.type: String
focal_class.var_name: superpass
focal_class.declarator: cmsClient
focal_class.modifier: private
focal_class.original_string: private CMSClient cmsClient;
focal_class.type: CMSClient
focal_class.var_name: cmsClient
focal_class.declarator: userMap = new HashMap<String, String>()
focal_class.modifier: private
focal_class.original_string: private Map<String, String> userMap = new HashMap<String, String>();
focal_class.type: Map<String, String>
focal_class.var_name: userMap
focal_class.file: amq-plugin/src/main/java/com/oneops/amq/plugins/OneopsAuthBroker.java
focal_class.identifier: OneopsAuthBroker
focal_class.class_method_signature: OneopsAuthBroker.OneopsAuthBroker(Broker next, CMSClient cms)
focal_class.full_signature: public  OneopsAuthBroker(Broker next, CMSClient cms)
focal_class.identifier: OneopsAuthBroker
focal_class.modifiers: public
focal_class.parameters: (Broker next, CMSClient cms)
focal_class.signature:  OneopsAuthBroker(Broker next, CMSClient cms)
focal_class.class_method_signature: OneopsAuthBroker.addConnection(ConnectionContext context, ConnectionInfo info)
focal_class.full_signature: public void addConnection(ConnectionContext context, ConnectionInfo info)
focal_class.identifier: addConnection
focal_class.modifiers: public
focal_class.parameters: (ConnectionContext context, ConnectionInfo info)
focal_class.return: void
focal_class.signature: void addConnection(ConnectionContext context, ConnectionInfo info)
focal_class.class_method_signature: OneopsAuthBroker.addConsumer(ConnectionContext context, ConsumerInfo info)
focal_class.full_signature: public Subscription addConsumer(ConnectionContext context, ConsumerInfo info)
focal_class.identifier: addConsumer
focal_class.modifiers: public
focal_class.parameters: (ConnectionContext context, ConsumerInfo info)
focal_class.return: Subscription
focal_class.signature: Subscription addConsumer(ConnectionContext context, ConsumerInfo info)
focal_class.class_method_signature: OneopsAuthBroker.addProducer(ConnectionContext context, ProducerInfo info)
focal_class.full_signature: public void addProducer(ConnectionContext context, ProducerInfo info)
focal_class.identifier: addProducer
focal_class.modifiers: public
focal_class.parameters: (ConnectionContext context, ProducerInfo info)
focal_class.return: void
focal_class.signature: void addProducer(ConnectionContext context, ProducerInfo info)
focal_class.superclass: extends BrokerFilter
focal_method.body: public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
  
          ActiveMQDestination dest = info.getDestination();
          Connection conn = context.getConnection();
          if (dest != null) {
              String destName = info.getDestination().getPhysicalName();
              String clientId = context.getClientId();
              String allowedDest = userMap.get(clientId);
  
              logger.info(">>> Got Consumer Add request { Destination: " + destName
                      + ", Remote Address: " + conn.getRemoteAddress()
                      + ", ClientID: " + clientId
                      + " }");
              if (allowedDest != null && (allowedDest.equals("*") || allowedDest.equals(destName) || destName.startsWith("ActiveMQ"))) {
                  logger.info(">>> Subscription allowed");
              } else {
                  logger.error(">>> Destination not allowed. Subscription denied!");
                  throw new CmsAuthException(">>> Subscription denied!");
              }
          } else {
              logger.error("<<< Got Consumer Add request from Remote Address:" + conn.getRemoteAddress() + ". But destination is NULL.");
          }
          return super.addConsumer(context, info);
      }
focal_method.class_method_signature: OneopsAuthBroker.addConsumer(ConnectionContext context, ConsumerInfo info)
focal_method.full_signature: public Subscription addConsumer(ConnectionContext context, ConsumerInfo info)
focal_method.identifier: addConsumer
focal_method.invocations: getDestination getConnection getPhysicalName getDestination getClientId get info getRemoteAddress equals equals startsWith info error error getRemoteAddress addConsumer
focal_method.modifiers: public
focal_method.parameters: (ConnectionContext context, ConsumerInfo info)
focal_method.return: Subscription
focal_method.signature: Subscription addConsumer(ConnectionContext context, ConsumerInfo info)