Creating an Instance of the Password Validation Provider Specifying the Password Composition Rules

5-26 Securing Oracle WebLogic Server

5.8.4 Using WLST to Create and Configure the Password Validation Provider

The Password Validation provider can be administered in the security realm via a WLST script that performs operations on the SystemPasswordValidatorMBean, described in the Oracle WebLogic Server MBean Reference. You may create and configure the Password Validation provider from a single WLST script, or you may have separate scripts that perform these functions separately. The following topics explain how, providing sample WLST code snippets: ■ Section 5.8.4.1, Creating an Instance of the Password Validation Provider ■ Section 5.8.4.2, Specifying the Password Composition Rules

5.8.4.1 Creating an Instance of the Password Validation Provider

The Password Validation provider is created automatically in the security realm when you create a new domain. However, you can use WLST to create one as well, as shown in Example 5–1 . This code does the following: 1. Gets the current realm and Password Validation provider. 2. Determines whether an instance of the Password Validator provider named SystemPasswordValidator has been created: ■ If the provider has been created, the script displays a message confirming its presence. ■ If the provider has not been created, the script creates it in the security realm and displays a message indicating that it has been created. Example 5–1 Creating the System Password Validator edit startEdit realm = cmo.getSecurityConfiguration.getDefaultRealm pwdvalidator = realm.lookupPasswordValidatorSystemPasswordValidator if pwdvalidator: print Password Validator provider is already created else: Create SystemPasswordValidator syspwdValidator = realm.createPasswordValidatorSystemPasswordValidator, com.bea.security.providers.authentication.passwordvalidator.SystemPasswordValidat or print --- Creation of System Password Validator succeeded save activate

5.8.4.2 Specifying the Password Composition Rules

Example 5–2 shows an example of WLST code that sets the composition rules for the Password Validation provider. For information about the rule attributes that can be set in this script, see the description of the SystemPasswordValidatorMBean in the Oracle WebLogic Server MBean Reference. Example 5–2 Configuring the Password Composition Rules edit Configuring Authentication Providers 5-27 startEdit Configure SystemPasswordValidator try: pwdvalidator.setMinPasswordLength8 pwdvalidator.setMaxPasswordLength12 pwdvalidator.setMaxConsecutiveCharacters3 pwdvalidator.setMaxInstancesOfAnyCharacter4 pwdvalidator.setMinAlphabeticCharacters1 pwdvalidator.setMinNumericCharacters1 pwdvalidator.setMinLowercaseCharacters1 pwdvalidator.setMinUppercaseCharacters1 pwdvalidator.setMinNonAlphanumericCharacters1 pwdvalidator.setMinNumericOrSpecialCharacters1 pwdvalidator.setRejectEqualOrContainUsernametrue pwdvalidator.setRejectEqualOrContainReverseUsernametrue print --- Configuration of SystemPasswordValidator complete --- except Exception,e: print e save activate

5.9 Configuring Identity Assertion Providers