1 package org.apache.archiva.redback.policy; 2 3 /* 4 * Copyright 2001-2006 The Apache Software Foundation. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 import org.apache.archiva.redback.users.User; 20 21 /** 22 * A Password Rule 23 * 24 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> 25 * 26 */ 27 public interface PasswordRule 28 { 29 30 /** 31 * Tests if rule is enabled (or not) 32 */ 33 boolean isEnabled(); 34 35 /** 36 * Sets the User Security Policy to use. 37 * 38 * The policy is set once per instance of a PasswordRule object. 39 * 40 * @param policy the policy to use. 41 */ 42 void setUserSecurityPolicy(UserSecurityPolicy policy); 43 44 45 /** 46 * true if the security policy has been set on the rule 47 * 48 * @return boolean 49 */ 50 boolean requiresSecurityPolicy(); 51 52 /** 53 * Tests the {@link User#getPassword()} for a valid password, based on rule. 54 * 55 * @param violations the place to add any password rule violations that this rule has discovered. 56 * @param user the User to test. 57 */ 58 void testPassword( PasswordRuleViolations violations, User user ); 59 60 /** 61 * to use in case of configuration change. 62 */ 63 void initialize(); 64 }