|
@@ -13,11 +13,14 @@ import org.springframework.security.core.token.Token;
|
|
|
import org.springframework.security.core.token.TokenService;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.sql.CallableStatement;
|
|
|
import java.sql.PreparedStatement;
|
|
|
import java.sql.ResultSet;
|
|
|
import java.sql.SQLException;
|
|
|
+import java.util.Properties;
|
|
|
|
|
|
|
|
|
@MappedJdbcTypes(JdbcType.VARCHAR)
|
|
@@ -27,8 +30,6 @@ public class EncryptHandler implements TypeHandler<String> {
|
|
|
|
|
|
public static final boolean ENCRYPT_STATUS = true; //是否开启字段加密
|
|
|
|
|
|
- @Value("${phone.conceal:false}")
|
|
|
- private static boolean phoneConceal;
|
|
|
|
|
|
public static String decrypt(String value) {
|
|
|
if (null == value) {
|
|
@@ -38,6 +39,15 @@ public class EncryptHandler implements TypeHandler<String> {
|
|
|
return value;
|
|
|
}
|
|
|
String s = SecureUtil.aes(KEYS).decryptStr(value);
|
|
|
+ Boolean phoneConceal = false;
|
|
|
+ try (InputStream inputStream = EncryptHandler.class.getClassLoader().getResourceAsStream("application.yml")) {
|
|
|
+ Properties properties = new Properties();
|
|
|
+ properties.load(inputStream);
|
|
|
+ String property = properties.getProperty("conceal");
|
|
|
+ phoneConceal = Boolean.valueOf(property);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
if (phoneConceal){
|
|
|
//开启手机号码加密
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|