Package org.apache.qpid.server.security

Examples of org.apache.qpid.server.security.SecurityManager$ClearingThreadLocal


        return mock(AMQConnectionModel.class);
    }

    public static ExchangeImpl<?> createExchange(String hostName, final boolean durable, final EventLogger eventLogger) throws Exception
    {
        SecurityManager securityManager = new SecurityManager(mock(Broker.class), false);
        final VirtualHostImpl<?,?,?> virtualHost = mock(VirtualHostImpl.class);
        when(virtualHost.getName()).thenReturn(hostName);
        when(virtualHost.getSecurityManager()).thenReturn(securityManager);
        when(virtualHost.getEventLogger()).thenReturn(eventLogger);
        when(virtualHost.getDurableConfigurationStore()).thenReturn(mock(DurableConfigurationStore.class));
View Full Code Here


    public void setUp() throws Exception
    {
        super.setUp();

        EventLogger eventLogger = mock(EventLogger.class);
        SecurityManager securityManager = mock(SecurityManager.class);
        when(securityManager.authoriseConfiguringBroker(anyString(),any(Class.class),any(Operation.class))).thenReturn(true);
        ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());

        _taskExecutor = new CurrentThreadTaskExecutor();
        _taskExecutor.start();
View Full Code Here

        super.setUp();

        _taskExecutor = new CurrentThreadTaskExecutor();
        _taskExecutor.start();
        _virtualHost = mock(VirtualHostImpl.class);
        SecurityManager securityManager = mock(SecurityManager.class);
        when(_virtualHost.getSecurityManager()).thenReturn(securityManager);
        when(_virtualHost.getEventLogger()).thenReturn(new EventLogger());
        when(_virtualHost.getCategoryClass()).thenReturn(VirtualHost.class);
        when(_virtualHost.getTaskExecutor()).thenReturn(_taskExecutor);
        _factory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
View Full Code Here

        attributes.put(Exchange.DURABLE, false);

        _taskExecutor = new CurrentThreadTaskExecutor();
        _taskExecutor.start();
        _virtualHost = mock(VirtualHostImpl.class);
        SecurityManager securityManager = mock(SecurityManager.class);
        when(_virtualHost.getSecurityManager()).thenReturn(securityManager);
        when(_virtualHost.getEventLogger()).thenReturn(new EventLogger());
        when(_virtualHost.getTaskExecutor()).thenReturn(_taskExecutor);
        when(_virtualHost.getModel()).thenReturn(BrokerModel.getInstance());
        _exchange = new FanoutExchange(attributes, _virtualHost);
View Full Code Here

    public void setUp() throws Exception
    {
        super.setUp();

        EventLogger eventLogger = mock(EventLogger.class);
        SecurityManager securityManager = mock(SecurityManager.class);
        TaskExecutor executor = CurrentThreadTaskExecutor.newStartedInstance();
        SystemConfig systemConfig = mock(SystemConfig.class);
        ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance());
        when(systemConfig.getObjectFactory()).thenReturn(objectFactory);
        when(systemConfig.getModel()).thenReturn(objectFactory.getModel());
View Full Code Here

        assertNull("Description unexpected updated", node.getDescription());
    }

    public void testDeleteVHNDeniedByACL() throws Exception
    {
        SecurityManager mockSecurityManager = mock(SecurityManager.class);
        when(_broker.getSecurityManager()).thenReturn(mockSecurityManager);

        DurableConfigurationStore configStore = configStoreThatProducesNoRecords();

        Map<String, Object> nodeAttributes = new HashMap<>();
View Full Code Here

        assertEquals("Virtual host node state changed unexpectedly", State.ACTIVE, node.getState());
    }

    public void testStopVHNDeniedByACL() throws Exception
    {
        SecurityManager mockSecurityManager = mock(SecurityManager.class);
        when(_broker.getSecurityManager()).thenReturn(mockSecurityManager);

        DurableConfigurationStore configStore = configStoreThatProducesNoRecords();

        Map<String, Object> nodeAttributes = new HashMap<>();
View Full Code Here

        }

        methodName = getMethodName(method, args);
        Operation operation = (isAccessMethod(methodName) || impact == MBeanOperationInfo.INFO) ? Operation.ACCESS : Operation.UPDATE;

        SecurityManager security = _broker.getSecurityManager();
        security.authoriseMethod(operation, type, methodName, virtualHostName);

        if (_managementRightsInferAllAccess)
        {
            try
            {
View Full Code Here

    public void setPublishFrame(MessagePublishInfo info, final MessageDestination e)
    {
        String routingKey = info.getRoutingKey() == null ? null : info.getRoutingKey().asString();
        VirtualHostImpl virtualHost = getVirtualHost();
        SecurityManager securityManager = virtualHost.getSecurityManager();

        securityManager.authorisePublish(info.isImmediate(), routingKey, e.getName(), virtualHost.getName());

        _currentMessage = new IncomingMessage(info);
        _currentMessage.setMessageDestination(e);
    }
View Full Code Here

            String type = getType(method, args);
            String vhost = getVirtualHost(method, args);
            int impact = getImpact(method, args);
           
            // Get the security manager for the virtual host (if set)
            SecurityManager security;
            if (vhost == null)
            {
                security = ApplicationRegistry.getInstance().getSecurityManager();
            }
            else
            {
                security = ApplicationRegistry.getInstance().getVirtualHostRegistry().getVirtualHost(vhost).getSecurityManager();
            }
           
      if (isAccessMethod(methodName) || impact == MBeanOperationInfo.INFO)
      {
        // Check for read-only method invocation permission
                if (!security.authoriseMethod(Operation.ACCESS, type, methodName))
                {
                    throw new SecurityException("Permission denied: Access " + methodName);
                }
      }
      else if (isUpdateMethod(methodName))
            {
              // Check for setting properties permission
                if (!security.authoriseMethod(Operation.UPDATE, type, methodName))
                {
                    throw new SecurityException("Permission denied: Update " + methodName);
                }
            }
      else
            {
              // Check for invoking/executing method action/operation permission
                if (!security.authoriseMethod(Operation.EXECUTE, type, methodName))
                {
                    throw new SecurityException("Permission denied: Execute " + methodName);
                }
            }
     
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.security.SecurityManager$ClearingThreadLocal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.