Package org.apache.qpid.server.security.access

Examples of org.apache.qpid.server.security.access.ObjectProperties


    {
        return checkAllPlugins(new AccessCheck()
        {
            Result allowed(SecurityPlugin plugin)
            {
                return plugin.authorise(PUBLISH, EXCHANGE, new ObjectProperties(exchangeName, routingKey, immediate));
            }
        });
    }
View Full Code Here


    {
        return checkAllPlugins(new AccessCheck()
        {
            Result allowed(SecurityPlugin plugin)
            {
                return plugin.authorise(PURGE, QUEUE, new ObjectProperties(queue));
            }
        });
    }
View Full Code Here

    {
        return checkAllPlugins(new AccessCheck()
        {
            Result allowed(SecurityPlugin plugin)
            {
                return plugin.authorise(UNBIND, EXCHANGE, new ObjectProperties(exch, queue, routingKey));
            }
        });
    }
View Full Code Here

    public void testAuthoriseAccessMethodWhenAllAccessOperationsAllowedOnAllComponents() throws ConfigurationException
    {
        final RuleSet rs = new RuleSet();

        // grant user4 access right on any method in any component
        rs.grant(1, "user4", Permission.ALLOW, Operation.ACCESS, ObjectType.METHOD, new ObjectProperties(ObjectProperties.STAR));
        configureAccessControl(rs);
        SecurityManager.setThreadSubject(TestPrincipalUtils.createTestSubject("user4"));

        ObjectProperties actionProperties = new ObjectProperties("getName");
        actionProperties.put(ObjectProperties.Property.COMPONENT, "Test");

        final Result result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, actionProperties);
        assertEquals(Result.ALLOWED, result);
    }
View Full Code Here

    public void testAuthoriseAccessMethodWhenAllAccessOperationsAllowedOnSpecifiedComponent() throws ConfigurationException
    {
        final RuleSet rs = new RuleSet();

        // grant user5 access right on any methods in "Test" component
        ObjectProperties ruleProperties = new ObjectProperties(ObjectProperties.STAR);
        ruleProperties.put(ObjectProperties.Property.COMPONENT, "Test");
        rs.grant(1, "user5", Permission.ALLOW, Operation.ACCESS, ObjectType.METHOD, ruleProperties);
        configureAccessControl(rs);
        SecurityManager.setThreadSubject(TestPrincipalUtils.createTestSubject("user5"));

        ObjectProperties actionProperties = new ObjectProperties("getName");
        actionProperties.put(ObjectProperties.Property.COMPONENT, "Test");
        Result result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, actionProperties);
        assertEquals(Result.ALLOWED, result);

        actionProperties.put(ObjectProperties.Property.COMPONENT, "Test2");
        result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, actionProperties);
        assertEquals(Result.DEFER, result);
    }
View Full Code Here

    public void testAuthoriseAccessMethodWhenSpecifiedAccessOperationsAllowedOnSpecifiedComponent() throws ConfigurationException
    {
        final RuleSet rs = new RuleSet();

        // grant user6 access right on "getAttribute" method in "Test" component
        ObjectProperties ruleProperties = new ObjectProperties("getAttribute");
        ruleProperties.put(ObjectProperties.Property.COMPONENT, "Test");
        rs.grant(1, "user6", Permission.ALLOW, Operation.ACCESS, ObjectType.METHOD, ruleProperties);
        configureAccessControl(rs);
        SecurityManager.setThreadSubject(TestPrincipalUtils.createTestSubject("user6"));

        ObjectProperties properties = new ObjectProperties("getAttribute");
        properties.put(ObjectProperties.Property.COMPONENT, "Test");
        Result result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);

        properties.put(ObjectProperties.Property.COMPONENT, "Test2");
        result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.DEFER, result);

        properties = new ObjectProperties("getAttribute2");
        properties.put(ObjectProperties.Property.COMPONENT, "Test");
        result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.DEFER, result);
    }
View Full Code Here

    public void testAuthoriseAccessUpdateMethodWhenAllRightsGrantedOnSpecifiedMethodForAllComponents() throws ConfigurationException
    {
        final RuleSet rs = new RuleSet();

        // grant user8 all rights on method queryNames in all component
        rs.grant(1, "user8", Permission.ALLOW, Operation.ALL, ObjectType.METHOD, new ObjectProperties("queryNames"));
        configureAccessControl(rs);
        SecurityManager.setThreadSubject(TestPrincipalUtils.createTestSubject("user8"));

        ObjectProperties properties = new ObjectProperties();
        properties.put(ObjectProperties.Property.COMPONENT, "Test");
        properties.put(ObjectProperties.Property.NAME, "queryNames");

        Result result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);

        result = _plugin.authorise(Operation.UPDATE, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);

        properties = new ObjectProperties("getAttribute");
        properties.put(ObjectProperties.Property.COMPONENT, "Test");
        result = _plugin.authorise(Operation.UPDATE, ObjectType.METHOD, properties);
        assertEquals(Result.DEFER, result);

        result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.DEFER, result);
View Full Code Here

    public void testAuthoriseAccessUpdateMethodWhenAllRightsGrantedOnAllMethodsInAllComponents() throws ConfigurationException
    {
        final RuleSet rs = new RuleSet();

        // grant user9 all rights on any method in all component
        rs.grant(1, "user9", Permission.ALLOW, Operation.ALL, ObjectType.METHOD, new ObjectProperties());
        configureAccessControl(rs);
        SecurityManager.setThreadSubject(TestPrincipalUtils.createTestSubject("user9"));

        ObjectProperties properties = new ObjectProperties("queryNames");
        properties.put(ObjectProperties.Property.COMPONENT, "Test");

        Result result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);

        result = _plugin.authorise(Operation.UPDATE, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);

        properties = new ObjectProperties("getAttribute");
        properties.put(ObjectProperties.Property.COMPONENT, "Test");
        result = _plugin.authorise(Operation.UPDATE, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);

        result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);
View Full Code Here

    public void testAuthoriseAccessMethodWhenMatchingAcessOperationsAllowedOnSpecifiedComponent() throws ConfigurationException
    {
        final RuleSet rs = new RuleSet();

        // grant user9 all rights on "getAttribute*" methods in Test component
        ObjectProperties ruleProperties = new ObjectProperties();
        ruleProperties.put(ObjectProperties.Property.COMPONENT, "Test");
        ruleProperties.put(ObjectProperties.Property.NAME, "getAttribute*");

        rs.grant(1, "user9", Permission.ALLOW, Operation.ACCESS, ObjectType.METHOD, ruleProperties);
        configureAccessControl(rs);
        SecurityManager.setThreadSubject(TestPrincipalUtils.createTestSubject("user9"));

        ObjectProperties properties = new ObjectProperties("getAttributes");
        properties.put(ObjectProperties.Property.COMPONENT, "Test");
        Result result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);

        properties = new ObjectProperties("getAttribute");
        properties.put(ObjectProperties.Property.COMPONENT, "Test");
        result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.ALLOWED, result);

        properties = new ObjectProperties("getAttribut");
        properties.put(ObjectProperties.Property.COMPONENT, "Test");
        result = _plugin.authorise(Operation.ACCESS, ObjectType.METHOD, properties);
        assertEquals(Result.DEFER, result);
    }
View Full Code Here

        assertDenyGrantAllow(_testSubject, Operation.ACCESS, ObjectType.VIRTUALHOST);
    }

    public void testQueueCreateNamed() throws Exception
    {
        assertDenyGrantAllow(_testSubject, Operation.CREATE, ObjectType.QUEUE, new ObjectProperties(_queueName));
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.security.access.ObjectProperties

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.