X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-deforg%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Forg%2FDefaultOrg.java;h=b36c6f24e9da5df2e8cd021a35e7e3c4e31bc0c3;hb=refs%2Fchanges%2F51%2F56951%2F1;hp=dd4a8260c1f90a4634f5184bd654b3b8729d1972;hpb=9c8a8b0926b13b07fb1e5394903401e7a3f1ff79;p=aaf%2Fauthz.git diff --git a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java index dd4a8260..b36c6f24 100644 --- a/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java +++ b/auth/auth-deforg/src/main/java/org/onap/aaf/org/DefaultOrg.java @@ -203,14 +203,27 @@ public class DefaultOrg implements Organization { } private static final String SPEC_CHARS = "!@#$%^*-+?/,:;."; - private static final Pattern PASS_PATTERN=Pattern.compile("((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[" + SPEC_CHARS +"]).{6,20})"); + private static final Pattern PASS_PATTERN=Pattern.compile("(((?=.*[a-z,A-Z])(((?=.*\\d))|(?=.*[" + SPEC_CHARS +"]))).{6,20})"); /** + * ( # Start of group + * (?=.*[a-z,A-Z]) # must contain one character + * + * (?=.*\d) # must contain one digit from 0-9 + * OR + * (?=.*[@#$%]) # must contain one special symbols in the list SPEC_CHARS + * + * . # match anything with previous condition checking + * {6,20} # length at least 6 characters and maximum of 20 + * ) # End of group + * + * Another example, more stringent pattern + private static final Pattern PASS_PATTERN=Pattern.compile("((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[" + SPEC_CHARS +"]).{6,20})"); * Attribution: from mkyong.com * ( # Start of group - * (?=.*\d) # must contains one digit from 0-9 - * (?=.*[a-z]) # must contains one lowercase characters - * (?=.*[A-Z]) # must contains one uppercase characters - * (?=.*[@#$%]) # must contains one special symbols in the list SPEC_CHARS + * (?=.*\d) # must contain one digit from 0-9 + * (?=.*[a-z]) # must contain one lowercase characters + * (?=.*[A-Z]) # must contain one uppercase characters + * (?=.*[@#$%]) # must contain one special symbols in the list SPEC_CHARS * . # match anything with previous condition checking * {6,20} # length at least 6 characters and maximum of 20 * ) # End of group @@ -230,11 +243,11 @@ public class DefaultOrg implements Organization { } private static final String[] rules = new String[] { - "Passwords must contain one digit from 0-9", - "Passwords must contain one lowercase character", - "Passwords must contain one uppercase character", - "Passwords must contain one special symbols in the list \""+ SPEC_CHARS + '"', - "Passwords must be between 6 and 20 chars in length" + "Passwords must contain letters", + "Passwords must contain one of the following:", + " Number", + " One special symbols in the list \""+ SPEC_CHARS + '"', + "Passwords must be between 6 and 20 chars in length", }; @Override