Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

generate random password in spring boot

public String generatePassayPassword() {
    PasswordGenerator gen = new PasswordGenerator();
    CharacterData lowerCaseChars = EnglishCharacterData.LowerCase;
    CharacterRule lowerCaseRule = new CharacterRule(lowerCaseChars);
    lowerCaseRule.setNumberOfCharacters(2);

    CharacterData upperCaseChars = EnglishCharacterData.UpperCase;
    CharacterRule upperCaseRule = new CharacterRule(upperCaseChars);
    upperCaseRule.setNumberOfCharacters(2);

    CharacterData digitChars = EnglishCharacterData.Digit;
    CharacterRule digitRule = new CharacterRule(digitChars);
    digitRule.setNumberOfCharacters(2);

    CharacterData specialChars = new CharacterData() {
        public String getErrorCode() {
            return ERROR_CODE;
        }

        public String getCharacters() {
            return "!@#$%^&*()_+";
        }
    };
    CharacterRule splCharRule = new CharacterRule(specialChars);
    splCharRule.setNumberOfCharacters(2);

    String password = gen.generatePassword(10, splCharRule, lowerCaseRule, 
      upperCaseRule, digitRule);
    return password;
}
Comment

PREVIOUS NEXT
Code Example
Java :: string to char in java 
Java :: set ImageView size programmatically android 
Java :: change string into binary uding java 
Java :: tableau de classe java 
Java :: java dynamic method dispatch 
Java :: check GPS is on android 
Java :: send whatsapp message java android studio 
Java :: java.math.biginteger cannot be cast to java.lang.long 
Java :: create new empty list java 
Java :: setting scale to big decimal java 
Java :: find number of occurrences of a substring in a string java 
Java :: how to assert that an exception is thrown java 
Java :: Java print class type 
Java :: how to convert a number into a decimal number in java 
Java :: How to efficiently shift a linked list by k positions, in Java? 
Java :: check if a string is empty java 
Java :: code for checking android build version 
Java :: fill two dimensional array column by column java 
Java :: write an infinite loop java 
Java :: 64 bit integer java 
Java :: useColorScheme returning light 
Java :: find maximum in array java 
Java :: hello world! java 
Java :: how to convert primitive int to Integer in java 
Java :: queue in java 
Java :: how to delete character in string java 
Java :: java printf 
Java :: java constructor overloading 
Java :: java exception 
Java :: BufferredReader Class 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =