1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. 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, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.myfaces.custom.passwordStrength; 20 21 import javax.faces.component.html.HtmlInputText; 22 23 import org.apache.myfaces.component.AlignProperty; 24 25 /** 26 * The passwordStrength component is needed by the web sites 27 * which ask the user to enter a powerful password for the 28 * purpose of the registration stuff. 29 * <p> 30 * The component enables its user to know the strength of the password 31 * while (he/she) types it before even submit the form to the server 32 * [please see the screenshots]. 33 * </p> 34 * <p> 35 * The component enables its user to define his custom security policy 36 * for his password in an easy manner. 37 * </p> 38 * <p> 39 * The component also have 2 types of presenting the password strength. 40 * Till now the strength can be represented as text or progressbar. 41 * </p> 42 * 43 * @JSFComponent 44 * name = "s:passwordStrength" 45 * class = "org.apache.myfaces.custom.passwordStrength.PasswordStrengthComponent" 46 * tagClass = "org.apache.myfaces.custom.passwordStrength.PasswordStrengthTag" 47 * 48 */ 49 public abstract class AbstractPasswordStrengthComponent extends HtmlInputText 50 implements AlignProperty{ 51 52 public static String COMPONENT_TYPE = "org.apache.myfaces.PasswordStrength"; 53 54 public static String DEFAULT_RENDERER_TYPE = "org.apache.myfaces.PasswordStrength"; 55 56 public static String COMPONENT_FAMILY = "org.apache.myfaces.PasswordStrength"; 57 58 /** 59 * This flag {true | false} determines whether to show the details (left characters). 60 * default is true 61 * 62 * @JSFProperty 63 */ 64 public abstract String getShowDetails(); 65 66 /** 67 * This flag determines the indicator type. It can be {text or bar}. Default is text 68 * 69 * @JSFProperty 70 */ 71 public abstract String getStrengthIndicatorType(); 72 73 /** 74 * The prefered length of the password 75 * 76 * @JSFProperty 77 */ 78 public abstract String getPreferredPasswordLength(); 79 80 /** 81 * The prefix of the component message 82 * 83 * @JSFProperty 84 */ 85 public abstract String getPrefixText(); 86 87 /** 88 * The text strength descriptions 89 * 90 * @JSFProperty 91 */ 92 public abstract String getTextStrengthDescriptions(); 93 94 /** 95 * This string determines the expression of the custom security rule of the password 96 * <p> 97 * Note that the expression has the following format : 98 * </p> 99 * <p> 100 * ******************************************************* 101 * </p> 102 * <p> 103 * S (Number) N (Number) A (Number) 104 * </p> 105 * <ul> 106 * <li>Where S stands for Symbols</li> 107 * <li>Where N stands for Numbers</li> 108 * <li>Where A stands for Alphabets</li> 109 * </ul> 110 * <p> 111 * ******************************************************* 112 * </p> 113 * <p> 114 * For example) A4N2S3A2 115 * Means that the password will be as following : 116 * </p> 117 * <ul> 118 * <li>4 or more Alphabets followed by</li> 119 * <li>2 or more Numbers followed by</li> 120 * <li>3 or more Symbols followed by</li> 121 * <li>2 or more Alphabets</li> 122 * </ul> 123 * <p> 124 * ******************************************************* 125 * </p> 126 * <p> 127 * Note also that the useCustomSecurity should be set to true. 128 * </p> 129 * 130 * @JSFProperty 131 */ 132 public abstract String getCustomSecurityExpression(); 133 134 /** 135 * This flag determines whether to user custom security rules instead 136 * of just depending on the password length. The default is false. 137 * 138 * @JSFProperty 139 */ 140 public abstract String getUseCustomSecurity(); 141 142 /** 143 * This attribute determines the penalty ratio that will decrease the password 144 * Strength if the custom security expression is not met. Note also that the 145 * useCustomSecurity should be set to true to apply this flag. Possible values 146 * from 0 to 100. Default value is 50. 147 * 148 * @JSFProperty 149 */ 150 public abstract String getPenaltyRatio(); 151 152 /** 153 * HTML: Specifies the horizontal alignment of this element. Deprecated in HTML 4.01. 154 * 155 * @JSFProperty 156 */ 157 public abstract String getAlign(); 158 159 }