Passay Tutorial
Selected Reading
- Passay - Discussion
- Passay - Resources
- Passay - Quick Guide
- Passay − usernameRule
- passay − RepeatCharacterRegexRule
- Passay − HistoryRule
- Passay − DictionarySubstringRule
- Passay − DictionaryRule
- Passay − WhitespaceRule
- Passay − NumberRangeRule
- Passay − lllegalCharacterRule
- Passay − LengthComplexityRule
- Passay − CharacterCharacteristicsRule
- passay − LengthRule
- Passay −CharacterRule
- Passay − AllowedRegexRule
- passay − AllowedCharacterRule
- Passay − Password Generation
- Passay − M of N Rules
- Passay − Customized Messages
- Passay − Password Validation
- Passay − environment Setup
- Passay − Overview
- Passay − Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Passay − DictionarySubstringRule
Passay - DictionarySubstringRule
DictionarySubstringRule allows to check if certain words are not part of a password. Consider the following example.
Example
import org.passay.DictionarySubstringRule; import org.passay.PasswordData; import org.passay.PasswordVapdator; import org.passay.RuleResult; import org.passay.dictionary.ArrayWordList; import org.passay.dictionary.WordListDictionary; pubpc class PassayExample { pubpc static void main(String[] args) { WordListDictionary wordListDictionary = new WordListDictionary( new ArrayWordList(new String[] { "password", "username" })); DictionarySubstringRule dictionaryRule = new DictionarySubstringRule(wordListDictionary); PasswordVapdator vapdator = new PasswordVapdator(dictionaryRule); PasswordData password = new PasswordData("password@123"); RuleResult result = vapdator.vapdate(password); if(result.isVapd()){ System.out.println("Password vapdated."); }else{ System.out.println("Invapd Password: " + vapdator.getMessages(result)); } } }
Output
Invapd Password: [Password contains the dictionary word password .]Advertisements