forked from fanruan/design
Browse Source
Merge in DESIGN/design from ~LANLAN/design:release/10.0 to release/10.0 * commit '78218164b4ac454458eabefc7efe5c3be07538df': 单独写一个 DefaultLoginKeys REPORT-72595 FR源码中存在加密密钥硬编码,建议放到配置文件中
Lanlan
2 years ago
3 changed files with 55 additions and 3 deletions
@ -0,0 +1,48 @@ |
|||||||
|
package com.fr.design.login.config; |
||||||
|
|
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Properties; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Lanlan |
||||||
|
* @version 10.0 |
||||||
|
* Created by Lanlan on 2022/6/20 |
||||||
|
*/ |
||||||
|
public class DefaultLoginKeys { |
||||||
|
|
||||||
|
private static final String FILENAME = "com/fr/design/config/default"; |
||||||
|
|
||||||
|
private static final DefaultLoginKeys INSTANCE = new DefaultLoginKeys(); |
||||||
|
|
||||||
|
public static DefaultLoginKeys getInstance() { |
||||||
|
return INSTANCE; |
||||||
|
} |
||||||
|
|
||||||
|
private final Map<String, String> keys = new HashMap<>(); |
||||||
|
|
||||||
|
private DefaultLoginKeys() { |
||||||
|
Properties properties = load(); |
||||||
|
for (Map.Entry<Object, Object> entry : properties.entrySet()) { |
||||||
|
String name = entry.getKey().toString(); |
||||||
|
keys.put(name, entry.getValue().toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public String getKey(String name) { |
||||||
|
return keys.get(name); |
||||||
|
} |
||||||
|
|
||||||
|
private Properties load() { |
||||||
|
Properties properties = new Properties(); |
||||||
|
try (InputStream inputStream = DefaultLoginKeys.class.getClassLoader().getResourceAsStream(FILENAME)) { |
||||||
|
properties.load(inputStream); |
||||||
|
} catch (IOException e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
return properties; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue