WhoAmIExtendedOperationTestCase.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* A set of test cases for the "Who Am I?" extended operation.
*/
public class WhoAmIExtendedOperationTestCase
extends ExtensionsTestCase
{
/**
* Ensures that the Directory Server is running.
*
* @throws Exception If an unexpected problem occurs.
*/
public void startServer()
throws Exception
{
}
/**
* Tests the use of the Who Am I? extended operation with an internal
* connection authenticated as a root user.
*/
@Test
public void testAsInternalRootUser()
{
}
/**
* Tests the use of the Who Am I? extended operation with an internal
* unauthenticated connection.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAsInternalAnonymous()
throws Exception
{
}
/**
* Tests the use of the Who Am I? extended operation with an internal
* connection authenticated as a normal user.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAsInternalNormalUser()
throws Exception
{
"dn: uid=test.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"userPassword: password");
}
/**
* Tests the use of the Who Am I? extended operation with an LDAP connection
* authenticated as a root user.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAsLDAPRootUser()
throws Exception
{
new UnbindRequestProtocolOp());
s.close();
}
/**
* Tests the use of the Who Am I? extended operation with an unauthenticated
* LDAP connection.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAsLDAPAnonymous()
throws Exception
{
new UnbindRequestProtocolOp());
s.close();
}
/**
* Tests the use of the Who Am I? extended operation with an LDAP connection
* authenticated as a normal user.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testAsLDAPNormalUser()
throws Exception
{
"dn: uid=test.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"userPassword: password");
new UnbindRequestProtocolOp());
s.close();
}
/**
* Tests the use of the "Who Am I?" extended operation when used by a client
* that has authenticated using a SASL mechanism and specified an alternate
* authorization identity.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testWithAlternateSASLAuthzID()
throws Exception
{
"dn: uid=test.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"userPassword: password",
"",
"dn: uid=proxy.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: proxy.user",
"givenName: Proxy",
"sn: User",
"cn: Proxy User",
"userPassword: password",
"ds-privilege-name: bypass-acl",
"ds-privilege-name: proxied-auth");
// Bind as the proxy user with an alternate authorization identity, and use
// the "Who Am I?" operation.
// Close the connection to the server.
new UnbindRequestProtocolOp());
s.close();
}
/**
* Tests the use of the Who Am I? extended operation in conjunction with the
* proxied authorization control by an appropriately authorized user.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testWithAllowedProxiedAuthControl()
throws Exception
{
"dn: uid=test.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"userPassword: password",
"",
"dn: uid=proxy.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: proxy.user",
"givenName: Proxy",
"sn: User",
"cn: Proxy User",
"userPassword: password",
"ds-privilege-name: bypass-acl",
"ds-privilege-name: proxied-auth");
// Bind as the proxy user and use the "Who Am I?" operation, but without the
// proxied auth control.
// Use the "Who Am I?" operation again, this time with the proxy control.
// Close the connection to the server.
new UnbindRequestProtocolOp());
s.close();
}
/**
* Tests the use of the Who Am I? extended operation in conjunction with the
* proxied authorization control by a user who doesn't have the rights to use
* that control.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
public void testWithDisallowedProxiedAuthControl()
throws Exception
{
"dn: uid=test.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: test.user",
"givenName: Test",
"sn: User",
"cn: Test User",
"userPassword: password",
"",
"dn: uid=cantproxy.user,o=test",
"objectClass: top",
"objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"uid: proxy.user",
"givenName: Cantproxy",
"sn: User",
"cn: Cantproxy User",
"userPassword: password",
"ds-privilege-name: bypass-acl");
// Bind as the proxy user and use the "Who Am I?" operation, but without the
// proxied auth control.
// Use the "Who Am I?" operation again, this time with the proxy control.
// Close the connection to the server.
new UnbindRequestProtocolOp());
s.close();
}
}