Generating random password

In this post under Passay, I will show with example how to generate random password. For our example I will generate a random password of length 15 characters containing english lowercase characters, uppercase characters, special characters and digits. Below is the complete code for your reference. Main class 1 package defaultPackage;2 3 import java.util.ArrayList;4 import…… Continue reading Generating random password

Verifying password has alphanumeric and special characters

In this post under Passay, I will show with example how to verify whether a password has alphanumeric and special characters. Below is the Main class for our example Main class 1 package defaultPackage;2 3 import java.util.ArrayList;4 import java.util.List;5 import java.util.Scanner;6 7 import org.passay.CharacterRule;8 import org.passay.EnglishCharacterData;9 import org.passay.PasswordData;10 import org.passay.PasswordValidator;11 import org.passay.Rule;12 import org.passay.RuleResult;13 14…… Continue reading Verifying password has alphanumeric and special characters

Verifying password is of specified length

In this post under Passay, I will show with example how to verify that the password is of specified length. Below is the complete code for your reference Main class 1 package defaultPackage;2 3 import org.passay.LengthRule;4 import org.passay.PasswordData;5 import org.passay.PasswordValidator;6 import org.passay.Rule;7 import org.passay.RuleResult;8 9 public class Example3 {10 public static void main(String[] args) {11…… Continue reading Verifying password is of specified length

Displaying meaningful error messages when password validation fails

In this post under Passay, I will show with example how to display error messages for failed password validation. Below is the complete code for your reference. Main class 1 package defaultPackage;2 3 import java.util.List;4 import java.util.Scanner;5 6 import org.passay.LengthRule;7 import org.passay.PasswordData;8 import org.passay.PasswordValidator;9 import org.passay.Rule;10 import org.passay.RuleResult;11 12 public class Example2 {13 public static…… Continue reading Displaying meaningful error messages when password validation fails

Verifying password length is within specified min and max length

In this post under Passay, I will show with example how to verify whether a user entered password is within the configured length. Below is the complete main code for your reference. Main code 1 package defaultPackage;2 3 import java.util.Scanner;4 5 import org.passay.LengthRule;6 import org.passay.PasswordData;7 import org.passay.PasswordValidator;8 import org.passay.Rule;9 import org.passay.RuleResult;10 11 public class Example1…… Continue reading Verifying password length is within specified min and max length