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

This commit is contained in:
shiziyuan9527 2022-12-09 16:43:54 +08:00 committed by lyh
parent d0f95b5073
commit d0c2d0d0c9
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.Map;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service @Service
@ -294,6 +296,12 @@ public class SSOService {
if (StringUtils.isBlank(userid)) { if (StringUtils.isBlank(userid)) {
MSException.throwException("userid is empty!"); 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)) { if (StringUtils.isBlank(username)) {
username = userid; username = userid;
} }