refactor(系统设置): 校验OAuth2映射属性

This commit is contained in:
shiziyuan9527 2022-12-09 16:43:54 +08:00 committed by lyh
parent f6573664b5
commit 9e84195cb6
1 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,8 @@ import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service
@ -293,6 +295,12 @@ public class SSOService {
if (StringUtils.isBlank(userid)) {
MSException.throwException("userid is empty!");
}
Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
Matcher m = p.matcher(userid);
if (m.find()) {
MSException.throwException("userid cannot contain Chinese characters!");
}
if (StringUtils.isBlank(username)) {
username = userid;
}