PlainSASLMechanismHandlerTestCase.java revision 62625611993cc177eb95fb726fc137dbba01d6d2
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * You can obtain a copy of the license at 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * file and include the License file at 2N/A * add the following below this CDDL HEADER, with the fields enclosed 2N/A * by brackets "[]" replaced with your own identifying information: 2N/A * Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2006-2008 Sun Microsystems, Inc. 2N/A * A set of test cases for the PLAIN SASL mechanism handler. 2N/A * Ensures that the Directory Server is running. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A * Tests to ensure that the SASL PLAIN mechanism is loaded and available in 2N/A * the server, and that it reports that it is password based and not secure. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A * Tests to ensure that PLAIN is advertised as a supported SASL mechanism. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A * Retrieves a set of passwords that may be used to test the password storage 2N/A * @return A set of passwords that may be used to test the password storage 2N/A * Creates a test user and authenticates to the server as that user with the 2N/A * SASL PLAIN mechanism using a raw authentication ID (i.e., not prefixed by 2N/A * either "u:" or "dn:"). 2N/A * @param password The password for the user. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A "dn: uid=test.user,o=test",
2N/A "objectClass: person",
2N/A "objectClass: organizationalPerson",
2N/A "objectClass: inetOrgPerson",
2N/A * Creates a test user and authenticates to the server as that user with the 2N/A * SASL PLAIN mechanism using the "u:" style authentication ID. 2N/A * @param password The password for the user. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A "dn: uid=test.user,o=test",
2N/A "objectClass: person",
2N/A "objectClass: organizationalPerson",
2N/A "objectClass: inetOrgPerson",
2N/A * Creates a test user and authenticates to the server as that user with the 2N/A * SASL PLAIN mechanism using the "u:" style authentication ID and 2N/A * @param password The password for the user. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A "dn: uid=test.user,o=test",
2N/A "objectClass: person",
2N/A "objectClass: organizationalPerson",
2N/A "objectClass: inetOrgPerson",
2N/A * Creates a test user and authenticates to the server as that user with the 2N/A * SASL PLAIN mechanism using the "dn:" style authentication ID. 2N/A * @param password The password for the user. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A "dn: uid=test.user,o=test",
2N/A "objectClass: person",
2N/A "objectClass: organizationalPerson",
2N/A "objectClass: inetOrgPerson",
2N/A * Creates a test user and authenticates to the server as that user with the 2N/A * SASL PLAIN mechanism using the "dn:" style authentication ID and an 2N/A * @param password The password for the user. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A "dn: uid=test.user,o=test",
2N/A "objectClass: person",
2N/A "objectClass: organizationalPerson",
2N/A "objectClass: inetOrgPerson",
2N/A * Ensures that SASL PLAIN authentication will work for root users. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A * Ensures that SASL PLAIN authentication works over LDAP as well as via the 2N/A * internal protocol. The authentication will be performed as the root user. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A "--noPropertiesFile",
2N/A "-o",
"authid=dn:cn=Directory Manager",
2N/A * Retrieves sets of invalid credentials that will not succeed when using 2N/A * @return Sets of invalid credentials that will not work when using SASL 2N/A "\u0000password") },
2N/A * Creates a test user and authenticates to the server as that user with the 2N/A * SASL PLAIN mechanism using the "dn:" style authentication ID. 2N/A * @param saslCredentials The (invalid) SASL credentials to use. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A "dn: uid=test.user,o=test",
2N/A "objectClass: person",
2N/A "objectClass: organizationalPerson",
2N/A "objectClass: inetOrgPerson",
2N/A "userPassword: password");
2N/A * Performs a failed LDAP bind using PLAIN with an authorization ID that 2N/A * contains the DN of an entry that doesn't exist. 2N/A * @throws Exception If an unexpected problem occurs. 2N/A "dn: uid=test.user,o=test",
2N/A "objectClass: person",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"userPassword: password",
"ds-privilege-name: proxied-auth");
"-o",
"authid=dn:uid=test.user,o=test",
"-o",
"authzid=dn:uid=nonexistent,o=test",
* Performs a failed LDAP bind using PLAIN with an authorization ID that * contains a username for an entry that doesn't exist. * @throws Exception If an unexpected problem occurs. "dn: uid=test.user,o=test",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"userPassword: password",
"ds-privilege-name: proxied-auth");
"-o",
"authid=dn:uid=test.user,o=test",
"-o",
"authzid=u:nonexistent",
* Performs a failed LDAP bind using PLAIN with an authorization ID that * contains a malformed DN. * @throws Exception If an unexpected problem occurs. "dn: uid=test.user,o=test",
"objectClass: organizationalPerson",
"objectClass: inetOrgPerson",
"userPassword: password",
"ds-privilege-name: proxied-auth");
"-o",
"authid=dn:uid=test.user,o=test",
"-o",
"authzid=dn:malformed",