/** * Set the Password Rules List. * * @param rules the list of {@link PasswordRule} objects. */ public void setPasswordRules( List rules ) { this.rules.clear(); if ( rules == null ) { return; } // Intentionally iterating to ensure policy settings in provided rules. Iterator it = rules.iterator(); while ( it.hasNext() ) { PasswordRule rule = (PasswordRule) it.next(); addPasswordRule( rule ); } }
public void initialize() throws InitializationException { configurePolicy(); configureEncoder(); // In some configurations, rules can be unset. if ( rules == null ) { // Set rules to prevent downstream NPE. rules = new ArrayList(); } if ( rules.isEmpty() ) { // there should be at least one rule addPasswordRule( defaultPasswordRule ); } }