Search in sources :

Example 1 with Dn

use of org.apache.directory.shared.ldap.model.name.Dn in project activemq-artemis by apache.

the class AbstractCachedLDAPAuthorizationMapLegacyTest method testRenamePermission.

@Test
public void testRenamePermission() throws Exception {
    map.query();
    // Test for a permission rename
    connection.delete(new Dn("cn=Read,cn=TEST.FOO," + getQueueBaseDn()));
    Thread.sleep(2000);
    Set<?> failedACLs = map.getReadACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 0, failedACLs.size());
    failedACLs = map.getWriteACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 2, failedACLs.size());
    connection.rename(new Dn("cn=Write,cn=TEST.FOO," + getQueueBaseDn()), new Rdn("cn=Read"));
    Thread.sleep(2000);
    failedACLs = map.getReadACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 2, failedACLs.size());
    failedACLs = map.getWriteACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 0, failedACLs.size());
}
Also used : ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) Dn(org.apache.directory.shared.ldap.model.name.Dn) Rdn(org.apache.directory.shared.ldap.model.name.Rdn) Test(org.junit.Test)

Example 2 with Dn

use of org.apache.directory.shared.ldap.model.name.Dn in project activemq-artemis by apache.

the class AbstractCachedLDAPAuthorizationMapLegacyTest method testChange.

@Test
public void testChange() throws Exception {
    map.query();
    // Change permission entry
    Set<?> failedACLs = map.getReadACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 2, failedACLs.size());
    Dn dn = new Dn("cn=read,cn=TEST.FOO," + getQueueBaseDn());
    ModifyRequest request = new ModifyRequestImpl();
    request.setName(dn);
    setupModifyRequest(request);
    connection.modify(request);
    Thread.sleep(2000);
    failedACLs = map.getReadACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 1, failedACLs.size());
    // Change destination entry
    request = new ModifyRequestImpl();
    request.setName(new Dn("cn=TEST.FOO," + getQueueBaseDn()));
    request.add("description", "This is a description!  In fact, it is a very good description.");
    connection.modify(request);
    Thread.sleep(2000);
    failedACLs = map.getReadACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 1, failedACLs.size());
}
Also used : ModifyRequestImpl(org.apache.directory.shared.ldap.model.message.ModifyRequestImpl) ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) Dn(org.apache.directory.shared.ldap.model.name.Dn) ModifyRequest(org.apache.directory.shared.ldap.model.message.ModifyRequest) Test(org.junit.Test)

Example 3 with Dn

use of org.apache.directory.shared.ldap.model.name.Dn in project activemq-artemis by apache.

the class AbstractCachedLDAPAuthorizationMapLegacyTest method testRenameDestination.

@Test
public void testRenameDestination() throws Exception {
    map.query();
    // Test for a destination rename
    Set<?> failedACLs = map.getReadACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 2, failedACLs.size());
    connection.rename(new Dn("cn=TEST.FOO," + getQueueBaseDn()), new Rdn("cn=TEST.BAR"));
    Thread.sleep(2000);
    failedACLs = map.getReadACLs(new ActiveMQQueue("TEST.FOO"));
    assertEquals("set size: " + failedACLs, 0, failedACLs.size());
    failedACLs = map.getReadACLs(new ActiveMQQueue("TEST.BAR"));
    assertEquals("set size: " + failedACLs, 2, failedACLs.size());
}
Also used : ActiveMQQueue(org.apache.activemq.command.ActiveMQQueue) Dn(org.apache.directory.shared.ldap.model.name.Dn) Rdn(org.apache.directory.shared.ldap.model.name.Rdn) Test(org.junit.Test)

Example 4 with Dn

use of org.apache.directory.shared.ldap.model.name.Dn in project activemq-artemis by apache.

the class CachedLDAPAuthorizationModuleTest method getLdapConnection.

@Override
protected LdapConnection getLdapConnection() throws Exception {
    LdapConnection connection = new LdapNetworkConnection("localhost", getLdapServer().getPort());
    connection.bind(new Dn("uid=admin,ou=system"), "secret");
    return connection;
}
Also used : Dn(org.apache.directory.shared.ldap.model.name.Dn) LdapNetworkConnection(org.apache.directory.ldap.client.api.LdapNetworkConnection) LdapConnection(org.apache.directory.ldap.client.api.LdapConnection)

Example 5 with Dn

use of org.apache.directory.shared.ldap.model.name.Dn in project activemq-artemis by apache.

the class CachedLDAPAuthorizationModuleLegacyOpenLDAPTest method getLdapConnection.

@Override
protected LdapConnection getLdapConnection() throws LdapException, IOException {
    LdapConnection connection = new LdapNetworkConnection(LDAP_HOST, LDAP_PORT);
    connection.bind(new Dn(LDAP_USER), LDAP_PASS);
    return connection;
}
Also used : Dn(org.apache.directory.shared.ldap.model.name.Dn) LdapNetworkConnection(org.apache.directory.ldap.client.api.LdapNetworkConnection) LdapConnection(org.apache.directory.ldap.client.api.LdapConnection)

Aggregations

Dn (org.apache.directory.shared.ldap.model.name.Dn)7 LdapConnection (org.apache.directory.ldap.client.api.LdapConnection)4 LdapNetworkConnection (org.apache.directory.ldap.client.api.LdapNetworkConnection)4 ActiveMQQueue (org.apache.activemq.command.ActiveMQQueue)3 Test (org.junit.Test)3 Rdn (org.apache.directory.shared.ldap.model.name.Rdn)2 ModifyRequest (org.apache.directory.shared.ldap.model.message.ModifyRequest)1 ModifyRequestImpl (org.apache.directory.shared.ldap.model.message.ModifyRequestImpl)1