SubentryPasswordPolicyTestCase.java revision 9aa1482c49865483f798f91ef7d16f03cc3ec811
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License, Version 1.0 only 0N/A * (the "License"). You may not use this file except in compliance 0N/A * See the License for the specific language governing permissions 0N/A * and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 1472N/A * Portions Copyright [yyyy] [name of copyright owner] 0N/A * Copyright 2010 Sun Microsystems, Inc. 1879N/A * Portions Copyright 2011-2015 ForgeRock AS. 0N/A * A set of test cases for the Directory Server subentry password policy. 0N/A // Add suffix entry. 0N/A "objectclass: person",
0N/A "objectclass: organizationalPerson",
0N/A "objectclass: inetOrgPerson",
0N/A "userpassword: password",
1879N/A "mail: rogasawara@example.com",
* Retrieves a set of invalid configurations that cannot be used to * initialize a password policy. * @return A set of invalid configurations that cannot be used to * initialize a password policy. * @throws Exception If an unexpected problem occurs. "dn: cn=Temp Policy 1," +
SUFFIX,
"objectClass: pwdPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: userPassword",
"dn: cn=Temp Policy 2," +
SUFFIX,
"objectClass: pwdPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300 seconds",
"pwdAttribute: userPassword",
"dn: cn=Temp Policy 3," +
SUFFIX,
"objectClass: pwdPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: noSuchAttribute",
"dn: cn=Temp Policy 4," +
SUFFIX,
"objectClass: pwdPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: userPassword",
"dn: cn=Temp Policy 5," +
SUFFIX,
"objectClass: pwdPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 2147483648",
"pwdAttribute: userPassword",
"dn: cn=Temp Policy 6," +
SUFFIX,
"objectClass: pwdPolicy",
"objectClass: pwdValidatorPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: userPassword",
"dn: cn=Temp Policy 7," +
SUFFIX,
"objectClass: pwdPolicy",
"objectClass: pwdValidatorPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: userPassword",
"ds-cfg-password-validator: Not_A_DN",
"dn: cn=Temp Policy 8," +
SUFFIX,
"objectClass: pwdPolicy",
"objectClass: pwdValidatorPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: userPassword",
"ds-cfg-password-validator: cn=Unique Characters Inexistant,cn=Password Validators,cn=config" * Ensures that password policy creation will fail when given * an invalid configuration. * @param e The entry containing an invalid password policy * @throws Exception If an unexpected problem occurs. * Ensures that password policy constructed from subentry * is active and has a valid configuration. * @throws Exception If an unexpected problem occurs. // The values are selected on a basis that they // should differ from default password policy. "dn: cn=Temp Policy," +
SUFFIX,
"objectClass: pwdPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: authPassword",
"pwdExpireWarning: 864000",
"pwdFailureCountInterval: 3600",
"pwdAllowUserChange: FALSE",
// Check all pwp attributes for correct values. /* Check the password validator attributes for correct values. * The default unit-test config has a single Password validator which is * enabled for the default password policy. // Make sure this policy applies to the test entry // its supposed to target and that its the same // policy object as previously tested. "uid=rogasawara," +
BASE));
// Make sure this policy is gone and default // policy is in effect instead. * Ensures that password policy constructed from subentry, * containing a password validator reference, * is active and has a valid configuration. * @throws Exception If an unexpected problem occurs. // The values are selected on a basis that they // should differ from default password policy. "dn: cn=Temp Validator Policy," +
SUFFIX,
"objectClass: pwdPolicy",
"objectClass: pwdValidatorPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: authPassword",
"pwdExpireWarning: 864000",
"pwdFailureCountInterval: 3600",
"pwdAllowUserChange: FALSE",
"ds-cfg-password-validator: cn=Unique Characters,cn=Password Validators,cn=config",
"ds-cfg-password-validator: cn=Length-Based Password Validator,cn=Password Validators,cn=config" // Check the password validator attributes for correct values. // Make sure this policy applies to the test entry // its supposed to target and that its the same // policy object as previously tested. // Make sure this policy is gone and default // policy is in effect instead. * Ensures that password policy pwdPolicySubentry * operational attribute reflects active password * policy for a given user entry. * @throws Exception If an unexpected problem occurs. // Make sure that default policy is in effect // Add new subentry policy with the // scope to apply to the user entry. "dn: cn=Temp Policy," +
SUFFIX,
"objectClass: pwdPolicy",
"subtreeSpecification: { base \"ou=people\" }",
"pwdLockoutDuration: 300",
"pwdAttribute: userPassword" // Make sure just added policy is in effect. // Remove subentry policy and make sure // default policy is in effect again. "uid=rogasawara," +
BASE));