mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

mkeyes
24.31.2007 c408b735c27c5bfd896d70a3d32a85434e462375
Adding functional test cases using multiple password validators. The tests include dsconfig commands to create, modify, and delete a custom password validator.
1 files added
1 files modified
393 ■■■■■ changed files
opends/tests/functional-tests/testcases/security/pwd_validator/security_mult_validators.xml 389 ●●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/pwd_validator/security_pwd_validator.xml 4 ●●●● patch | view | raw | blame | history
opends/tests/functional-tests/testcases/security/pwd_validator/security_mult_validators.xml
New file
@@ -0,0 +1,389 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE stax SYSTEM "../../../shared/stax.dtd">
<!--
 ! 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
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
 ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 ! 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
 ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  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
 !
 !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 ! -->
<stax>
  <defaultcall function="mult_validators"/>
  <function name="mult_validators">
      <sequence>
        <testcase name="getTestCaseName('Multiple Validators: Preamble')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>
               'Security: Pwd Validator: Multiple Validators: Preamble Step 1. Admin enabling one validator'
            </message>
            <call function="'modifyPwdPolicy'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                    'propertyName'           : 'Default Password Policy' ,
                    'attributeName'          : 'password-validator-dn' ,
                    'attributeValue'         : 'cn=Attribute Value,cn=Password Validators,cn=config' }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: Preamble Step 2. Admin creating a custom validator'
            </message>
            <call function="'dsconfig'">
            { 'dsInstanceHost'       : DIRECTORY_INSTANCE_HOST,
              'dsInstancePort'       : DIRECTORY_INSTANCE_PORT ,
              'dsInstanceDn'         : DIRECTORY_INSTANCE_DN ,
              'dsInstancePswd'       : DIRECTORY_INSTANCE_PSWD ,
              'subcommand'           : 'create-password-validator' ,
              'objectType'           : 'validator-name' ,
              'objectName'           : 'Custom Attribute Value',
              'optionsString'        : '--type attribute-value --set enabled:true  --set test-reversed-password:true ',
              'expectedRC'           : 0 }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: Preamble Step 3. Admin enabling custom validator'
            </message>
            <call function="'dsconfigSet'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                    'objectName'             : 'password-policy' ,
                    'propertyType'           : 'policy' ,
                    'propertyName'           : 'Default Password Policy' ,
                    'attributeName'          : 'password-validator-dn' ,
                    'attributeValue'         : 'cn=Custom Attribute Value,cn=Password Validators,cn=config' ,
                    'modifyType'             : 'add' }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: Preamble Step 4. Admin enabling third validator'
            </message>
            <call function="'dsconfigSet'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                    'objectName'             : 'password-policy' ,
                    'propertyType'           : 'policy' ,
                    'propertyName'           : 'Default Password Policy' ,
                    'attributeName'          : 'password-validator-dn' ,
                    'attributeValue'         : 'cn=Repeated Characters,cn=Password Validators,cn=config' ,
                    'modifyType'             : 'add' }
            </call>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
        <testcase name="getTestCaseName('Multiple Validators: add attribute sn to one validator')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>
               'Security: Pwd Validator: Multiple Validators: add attribute sn to one validator'
            </message>
            <call function="'modifyPwdValidator'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                    'propertyName'           : 'Attribute Value' ,
                    'attributeName'          : 'match-attribute' ,
                    'attributeValue'         : 'sn' ,
                    'modifyType'             : 'add' }
            </call>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
        <testcase name="getTestCaseName('Multiple Validators: user modifying password to sn')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>
               'Security: Pwd Validator: Multiple Validators: user modifying password to sn'
            </message>
            <call function="'modifyAnAttribute'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                    'dsInstancePswd'         : 'hypotenuse' ,
                    'DNToModify'             : 'uid=cschmith, ou=People, ou=password tests,  o=Pwd Validator Tests, dc=example,dc=com' ,
                    'attributeName'          : 'userpassword' ,
                    'newAttributeValue'      : 'Schmith' ,
                    'changetype'             : 'replace' ,
                    'expectedRC'             : 53  }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: user binding with invalid password'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'Schmith' ,
                'dsBaseDN'         : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base',
                'expectedRC'       : 49 }
            </call>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
        <testcase name="getTestCaseName('Multiple Validators: add attribute givenName to custom validator')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>
               'Security: Pwd Validator: Multiple Validators: add attribute sn to one validator'
            </message>
            <call function="'modifyPwdValidator'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                    'propertyName'           : 'Custom Attribute Value' ,
                    'attributeName'          : 'match-attribute' ,
                    'attributeValue'         : 'givenName' ,
                    'modifyType'             : 'add' }
            </call>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
        <testcase name="getTestCaseName('Multiple Validators: user modifying password to givenName')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>
               'Security: Pwd Validator: Multiple Validators: user modifying password to givenName'
            </message>
            <call function="'modifyAnAttribute'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                    'dsInstancePswd'         : 'hypotenuse' ,
                    'DNToModify'             : 'uid=cschmith, ou=People, ou=password tests,  o=Pwd Validator Tests, dc=example,dc=com' ,
                    'attributeName'          : 'userpassword' ,
                    'newAttributeValue'      : 'Chris' ,
                    'changetype'             : 'replace' ,
                    'expectedRC'             : 53  }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: user binding with invalid password'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=dmiller,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'Chris' ,
                'dsBaseDN'         : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base',
                'expectedRC'       : 49 }
            </call>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
        <testcase name="getTestCaseName('Multiple Validators: user modifying password to aaaaaa')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>
               'Security: Pwd Validator: Multiple Validators: user modifying password to aaaaaa'
            </message>
            <call function="'modifyAnAttribute'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                    'dsInstancePswd'         : 'hypotenuse' ,
                    'DNToModify'             : 'uid=cschmith, ou=People, ou=password tests,  o=Pwd Validator Tests, dc=example,dc=com' ,
                    'attributeName'          : 'userpassword' ,
                    'newAttributeValue'      : 'aaaaaa' ,
                    'changetype'             : 'replace' ,
                    'expectedRC'             : 53  }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: user binding with invalid password'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=dmiller,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'aaaaaa' ,
                'dsBaseDN'         : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base',
                'expectedRC'       : 49 }
            </call>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
        <testcase name="getTestCaseName('Multiple Validators: Postamble')">
          <sequence>
            <call function="'testCase_Preamble'"/>
            <message>
               'Security: Pwd Validator: Multiple Validators: Postamble Step 1. Admin Resetting Maximum Pwd Length'
            </message>
            <call function="'modifyPwdPolicy'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : DIRECTORY_INSTANCE_DN ,
                    'dsInstancePswd'         : DIRECTORY_INSTANCE_PSWD ,
                    'propertyName'           : 'Default Password Policy' ,
                    'attributeName'          : 'password-validator-dn' ,
                    'modifyType'             : 'reset' }
            </call>
            <!--- User Change Password -->
            <message>
               'Security: Pwd Validator: Multiple Validators: Postamble Step 2. User Changing Password'
            </message>
            <call function="'modifyAnAttribute'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                    'dsInstancePswd'         : 'hypotenuse' ,
                    'DNToModify'             : 'uid=cschmith, ou=People, ou=password tests,  o=Pwd Validator Tests, dc=example,dc=com' ,
                    'attributeName'          : 'userpassword' ,
                    'newAttributeValue'      : 'Schmith' ,
                    'changetype'             : 'replace' }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: Postamble Step 3. User Searching With Password'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'Schmith' ,
                'dsBaseDN'         : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: Postamble Step 4. User Changing Password'
            </message>
            <call function="'modifyAnAttribute'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                    'dsInstancePswd'         : 'Schmith' ,
                    'DNToModify'             : 'uid=cschmith, ou=People, ou=password tests,  o=Pwd Validator Tests, dc=example,dc=com' ,
                    'attributeName'          : 'userpassword' ,
                    'newAttributeValue'      : 'Chris' ,
                    'changetype'             : 'replace' }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: Postamble Step 5. User Searching With Password'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'Chris' ,
                'dsBaseDN'         : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: Postamble Step 6. User Changing Password'
            </message>
            <call function="'modifyAnAttribute'">
                  { 'dsInstanceHost'         : DIRECTORY_INSTANCE_HOST ,
                    'dsInstancePort'         : DIRECTORY_INSTANCE_PORT ,
                    'dsInstanceDn'           : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                    'dsInstancePswd'         : 'Chris' ,
                    'DNToModify'             : 'uid=cschmith, ou=People, ou=password tests,  o=Pwd Validator Tests, dc=example,dc=com' ,
                    'attributeName'          : 'userpassword' ,
                    'newAttributeValue'      : 'aaaaaa' ,
                    'changetype'             : 'replace' }
            </call>
            <message>
               'Security: Pwd Validator: Multiple Validators: Postamble Step 7. User Searching With Password'
            </message>
            <call function="'SearchObject'">
              { 'dsInstanceHost'   : DIRECTORY_INSTANCE_HOST ,
                'dsInstancePort'   : DIRECTORY_INSTANCE_PORT ,
                'dsInstanceDn'     : 'uid=cschmith,ou=people,ou=password tests,o=Pwd Validator Tests,dc=example,dc=com' ,
                'dsInstancePswd'   : 'aaaaaa' ,
                'dsBaseDN'         : 'dc=example,dc=com' ,
                'dsFilter'         : 'objectclass=*'  ,
                'extraParams'      : '-s base' }
            </call>
            <call function="'testCase_Postamble'"/>
          </sequence>
        </testcase>
     </sequence>
  </function>
</stax>
opends/tests/functional-tests/testcases/security/pwd_validator/security_pwd_validator.xml
@@ -89,6 +89,10 @@
        <call function="'repeat_chars'" />
        <import machine="STAF_LOCAL_HOSTNAME"
          file="'%s/testcases/security/pwd_validator/security_mult_validators.xml' % (TESTS_DIR)"/>
        <call function="'mult_validators'" />
        <import machine="STAF_LOCAL_HOSTNAME"
          file="'%s/testcases/security/pwd_validator/security_skip_val_for_admins.xml' % (TESTS_DIR)"/>
        <call function="'skip_val_for_admins'" />