修复内容

This commit is contained in:
wenc000 2019-12-15 18:40:29 +08:00
parent cd51281e8e
commit 0780956db5
2 changed files with 54 additions and 1 deletions

View File

@ -66,7 +66,6 @@ public class SecurityComponent {
List<String> roleIds = new ArrayList<>();
for (GrantedAuthority grantedAuthority : grantedAuthorities) {
RoleGrantedAuthority roleGrantedAuthority = (RoleGrantedAuthority) grantedAuthority;
;
roleIds.add(roleGrantedAuthority.getRoleId());
}
return roleIds;

View File

@ -15,6 +15,18 @@ import java.util.regex.Pattern;
**/
public class RegexUtil {
/**
* 特殊字符
*/
public static final String SPECIAL_CHARACTERS = "#?!@$%^&*-_";
/**
* 密码最小长度
*/
public static final int PASSWORD_LENGTH_MIN = 6;
/**
* 密码最大长度
*/
public static final int PASSWORD_LENGTH_MAX = 16;
/**
* 手机
*/
@ -35,6 +47,48 @@ public class RegexUtil {
* 身份证
*/
private static final Pattern PATTERN_IDENTITY = Pattern.compile("(^\\d{15}$)|(^\\d{17}(x|X|\\d)$)");
/**
* 弱密码
*/
private static final Pattern PASSWORD_WEEK = Pattern.compile(String.format("(?=.*[A-Za-z0-9%s]).{%d,%d}", SPECIAL_CHARACTERS, PASSWORD_LENGTH_MIN, PASSWORD_LENGTH_MAX));
/**
* 中密码
*/
private static final Pattern PASSWORD_MIDDLE = Pattern.compile(String.format("((?=.*[A-Za-z])(?=.*[0-9]))|((?=.*[A-Za-z])(?=.*[%s]))|((?=.*[0-9])(?=.*[%s])).{%d,%d}", SPECIAL_CHARACTERS, SPECIAL_CHARACTERS, PASSWORD_LENGTH_MIN, PASSWORD_LENGTH_MAX));
/**
* 强密码
*/
private static final Pattern PASSWORD_STRONG = Pattern.compile(String.format("(?=.*[A-Za-z])(?=.*[0-9])(?=.*[%s]).{%d,%d}", SPECIAL_CHARACTERS, PASSWORD_LENGTH_MIN, PASSWORD_LENGTH_MAX));
/**
* 判断弱密码强度
*
* @param input
* @return
*/
public static boolean isPasswordWeek(String input) {
return PASSWORD_WEEK.matcher(input).matches();
}
/**
* 判断中密码强度
*
* @param input
* @return
*/
public static boolean isPasswordMiddle(String input) {
return PASSWORD_MIDDLE.matcher(input).matches();
}
/**
* 判断强密码强度
*
* @param input
* @return
*/
public static boolean isPasswordStrong(String input) {
return PASSWORD_STRONG.matcher(input).matches();
}
/**
* 判断电话