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